samifox 发表于 2022-7-5 22:49:35

三角练习1

你好
我开始学习trigo,
我的程序应该做一件简单的事情,
[列表=1]
[*]用户按p1,而不是p2(垂直上下)
[*]将绘制一条线,组成线段A
[*]用户按p3(水平,形成底座)
[*]c段(hyp)距离和角度将发生
[*]将绘制一条线,组成c段
[/列表]
 
最终输出不正确
知道为什么吗?
 
 

(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
      (+
        (* (distancep1 p2) (distancep1 p2)) ;power 2
        (* (distancep2 p3) (distancep2 p3)) ;power 2
      )
    )
)



;;; get the angle of the missing segment

(setq raw (/ (distancep2 p3) (distancep1 p2)));;; get tanges


(setq p4 (polar p3 (atan raw)dst))
(command "_pline" p3 p4 "")


)

Lee Mac 发表于 2022-7-5 23:16:43

 
您正在计算的角度是三角形的内角,而提供给极轴函数的角度是从x轴测量的。

BIGAL 发表于 2022-7-5 23:43:58

Samifox为什么不画一条线?而不是3个,或者你想要全部3个?你仍然可以做角度等
 

(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" )

samifox 发表于 2022-7-6 00:01:05

你好
 
据我所知,
 
(极坐标(从p3开始)(方向27度)(拍摄长度11.18))
 
对不对?
 
(见附件)
页: [1]
查看完整版本: 三角练习1