rotating a triangle

Discuss OrbForms Designer and PocketC Architect

rotating a triangle

Postby antix on Fri Dec 07, 2007 6:52 pm

Part of the game im creating uses lines to create a ship, in the shape of a triangle. What I was planning on doing, was use a center point, then draw the 3 edges of the triangle relative to the center, with the top point in the direction that the 'ship' is facing. I believe I could use cos and sine to get the direction, and move the points to the correct positions. What my problem is, is that I have no idea how to do this. My understanding of cos and sine is limited, so could anyone give me a hand? Give me an example, formula, or a suggestion? Any help would be seriously appriciated. Thanks.
Posts: 17
Joined: Tue Nov 08, 2005 9:37 pm
Location: USA

Re: rotating a triangle

Postby picstart on Sat Jan 12, 2008 10:20 pm

Well much depends on the resolution of the angles. If the resolution is coarse say every 15 degs of rotation a look up table with the cartesian coordinates of the vertices would work. A line drawing algorith (Breshenham Ex) would draw the lines between the vertices. For fine resolution deg of arc then I'd look at the CORDIC to rotate the (x.y) or if you prefer sine and cosine values this is the math
coords (x,y) are rotated through angle a to (x',y')
Watch out for quadrant issues sin and cos are cyclical.
Posts: 3
Joined: Mon Dec 17, 2007 6:26 pm

Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests