Aaah! No hurries, I'll confess I'm haven't gone in to make things super-readable. In fact, I'll take suggestions on how to document the code so it's more user-friendly. I do this as a hobby, so I'm not up to date on the "best practices."Saegor wrote:i'm sorry but i don't understand the way you draw your cube, so i will take time to read your code and try to make some light on thatsanjiv wrote:Have any of you run into unusual problems following this strategy?
And perhaps the following might help make sense of how I've done things.
1) Each face of the cube is drawn separately, and the order in which they're drawn changes based on the angle at which the axis is rotated (of course sometimes you're going to want to draw the top before the bottom, and sometimes you'll want to draw the bottom before the top).
2) Each surface is, first and foremost, a polygon. The points of that polygon are usually defined by an equation that's like "centerPosition+distanceToRigthFace+distanceToFrontFace+distanceToTopFace." Starting from the center, that would get you to the upper right, forward corner of the cube.
3) The "distanceToRightFace" value would be calculated using something like "(cube width/2) * scewFactorAlongX(orY). The scewFactor changes based on the angles of rotation.
Of course, all these distance values would have both x-axis and y-axis components.
EDIT: Rotation is currently a property of the Axis, and not the Box. I believe the Box has variables such that it CAN be rotated relative to the axis, but I haven't done anything with that yet.