Skip to content

Commit

Permalink
feat(geom-api): add IAttributed, update IShape
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 24, 2022
1 parent 6c46434 commit 35799db
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/geom-api/src/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,37 @@ import type { Vec } from "@thi.ng/vectors";

export type Attribs = IObjectOf<any>;

export interface IShape extends ICopy<IShape> {
readonly type: number | string;
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 {
export interface AABBLike extends IShape<AABBLike> {
pos: Vec;
size: Vec;

max(): Vec;
offset(x: number): this;
}

export interface SphereLike extends IShape {
export interface SphereLike extends IShape<SphereLike> {
pos: Vec;
r: number;
}

export interface IHiccupShape extends IShape, IToHiccup {}

export interface PCLike extends IShape {
export interface PCLike extends IShape<PCLike> {
points: Vec[];
}

export interface PCLikeConstructor {
new (pts: Vec[], attribs: Attribs): PCLike;
}

export interface IHiccupShape extends IShape, IToHiccup {}

0 comments on commit 35799db

Please sign in to comment.