几何图元

向量

1
2
3
4
Vector2 {
x: number,
y: number,
}
1
2
3
4
5
Vector3 {
x: number,
y: number,
z: number,
}

1
2
3
4
Point2 {
x: number,
y: number,
}
1
2
3
4
5
Point3 {
x: number,
y: number,
z: number,
}

线

线段

1
2
3
4
LineSegment2 {
source: Point2,
target: Point2,
}

1
2
3
4
CircleSegment2 {
center: Point2,
radius: number,
}

圆弧

1
2
3
4
5
ArcSegment2 {
support: CircleSegment2,
source_radian: number,
source_radian: number,
}

直线

1
2
3
4
5
6
// ax + by + c = 0
Line2 {
a: number,
b: number,
c: number,
}

射线

1
2
3
4
Ray2 {
origin: Point2,
direction: Vector2,
}

方向

1
2
3
4
enum Orientation {
Clockwise,
CounterClockwise,
}

三角形

1
2
3
4
5
6
Triangle2 {
a: Point2,
b: Point2,
c: Point2,
orientation: Orientation, // 通过三点的顺序判断
}

多边形

1
2
3
4
Polygon2 {
vertices: Point2[],
edges: LineSegment2[], // 通过 vertices 按序连接生成
}