-
-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathshape.ts
More file actions
39 lines (29 loc) · 786 Bytes
/
shape.ts
File metadata and controls
39 lines (29 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { ICopy, IObjectOf, IToHiccup } from "@thi.ng/api";
import type { Vec } from "@thi.ng/vectors";
export type Attribs = IObjectOf<any>;
export interface IAttributed<T> {
attribs?: Attribs;
withAttribs(attribs: Attribs): T;
}
export interface IShape<T extends IShape = IShape<any>>
extends IAttributed<T>,
ICopy<T> {
readonly type: number | string;
}
export interface AABBLike extends IShape<AABBLike> {
pos: Vec;
size: Vec;
max(): Vec;
offset(x: number): this;
}
export interface SphereLike extends IShape<SphereLike> {
pos: Vec;
r: number;
}
export interface PCLike extends IShape<PCLike> {
points: Vec[];
}
export interface PCLikeConstructor {
new (pts: Vec[], attribs?: Attribs): PCLike;
}
export interface IHiccupShape extends IShape, IToHiccup {}