Ok peoples, here's the thing. We have to make a program (a rather stupid one at that) to draw a triangle with two circles attached. The center point of the circles are the points at the end of the base of the triangle. The user inputs both radius's, the starting point (center of 1st circle), the length to the center of the 2nd circle, and the angle from the start, to the top of the triangle (point 3).
Here's what I've got so far:
(defun tan (angle)
(/ (sin angle) (cos angle))
)
(defun dtor (angle)
(/ (* angle pi) 180)
)
(defun C:4ctri(/ R1 R2 P1 L A H)
(setq R1 (getdist "\ Enter Radius of 1st Circle: "))
(setq R2 (getdist "\ Enter Radius of 2nd Circle: "))
(setq P1 (getpoint "\ Enter Center Point of 1st Circle: "))
(setq L (getdist "\ Enter Length to Center of 2nd Circle: "))
(setq A (getangle "\ Specify the Angle: "))
(setq H (* (/ L 2) (tan (dtor A))))
(setq X1 (car P1))
(setq Y1 (cadr P1))
(setq X2 (+ X1 L))
(setq Y2 Y1)
(setq P2 (List X2 Y2 0))
(setq X3 (+ X1 (/ L 2)))
(setq Y3 (+ Y1 H))
(setq P3 (List X3 Y3 0))
(command "line" P1 P2 P3 "c")
(command "circle" P1 R1)
(command "circle" P2 R2)
)
I think my problem is somewhere in getting my height. The program takes all the user inputs, and draws both circles and the base correctly, but that's where I get problems. Does anybody have any ideas on where I went wrong?
Here's what I've got so far:
(defun tan (angle)
(/ (sin angle) (cos angle))
)
(defun dtor (angle)
(/ (* angle pi) 180)
)
(defun C:4ctri(/ R1 R2 P1 L A H)
(setq R1 (getdist "\ Enter Radius of 1st Circle: "))
(setq R2 (getdist "\ Enter Radius of 2nd Circle: "))
(setq P1 (getpoint "\ Enter Center Point of 1st Circle: "))
(setq L (getdist "\ Enter Length to Center of 2nd Circle: "))
(setq A (getangle "\ Specify the Angle: "))
(setq H (* (/ L 2) (tan (dtor A))))
(setq X1 (car P1))
(setq Y1 (cadr P1))
(setq X2 (+ X1 L))
(setq Y2 Y1)
(setq P2 (List X2 Y2 0))
(setq X3 (+ X1 (/ L 2)))
(setq Y3 (+ Y1 H))
(setq P3 (List X3 Y3 0))
(command "line" P1 P2 P3 "c")
(command "circle" P1 R1)
(command "circle" P2 R2)
)
I think my problem is somewhere in getting my height. The program takes all the user inputs, and draws both circles and the base correctly, but that's where I get problems. Does anybody have any ideas on where I went wrong?
Comment