Today: Intersections, lines, and planes

Creating a grid of cubes in 3D space to display a representation of a parametric plane between three different 3D points.

Learnings:

  • For loops that use an incrementing operator (+=, eg.) that also include another incrementing operator (+=) on the same variable will double-dip.
for (int i = 0; i < ValueVar; i += someIncrement){
moveObjectXPos = i;
i += someIncrement; //this guy isn't required because it's already happening in the for loop,
//your move object will double the value of the someIncrement
}
  • In my code for this project I’m entering an int value of how many cubes square I would like the planar representation to be; I have to do a division of 1 to normalize the spacing regardless of the positions of the 3 points that are defining the plane. So this can introduce some unwanted behaviour if there are rounding issues with the int value that’s entered. (For example, a 12x12 plane is instantiating 13 cubes because 1/12 is 0.0833 repeating and I think it’s .0011111 shy of fulfilling the For-loop < 1 requirement so it puts one more cube which throws it over the for-loop limit. In other words, I’m not using the limitation of 12; I’m using a translation of .0833 repeating until the for-loop limit is reached.
  • Getting more familiar with class generation: in fact, I did learn how to override an operator +/- so that the Coords class that I made can perform addition and subtraction with other Coords objects instead of always breaking down the x,y,z class members and hand-coding that part.

Off to finish the rest of this module!

DCDE Planar Representation

Newer Post...
University Bound!