|
发表于 2004-8-4 11:15:00
|
显示全部楼层
(3)根据二维的起点和终点创建直线。 public Line AddLine(Point2d pt1, Point2d pt2) { Line line; line = AddLine(new Point3d(pt1.X, pt1.Y, 0), new Point3d(pt2.X, pt2.Y, 0)); //调用上面创建的基准函数 return line; }(4)已知起点和终点相对于起点的直角坐标,创建直线。public Line AddLine(Point3d pt1, double x, double y) { Line line; Point3d pt2 = new Point3d(); pt2.X = pt1.X + x; pt2.Y = pt1.Y + y; pt2.Z = pt1.Z; line = AddLine(pt1, pt2); return line; }(5) 已知起点和终点相对于起点的极坐标,创建直线。public Line AddLineR(Point3d pt1, double angle, double length) { Line line; Point3d pt2 = new Point3d(); pt2 = GetPointAR(pt1, angle, length); line = AddLine(pt1, pt2); return line; }其中,GetPointAR是已知一点和另一点相对于该点的极坐标,求另上点的绝对坐标。public Point3d GetPointAR(Point3d pt1,double angle,double length) { Point3d pt2=new Point3d(); pt2.X = pt1.X + length * Math.Cos(angle); pt2.Y = pt1.Y + length * Math.Sin(angle); pt2.Z = pt1.Z; return pt2;
} |
|