@shapediver/viewer.shared.math 3.3.4 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapediver/viewer.shared.math",
3
- "version": "3.3.4",
3
+ "version": "3.3.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Michael Oppitz <michael@shapediver.com>",
@@ -10,11 +10,10 @@
10
10
  "test": "__tests__"
11
11
  },
12
12
  "files": [
13
- "dist",
14
- "src",
15
13
  "package.json",
14
+ "dist/",
16
15
  "README.md",
17
- "tsconfig.json"
16
+ "LICENSE"
18
17
  ],
19
18
  "publishConfig": {
20
19
  "access": "public"
@@ -39,8 +38,8 @@
39
38
  "testEnvironment": "node"
40
39
  },
41
40
  "dependencies": {
42
- "@shapediver/viewer.shared.services": "3.3.4",
41
+ "@shapediver/viewer.shared.services": "3.3.7",
43
42
  "gl-matrix": "3.3.0"
44
43
  },
45
- "gitHead": "8193da527b4e3fc4d90181018bd60d6ac70be3e8"
44
+ "gitHead": "112787d5c5226cca5e89d08102d0b1a3dd4a1d71"
46
45
  }
@@ -1,200 +0,0 @@
1
- import { mat4, vec3, vec4 } from 'gl-matrix'
2
- import { Sphere } from '..';
3
- import { IBox } from '../interfaces/IBox';
4
- import { ISphere } from '../interfaces/ISphere';
5
-
6
-
7
- export class Box implements IBox {
8
- // #region Properties (2)
9
-
10
- private _boundingSphere: ISphere = new Sphere();
11
- private _boundingSphereState: { min: vec3, max: vec3 } = {
12
- min: vec3.create(), max: vec3.create()
13
- }
14
-
15
- // #endregion Properties (2)
16
-
17
- // #region Constructors (1)
18
- constructor(
19
- private _min: vec3 = vec3.fromValues(Infinity, Infinity, Infinity),
20
- private _max: vec3 = vec3.fromValues(-Infinity, -Infinity, -Infinity)
21
- ) { }
22
-
23
- // #endregion Constructors (1)
24
-
25
- // #region Public Accessors (5)
26
-
27
- public intersect(origin: vec3, direction: vec3): number | null {
28
- let tmin, tmax, txmin, txmax, tymin, tymax, tzmin, tzmax;
29
-
30
- const invdirx = 1 / direction[0],
31
- invdiry = 1 / direction[1],
32
- invdirz = 1 / direction[2];
33
-
34
- txmin = invdirx >= 0 ? (this.min[0] - origin[0]) * invdirx : (this.max[0] - origin[0]) * invdirx;
35
- txmax = invdirx >= 0 ? (this.max[0] - origin[0]) * invdirx : (this.min[0] - origin[0]) * invdirx;
36
- tmin = txmin;
37
- tmax = txmax;
38
-
39
- tymin = invdiry >= 0 ? (this.min[1] - origin[1]) * invdiry : (this.max[1] - origin[1]) * invdiry;
40
- tymax = invdiry >= 0 ? (this.max[1] - origin[1]) * invdiry : (this.min[1] - origin[1]) * invdiry;
41
-
42
- if ((tmin > tymax) || (tymin > tmax)) return null;
43
-
44
- // These lines also handle the case where tmin or tmax is NaN
45
- // (result of 0 * Infinity). x !== x returns true if x is NaN
46
-
47
- if (tymin > tmin || tmin !== tmin) tmin = tymin;
48
- if (tymax < tmax || tmax !== tmax) tmax = tymax;
49
-
50
- tzmin = invdirz >= 0 ? (this.min[2] - origin[2]) * invdirz : (this.max[2] - origin[2]) * invdirz;
51
- tzmax = invdirz >= 0 ? (this.max[2] - origin[2]) * invdirz : (this.min[2] - origin[2]) * invdirz;
52
-
53
- if ((tmin > tzmax) || (tzmin > tmax)) return null;
54
- if (tzmin > tmin || tmin !== tmin) tmin = tzmin;
55
- if (tzmax < tmax || tmax !== tmax) tmax = tzmax;
56
-
57
- //return point closest to the ray (positive side)
58
- if (tmax < 0) return null;
59
- return tmin >= 0 ? tmin : tmax;
60
- };
61
-
62
- public intersects(origin: vec3, direction: vec3): boolean {
63
- return this.intersect(origin, direction) === null ? false : true;
64
- };
65
-
66
- public get boundingSphere(): ISphere {
67
- if (!(this._boundingSphereState.min[0] === this.min[0] && this._boundingSphereState.min[1] === this.min[1] && this._boundingSphereState.min[2] === this.min[2] &&
68
- this._boundingSphereState.max[0] === this.max[0] && this._boundingSphereState.max[1] === this.max[1] && this._boundingSphereState.max[2] === this.max[2])) {
69
- this._boundingSphere.setFromBox(this);
70
- this._boundingSphereState = {
71
- min: vec3.clone(this.min),
72
- max: vec3.clone(this.max)
73
- };
74
- }
75
- return this._boundingSphere;
76
- }
77
-
78
- public get max(): vec3 {
79
- return this._max;
80
- }
81
-
82
- public set max(value: vec3) {
83
- this._max = value;
84
- }
85
-
86
- public get min(): vec3 {
87
- return this._min;
88
- }
89
-
90
- public set min(value: vec3) {
91
- this._min = value;
92
- }
93
-
94
- // #endregion Public Accessors (5)
95
-
96
- // #region Public Methods (5)
97
-
98
- public applyMatrix(matrix: mat4): Box {
99
- const points: vec3[] = [];
100
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.min[0], this.min[1], this.min[2]), matrix));
101
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.min[0], this.min[1], this.max[2]), matrix));
102
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.min[0], this.max[1], this.min[2]), matrix));
103
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.min[0], this.max[1], this.max[2]), matrix));
104
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.max[0], this.min[1], this.min[2]), matrix));
105
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.max[0], this.min[1], this.max[2]), matrix));
106
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.max[0], this.max[1], this.min[2]), matrix));
107
- points.push(vec3.transformMat4(vec3.create(), vec3.fromValues(this.max[0], this.max[1], this.max[2]), matrix));
108
-
109
- this.min = vec3.fromValues(Infinity, Infinity, Infinity);
110
- this.max = vec3.fromValues(-Infinity, -Infinity, -Infinity);
111
-
112
- for ( let i = 0, il = points.length; i < il; i ++ ) {
113
- this.min = vec3.fromValues(Math.min(this.min[0], points[i][0]), Math.min(this.min[1], points[i][1]), Math.min(this.min[2], points[i][2]));
114
- this.max = vec3.fromValues(Math.max(this.max[0], points[i][0]), Math.max(this.max[1], points[i][1]), Math.max(this.max[2], points[i][2]));
115
- }
116
- return this;
117
- }
118
-
119
- public clone(): IBox {
120
- return new Box(vec3.clone(this.min), vec3.clone(this.max))
121
- }
122
-
123
- public containsPoint(point: vec3): boolean {
124
- return point[0] < this.min[0] || point[0] > this.max[0] ||
125
- point[1] < this.min[1] || point[1] > this.max[1] ||
126
- point[2] < this.min[2] || point[2] > this.max[2] ? false : true;
127
- }
128
-
129
- public clampPoint(point: vec3): vec3 {
130
- point[0] = Math.max(this.min[0], Math.min(this.max[0], point[0]));
131
- point[1] = Math.max(this.min[1], Math.min(this.max[1], point[1]));
132
- point[2] = Math.max(this.min[2], Math.min(this.max[2], point[2]));
133
- return point;
134
- }
135
-
136
- public setFromAttributeArray(array: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array, stride?: number, bytes?: number, matrix?: mat4): IBox {
137
- const length = (Math.floor(array.length / 3) * 3);
138
- const byteStride = (stride && stride !== bytes) ? +stride : 3;
139
-
140
- const min = [Infinity, Infinity, Infinity];
141
- const max = [-Infinity, -Infinity, -Infinity];
142
-
143
- let x, y, z;
144
- const point = vec4.create();
145
- for (let i = 0; i < length; i += byteStride) {
146
- if(matrix) {
147
- vec4.transformMat4(point, [array[i], array[i + 1], array[i + 2], 1], matrix);
148
- x = point[0] / point[3];
149
- y = point[1] / point[3];
150
- z = point[2] / point[3];
151
- } else {
152
- x = array[i];
153
- y = array[i + 1];
154
- z = array[i + 2];
155
- }
156
-
157
- min[0] = Math.min(min[0], x);
158
- min[1] = Math.min(min[1], y);
159
- min[2] = Math.min(min[2], z);
160
-
161
- max[0] = Math.max(max[0], x);
162
- max[1] = Math.max(max[1], y);
163
- max[2] = Math.max(max[2], z);
164
- }
165
-
166
- this.min = vec3.fromValues(min[0], min[1], min[2]);
167
- this.max = vec3.fromValues(max[0], max[1], max[2]);
168
-
169
- return this;
170
- }
171
-
172
- public union(box: IBox): IBox {
173
- if (box.min[0] < this.min[0]) this.min[0] = box.min[0];
174
- if (box.min[1] < this.min[1]) this.min[1] = box.min[1];
175
- if (box.min[2] < this.min[2]) this.min[2] = box.min[2];
176
-
177
- if (box.max[0] > this.max[0]) this.max[0] = box.max[0];
178
- if (box.max[1] > this.max[1]) this.max[1] = box.max[1];
179
- if (box.max[2] > this.max[2]) this.max[2] = box.max[2];
180
- return this;
181
- }
182
-
183
- public isEmpty(): boolean {
184
- return this.min[0] === Infinity && this.min[1] === Infinity && this.min[2] === Infinity &&
185
- this.max[0] === -Infinity && this.max[1] === -Infinity && this.max[2] === -Infinity;
186
- }
187
-
188
- public reset(): void {
189
- vec3.zero(this._boundingSphere.center)
190
- this._boundingSphere.radius = 0;
191
-
192
- vec3.zero(this._boundingSphereState.min);
193
- vec3.zero(this._boundingSphereState.max);
194
-
195
- vec3.set(this._min, Infinity, Infinity, Infinity);
196
- vec3.set(this._max, -Infinity, -Infinity, -Infinity);
197
- }
198
-
199
- // #endregion Public Methods (5)
200
- }
@@ -1,86 +0,0 @@
1
- import { IPlane } from '../interfaces/IPlane';
2
- import { mat3, mat4, vec3 } from 'gl-matrix';
3
-
4
- export class Plane implements IPlane {
5
- // #region Constructors (1)
6
-
7
- constructor(private _normal: vec3 = vec3.fromValues(1, 0, 0), private _constant: number = 0) { }
8
-
9
- // #endregion Constructors (1)
10
-
11
- // #region Public Getters And Setters (4)
12
-
13
- public get constant(): number {
14
- return this._constant;
15
- }
16
-
17
- public set constant(value: number) {
18
- this._constant = value;
19
- }
20
-
21
- public get normal(): vec3 {
22
- return this._normal;
23
- }
24
-
25
- public set normal(value: vec3) {
26
- this._normal = value;
27
- }
28
-
29
- // #endregion Public Getters And Setters (4)
30
-
31
- // #region Public Methods (8)
32
-
33
- public applyMatrix(matrix: mat4): IPlane {
34
- let inverse = mat3.invert(mat3.create(), mat3.fromMat4(mat3.create(), matrix));
35
- if (!inverse) inverse = mat3.create();
36
- const normalMatrix = mat3.transpose(mat3.create(), inverse);
37
- const p = vec3.transformMat4(vec3.create(), vec3.multiply(vec3.create(), vec3.clone(this.normal), vec3.fromValues(this._constant, this._constant, this._constant)), matrix);
38
- this._normal = vec3.normalize(vec3.create(), vec3.transformMat3(vec3.create(), this._normal, normalMatrix));
39
- this.constant = -vec3.dot(p, this._normal);
40
- return this;
41
- }
42
-
43
- public clampPoint(point: vec3): vec3 {
44
- const d = -this.distanceToPoint(point);
45
- return vec3.add(vec3.create(), vec3.multiply(vec3.create(), this.normal, vec3.fromValues(d, d, d)), point);
46
- }
47
-
48
- public clone(): IPlane {
49
- return new Plane(this._normal, this._constant);
50
- }
51
-
52
- public containsPoint(point: vec3): boolean {
53
- return this.distanceToPoint(point) === 0;
54
- }
55
-
56
- public distanceToPoint(point: vec3): number {
57
- return vec3.dot(this.normal, point) + this.constant;
58
- }
59
-
60
- public intersect(origin: vec3, direction: vec3): number | null {
61
- const denominator = vec3.dot(this.normal, direction);
62
- if (denominator === 0) {
63
- // line is coplanar, return origin
64
- if (this.distanceToPoint(origin) === 0) return 0;
65
- // Null is preferable to undefined since undefined means.... it is undefined
66
- return null;
67
- }
68
- const t = - (vec3.dot(origin, this.normal) + this.constant) / denominator;
69
- if (t < 0) return null;
70
-
71
- return t; //vec3.add(vec3.create(), vec3.multiply(vec3.create(), direction, vec3.fromValues(t,t,t)), origin);
72
- }
73
-
74
- public reset() {
75
- this._normal = vec3.fromValues(1, 0, 0);
76
- this._constant = 0;
77
- }
78
-
79
- public setFromNormalAndCoplanarPoint(normal: vec3, point: vec3): IPlane {
80
- vec3.copy(this.normal, normal);
81
- this.constant = -vec3.dot(point, this.normal);
82
- return this;
83
- }
84
-
85
- // #endregion Public Methods (8)
86
- }
@@ -1,105 +0,0 @@
1
- import { mat4, vec3 } from 'gl-matrix'
2
- import { IBox } from '../interfaces/IBox';
3
- import { ISphere } from '../interfaces/ISphere';
4
-
5
- export class Sphere implements ISphere {
6
- // #region Constructors (1)
7
-
8
- constructor(
9
- private _center: vec3 = vec3.create(),
10
- private _radius: number = 0
11
- ) { }
12
-
13
- // #endregion Constructors (1)
14
-
15
- // #region Public Accessors (4)
16
-
17
- public get center(): vec3 {
18
- return this._center;
19
- }
20
-
21
- public set center(value: vec3) {
22
- this._center = value;
23
- }
24
-
25
- public get radius(): number {
26
- return this._radius;
27
- }
28
-
29
- public set radius(value: number) {
30
- this._radius = value;
31
- }
32
-
33
- // #endregion Public Accessors (4)
34
-
35
- // #region Public Methods (4)
36
-
37
- public applyMatrix(matrix: mat4): Sphere {
38
- this._center = vec3.transformMat4(vec3.create(), this._center, matrix);
39
- const scaleXSq = matrix[0] * matrix[0] + matrix[1] * matrix[1] + matrix[2] * matrix[2];
40
- const scaleYSq = matrix[4] * matrix[4] + matrix[5] * matrix[5] + matrix[6] * matrix[6];
41
- const scaleZSq = matrix[8] * matrix[8] + matrix[9] * matrix[9] + matrix[10] * matrix[10];
42
- const maxScaleOnAxis = Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));
43
- this.radius = this.radius * maxScaleOnAxis;
44
- return this;
45
- }
46
-
47
- public clone(): ISphere {
48
- return new Sphere(vec3.clone(this._center), this._radius);
49
- }
50
-
51
- public containsPoint(point: vec3): boolean {
52
- return (vec3.squaredDistance(point, this.center) <= (this.radius * this.radius));
53
- }
54
-
55
- public clampPoint(point: vec3): vec3 {
56
- return point;
57
- }
58
-
59
- public intersect(origin: vec3, direction: vec3): number | null {
60
- // vector from ray origin to sphere center
61
- const rayToSphere = vec3.sub(vec3.create(), this.center, origin);
62
-
63
- // project rayToSphere onto direction
64
- const projection = vec3.dot(rayToSphere, direction);
65
-
66
- // distance from sphere center to projection
67
- const distanceToProjection = vec3.squaredDistance(rayToSphere, vec3.multiply(vec3.create(), direction, vec3.fromValues(projection, projection, projection)));
68
-
69
- // check if the distance to projection is less than the radius
70
- if (distanceToProjection <= this.radius * this.radius) {
71
- // calculate the distance from the origin to the intersection point
72
- const distanceToIntersection = Math.sqrt(this.radius * this.radius - distanceToProjection);
73
- return projection - distanceToIntersection;
74
- }
75
-
76
- // if there is no intersection, return null
77
- return null;
78
- }
79
-
80
- public intersects(origin: vec3, direction: vec3): boolean {
81
- // vector from ray origin to sphere center
82
- const rayToSphere = vec3.sub(vec3.create(), this.center, origin);
83
-
84
- // project rayToSphere onto direction
85
- const projection = vec3.dot(rayToSphere, direction);
86
-
87
- // distance from sphere center to projection
88
- const distanceToProjection = vec3.squaredDistance(rayToSphere, vec3.multiply(vec3.create(), direction, vec3.fromValues(projection, projection, projection)));
89
- return distanceToProjection <= this.radius * this.radius;
90
- }
91
-
92
- public setFromBox(box: IBox): ISphere {
93
- vec3.add(this.center, box.min, box.max);
94
- vec3.scale(this.center, this.center, 0.5);
95
- this.radius = vec3.dist(box.min, box.max) * 0.5;
96
- return this;
97
- }
98
-
99
- public reset() {
100
- this._center = vec3.create();
101
- this._radius = 0;
102
- }
103
-
104
- // #endregion Public Methods (4)
105
- }
@@ -1,61 +0,0 @@
1
- import { vec3 } from 'gl-matrix'
2
- import { ISpherical } from '../interfaces/ISpherical';
3
-
4
- export class Spherical implements ISpherical {
5
- constructor(
6
- private _radius: number = 1,
7
- private _phi: number = 0,
8
- private _theta: number = 0,
9
- ) { }
10
-
11
-
12
- public get radius(): number {
13
- return this._radius;
14
- }
15
-
16
- public set radius(value: number) {
17
- this._radius = value;
18
- }
19
-
20
-
21
- public get phi(): number {
22
- return this._phi;
23
- }
24
-
25
- public set phi(value: number) {
26
- this._phi = value;
27
- }
28
-
29
-
30
- public get theta(): number {
31
- return this._theta;
32
- }
33
-
34
- public set theta(value: number) {
35
- this._theta = value;
36
- }
37
-
38
- public makeSafe() {
39
- const EPS = 0.000001;
40
- this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ));
41
- return this;
42
- }
43
-
44
- public fromVec3(p: vec3): ISpherical {
45
- this.radius = Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
46
-
47
- if (this.radius === 0) {
48
- this.theta = 0;
49
- this.phi = 0;
50
- } else {
51
- this.theta = Math.atan2(p[0], p[2]);
52
- this.phi = Math.acos(Math.max(-1, Math.min(1, p[1] / this.radius)));
53
- }
54
- return this;
55
- }
56
-
57
- public toVec3(): vec3 {
58
- const sinPhiRadius = Math.sin( this.phi ) * this.radius;
59
- return vec3.fromValues(sinPhiRadius * Math.sin( this.theta ), Math.cos( this.phi ) * this.radius, sinPhiRadius * Math.cos( this.theta ));
60
- }
61
- }
@@ -1,51 +0,0 @@
1
- import { mat4, vec3 } from 'gl-matrix'
2
- import { ITriangle } from '../interfaces/ITriangle';
3
-
4
-
5
- export class Triangle implements ITriangle {
6
- constructor(
7
- private _v0: vec3 = vec3.create(),
8
- private _v1: vec3 = vec3.create(),
9
- private _v2: vec3 = vec3.create(),
10
- ) { }
11
-
12
- applyMatrix(matrix: mat4): ITriangle {
13
- vec3.transformMat4(this._v0, this._v0, matrix);
14
- vec3.transformMat4(this._v1, this._v1, matrix);
15
- vec3.transformMat4(this._v2, this._v2, matrix);
16
- return this;
17
- }
18
-
19
- clone(): ITriangle {
20
- return new Triangle(vec3.clone(this._v0), vec3.clone(this._v1), vec3.clone(this._v2));
21
- }
22
-
23
- // Möller–Trumbore intersection algorithm
24
- intersect(origin: vec3, direction: vec3): vec3 | null {
25
- const EPSILON = 0.0000001;
26
- const edge1 = vec3.sub(vec3.create(), this._v1, this._v0);
27
- const edge2 = vec3.sub(vec3.create(), this._v2, this._v0);
28
- const h = vec3.cross(vec3.create(), direction, edge2)
29
- const a = vec3.dot(edge1, h);
30
- if (a > -EPSILON && a < EPSILON)
31
- return null; // This ray is parallel to this triangle.
32
- const f = 1.0 / a;
33
- const s = vec3.sub(vec3.create(), origin, this._v0);
34
- const u = f * vec3.dot(s, h);
35
- if (u < 0.0 || u > 1.0)
36
- return null;
37
- const q = vec3.cross(vec3.create(), s, edge1);
38
- const v = f * vec3.dot(direction, q);
39
- if (v < 0.0 || u + v > 1.0)
40
- return null;
41
- // At this stage we can compute t to find out where the intersection point is on the line.
42
- const t = f * vec3.dot(edge2, q);
43
- return t > EPSILON ? vec3.add(vec3.create(), vec3.multiply(vec3.create(), direction, vec3.fromValues(t, t, t)), origin):null;
44
- }
45
-
46
- reset() {
47
- this._v0 = vec3.create();
48
- this._v1 = vec3.create();
49
- this._v2 = vec3.create();
50
- }
51
- }
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { Box } from './implementation/Box'
2
- import { Plane } from './implementation/Plane'
3
- import { Sphere } from './implementation/Sphere'
4
- import { Spherical } from './implementation/Spherical'
5
- import { Triangle } from './implementation/Triangle'
6
- import { IBox } from './interfaces/IBox'
7
- import { IGeometry } from './interfaces/IGeometry'
8
- import { IPlane } from './interfaces/IPlane'
9
- import { ISphere } from './interfaces/ISphere'
10
- import { ISpherical } from './interfaces/ISpherical'
11
- import { ITriangle } from './interfaces/ITriangle'
12
-
13
- export {
14
- IBox, ISphere, ISpherical, IPlane, ITriangle, IGeometry,
15
- Box, Sphere, Spherical, Plane, Triangle
16
- }
@@ -1,27 +0,0 @@
1
- import { mat4, vec3 } from "gl-matrix";
2
- import { IGeometry } from "./IGeometry";
3
- import { ISphere } from "./ISphere";
4
-
5
- export interface IBox extends IGeometry {
6
- // #region Properties (3)
7
-
8
- boundingSphere: ISphere;
9
- max: vec3;
10
- min: vec3;
11
-
12
- // #endregion Properties (3)
13
-
14
- // #region Public Methods (7)
15
-
16
- applyMatrix(matrix: mat4): IBox;
17
- clampPoint(point: vec3): vec3;
18
- clone(): IBox;
19
- containsPoint(point: vec3): boolean;
20
- intersect(origin: vec3, direction: vec3): number | null;
21
- intersects(origin: vec3, direction: vec3): boolean;
22
- isEmpty(): boolean;
23
- setFromAttributeArray(array: Int8Array | Uint8Array | Int16Array | Uint16Array | Uint32Array | Float32Array, stride?: number, bytes?: number, matrix?: mat4): IBox;
24
- union(box: IBox): IBox;
25
-
26
- // #endregion Public Methods (7)
27
- }
@@ -1,7 +0,0 @@
1
- import { mat4, vec3 } from 'gl-matrix'
2
-
3
- export interface IGeometry {
4
- applyMatrix(matrix: mat4): IGeometry;
5
- clone(): IGeometry;
6
- reset(): void;
7
- }
@@ -1,23 +0,0 @@
1
- import { mat4, vec3 } from "gl-matrix";
2
- import { IGeometry } from "./IGeometry";
3
-
4
- export interface IPlane extends IGeometry {
5
- // #region Properties (2)
6
-
7
- constant: number;
8
- normal: vec3;
9
-
10
- // #endregion Properties (2)
11
-
12
- // #region Public Methods (6)
13
-
14
- applyMatrix(matrix: mat4): IPlane;
15
- clampPoint(point: vec3): vec3;
16
- clone(): IPlane;
17
- containsPoint(point: vec3): boolean;
18
- distanceToPoint(point: vec3): number;
19
- intersect(origin: vec3, direction: vec3): number | null;
20
- setFromNormalAndCoplanarPoint(normal: vec3, point: vec3): IPlane;
21
-
22
- // #endregion Public Methods (6)
23
- }
@@ -1,24 +0,0 @@
1
- import { mat4, vec3 } from "gl-matrix";
2
- import { IBox } from "./IBox";
3
- import { IGeometry } from "./IGeometry";
4
-
5
- export interface ISphere extends IGeometry {
6
- // #region Properties (2)
7
-
8
- center: vec3;
9
- radius: number;
10
-
11
- // #endregion Properties (2)
12
-
13
- // #region Public Methods (4)
14
-
15
- applyMatrix(matrix: mat4): ISphere;
16
- clampPoint(point: vec3): vec3;
17
- clone(): ISphere;
18
- intersect(origin: vec3, direction: vec3): number | null;
19
- intersects(origin: vec3, direction: vec3): boolean;
20
- containsPoint(point: vec3): boolean;
21
- setFromBox(box: IBox): ISphere;
22
-
23
- // #endregion Public Methods (4)
24
- }
@@ -1,19 +0,0 @@
1
- import { vec3 } from "gl-matrix";
2
-
3
- export interface ISpherical {
4
- // #region Properties (3)
5
-
6
- phi: number;
7
- radius: number;
8
- theta: number;
9
-
10
- // #endregion Properties (3)
11
-
12
- // #region Public Methods (3)
13
-
14
- fromVec3(p: vec3): ISpherical;
15
- makeSafe(): ISpherical;
16
- toVec3(): vec3;
17
-
18
- // #endregion Public Methods (3)
19
- }
@@ -1,12 +0,0 @@
1
- import { mat4, vec3 } from "gl-matrix";
2
- import { IGeometry } from "./IGeometry";
3
-
4
- export interface ITriangle extends IGeometry {
5
- // #region Public Methods (2)
6
-
7
- applyMatrix(matrix: mat4): IGeometry;
8
- clone(): ITriangle;
9
- intersect(origin: vec3, direction: vec3): vec3 | null;
10
-
11
- // #endregion Public Methods (2)
12
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": [
4
- "./**/*.ts"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "src",
8
- "outDir": "dist"
9
- },
10
- "exclude": [
11
- "__tests__",
12
- "node_modules",
13
- "dist",
14
- "dist-dev",
15
- "dist-prod"
16
- ]
17
- }