No, self.NEGFACTOR is most definitely set explicitly to -1 * self.FACTOR. =(
~d
D
dmwit
@dmwit
0
Reputation
4
Posts
20
Profile views
0
Followers
0
Following
Best posts made by dmwit
This user hasn't posted anything yet.
Latest posts made by dmwit
-
RE: Thought not required
-
Thought not required
I just recently got interested in vPython for doing graphics. I thought I'd look at the code they had as examples of good form, and found this little gem:
if pfc.x > self.boidflock[aboid].x:
pfc.x = (pfc.x - self.boidflock[aboid].x)*self.FACTOR
if pfc.x < self.boidflock[aboid].x:
pfc.x = (self.boidflock[aboid].x - pfc.x)*self.NEGFACTOR
if pfc.y > self.boidflock[aboid].y:
pfc.y = (pfc.y - self.boidflock[aboid].y)*self.FACTOR
if pfc.y < self.boidflock[aboid].y:
pfc.y = (self.boidflock[aboid].y - pfc.y)*self.NEGFACTOR
if pfc.z > self.boidflock[aboid].z:
pfc.z = (pfc.z - self.boidflock[aboid].z)*self.FACTOR
if pfc.z < self.boidflock[aboid].z:
pfc.z = (self.boidflock[aboid].z - pfc.z)*self.NEGFACTOR
<font face="Times New Roman" size="4">I mean, it isn't terrible, but I probably would have just used
<font size="2"><font face="Courier New">pfc = (pfc - self.boidflock[aboid]) * self.FACTOR</font></font>
</font>