samifox Posted July 2, 2014 Share Posted July 2, 2014 Hi I start learning trigo, My program should do a simple thing, User press p1, than p2 (vertically up to down) A line will be drawn , composing segment a User press p3(horizontally, forming the base) segment c (hyp) distance and angle will take place A line will be drawn composing segment c Final output is not correct Any idea why? (defun finding-c(/ p1 p2 p3 dst segC isegC) (setq p1 (getpoint "\nSpecify first point")) (setq p2 (getpoint p1 "\nSpecify second point")) (command "_pline" p1 p2 "") (setq p3 (getpoint p2 "\nSpecify third point")) (command "_pline" p2 p3 "") ;;; get the length of the missing segment (setq dst (sqrt (+ (* (distance p1 p2) (distance p1 p2)) ;power 2 (* (distance p2 p3) (distance p2 p3)) ;power 2 ) ) ) ;;; get the angle of the missing segment (setq raw (/ (distance p2 p3) (distance p1 p2)));;; get tanges (setq p4 (polar p3 (atan raw) dst)) (command "_pline" p3 p4 "") ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 2, 2014 Share Posted July 2, 2014 Final output is not correctAny idea why? The angle that you are calculating is interior angle of the triangle, whereas the angle supplied to the polar function is measured from the x-axis. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 3, 2014 Share Posted July 3, 2014 (edited) Samifox Why not just draw 1 pline ? rather than 3 or do you want all 3 ? You can still do angles etc (setq p1 (getpoint "\nSpecify first point")) (setq p2 (getpoint p1 "\nSpecify second point")) (setq p3 (getpoint p2 "\nSpecify third point")) (command "_pline" P1 p2 p3 "C" ) Edited July 14, 2014 by SLW210 Quote Link to comment Share on other sites More sharing options...
samifox Posted July 3, 2014 Author Share Posted July 3, 2014 hi as far as i understand , (polar (start in p3) (orient 27 degrees) (shoot 11.18 length)) isnt that right? (see attachment) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.