Last edited by hbghlyj at 2025-3-24 01:35:55在 Geometry.asy 的基础上
默认的垂直符号太大了,减小一点
- markangleradiusfactor /= 3;
Copy the Code
平面几何作图需要对大量的点添加标签,做这个初始化表是为了解决这个问题,虽然有点丑,但可以实现.
此(string)能返回变量名字,可以简化很多标签的工作
- point[] p={A,B,C,D,E,F,X,Y,Z,M,N};
- for(int i=0;i<p.length;++i){
- dot(p[i],(string)p[i]);
- }
Copy the Code
返回与直线AB切于A且过C的圆
- circle tangentABC(point A,point B,point C)
- {
- point B2=scale(length(B-A)^2/length(B-C)^2,B)*C;
- return circle(B2,A,C);
- }
Copy the Code
A在BC上的投影
- point foot(point A,point B,point C)
- {
- return projection(line(B,C))*A;
- }
Copy the Code
A在圆c上,求直线AB与圆c的另外一个交点
- point intersectionpoint(circle c,point A,point B)
- {
- point[] p=intersectionpoints(line(A,B),c);
- if(p[0]==A)
- return p[1];
- else
- return p[0];
- }
Copy the Code
A在c上,求直线AB与c的另外一个交点
- point intersectionpoint(path c,point A,point B)
- {
- point[] p=intersectionpoints(line(A,B),c);
- if(p[0]==A)
- return p[1];
- else
- return p[0];
- }
Copy the Code
返回三角形ABC的垂心
- point chuixin(point A,point B,point C)
- {
- return orthocentercenter(triangle(A,B,C));
- }
Copy the Code
返回分割满足 AP=t PB 的点P,向量意义下,也就是高中教材里的定比分点
- point fendian(point A,point B,real t)
- {
- point C=(A+t*B)/(1+t);
- return C;
- }
Copy the Code
默认返回 \angle BAC 的内角平分线,如果 sharp=false,返回外角平分线
- line bisector(point A,point B,point C,bool sharp=true)
- {
- real t=length(A-B)/length(A-C);
- point X=fendian(B,C,t),Y=fendian(B,C,-t);
- if(sharp)
- return line(A,X);
- else
- return line(A,Y);
- }
Copy the Code
返回到A,B距离之比为t的阿氏圆
- circle acircle(point A,point B,real t)
- {
- return circle(fendian(A,B,t),fendian(A,B,-t));
- }
Copy the Code |