|
Post by Darkjester on Sept 3, 2008 17:11:00 GMT -5
Atn2? No idea what kinda of data that it returns but its not as accurite as atnd.
|
|
|
Post by Nicky Peter Hollyoake on Sept 3, 2008 19:14:15 GMT -5
Not working.
Textmode (TEXT_OVERLAID) GLMatrixMode(GL_PROJECTION) GLLoadidentity() GLOrTho(0, TextCols(), TextRows(), 0, 0, 1) GLMatrixMode(GL_MODELVIEW) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Declare Function Angle(x1#,y1#,x2#,y2#)
Struc sPoint Dim Pos#(1) EndStruc
Dim sPoint Point_1 Dim sPoint Point_2
'Set Point 1 to the center of the screen Point_1.Pos# = Vec2(TextCols()/2.0, TextRows()/2.0) While TRUE GLClear (GL_COLOR_BUFFER_BIT): CLS
'Point 2 movement is based on mouse pos Point_2.Pos# = Vec2(Mouse_X()*TextCols(), Mouse_Y()*TextRows())
'The 2 points GLPointSize(3) GLBegin (GL_POINTS)
GLColor3F(1, 0, 0) GLVertex2FV(Point_1.Pos#) GLVertex2FV(Point_2.Pos#) GLEnd()
'Angle line GLBegin (GL_LINES)
GLColor3F(0, 1, 0) GLVertex2FV(Point_1.Pos#) GLVertex2FV(Point_2.Pos#) GLEnd()
Locate 0, 0: Print Angle(Point_2.Pos#(0), Point_2.Pos#(1), Point_1.Pos#(0), Point_1.Pos#(1))
DrawText() Swapbuffers() Wend
'Angle function Function Angle(x1#,y1#,x2#,y2#) Dim Angle# = ATNd(x2#-x1#) Return 180-Angle# EndFunction
|
|
|
Post by Darkjester on Sept 3, 2008 19:19:02 GMT -5
How?
|
|
|
Post by Nicky Peter Hollyoake on Sept 3, 2008 21:13:27 GMT -5
Textmode (TEXT_OVERLAID) GLMatrixMode(GL_PROJECTION) GLLoadidentity() GLOrTho(0, TextCols(), TextRows(), 0, 0, 1) GLMatrixMode(GL_MODELVIEW) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Declare Function Angle#(x1#,y1#,x2#,y2#)
Struc sPoint Dim Pos#(1) EndStruc
Dim sPoint Point_1 Dim sPoint Point_2
'Set Point 1 to the center of the screen Point_1.Pos# = Vec2(TextCols()/2.0, TextRows()/2.0) While TRUE GLClear (GL_COLOR_BUFFER_BIT): CLS
'Point 2 movement is based on mouse pos Point_2.Pos# = Vec2(Mouse_X()*TextCols(), Mouse_Y()*TextRows())
'The 2 points GLPointSize(3) GLBegin (GL_POINTS)
GLColor3F(1, 0, 0) GLVertex2FV(Point_1.Pos#) GLVertex2FV(Point_2.Pos#) GLEnd()
'Angle line GLBegin (GL_LINES)
GLColor3F(0, 1, 0) GLVertex2FV(Point_1.Pos#) GLVertex2FV(Point_2.Pos#) GLEnd()
Locate 0, 0: Print Angle#(Point_1.Pos#(0), Point_1.Pos#(1), Point_2.Pos#(0), Point_2.Pos#(1))
DrawText() Swapbuffers() Wend
'Angle function Function Angle#(x1#,y1#,x2#,y2#) Dim NAngle# = ATN2D(x2#-x1#, y2#-y1#) Return 180-NAngle# EndFunction
|
|
|
Post by Darkjester on Sept 3, 2008 21:26:18 GMT -5
Yay! it Werks now!! I forgot to compensate for the reverse direction.
|
|
|
Post by andrian on Sept 4, 2008 13:45:45 GMT -5
do we have normalize in b4gl??
|
|