@xort/cga 0.1.1 → 0.1.3
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/THIRD_PARTY_NOTICES.md +24 -45
- package/build/@xort_cga.js +2077 -9118
- package/build/cga.d.ts +109 -42
- package/build/cga.esm.js +2077 -9119
- package/dist/THIRD_PARTY_NOTICES.md +24 -45
- package/dist/index.cjs +2077 -9118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -42
- package/dist/index.d.ts +109 -42
- package/dist/index.js +2077 -9119
- package/dist/index.js.map +1 -1
- package/dist/three.cjs +211 -1963
- package/dist/three.cjs.map +1 -1
- package/dist/three.d.cts +77 -9
- package/dist/three.d.ts +77 -9
- package/dist/three.js +211 -1963
- package/dist/three.js.map +1 -1
- package/package.json +122 -118
- package/readme.md +189 -61
package/dist/three.d.cts
CHANGED
|
@@ -4,7 +4,6 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
|
4
4
|
import { TransformControls } from 'three/addons/controls/TransformControls.js';
|
|
5
5
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
6
6
|
import { Pass } from 'three/addons/postprocessing/Pass.js';
|
|
7
|
-
import Decimal from 'decimal.js';
|
|
8
7
|
|
|
9
8
|
type EventListener<T = unknown> = (data: T) => void;
|
|
10
9
|
declare class EventHandler<Events extends object = Record<string, unknown>> {
|
|
@@ -117,6 +116,9 @@ declare const DiamondShader: {
|
|
|
117
116
|
vertexShader: string;
|
|
118
117
|
fragmentShader: string;
|
|
119
118
|
uniforms: {
|
|
119
|
+
invModelMatrix: {
|
|
120
|
+
value: three.Matrix4;
|
|
121
|
+
};
|
|
120
122
|
tCubeMapNormals: {
|
|
121
123
|
type: string;
|
|
122
124
|
value: null;
|
|
@@ -201,6 +203,72 @@ declare const DiamondShader: {
|
|
|
201
203
|
side: 2;
|
|
202
204
|
};
|
|
203
205
|
|
|
206
|
+
/** Decimal arithmetic owned by cga.js: signed BigInt coefficient × 10^exponent. */
|
|
207
|
+
type DecimalValue = Decimal | string | number | bigint | {
|
|
208
|
+
toString(): string;
|
|
209
|
+
};
|
|
210
|
+
interface DecimalConfig {
|
|
211
|
+
precision?: number;
|
|
212
|
+
/** 0 up, 1 down, 2 ceil, 3 floor, 4 half-up, 5 half-down,
|
|
213
|
+
* 6 half-even, 7 half-ceil, 8 half-floor. */
|
|
214
|
+
rounding?: number;
|
|
215
|
+
}
|
|
216
|
+
/** Finite decimal subset used by HVec3, Robust and CSG.
|
|
217
|
+
* Constructors preserve input digits; arithmetic rounds to configured significant digits.
|
|
218
|
+
* Instances are immutable. Unsupported/non-finite inputs and division by zero throw.
|
|
219
|
+
*/
|
|
220
|
+
declare class Decimal {
|
|
221
|
+
static precision: number;
|
|
222
|
+
static rounding: number;
|
|
223
|
+
static readonly ROUND_UP = 0;
|
|
224
|
+
static readonly ROUND_DOWN = 1;
|
|
225
|
+
static readonly ROUND_CEIL = 2;
|
|
226
|
+
static readonly ROUND_FLOOR = 3;
|
|
227
|
+
static readonly ROUND_HALF_UP = 4;
|
|
228
|
+
static readonly ROUND_HALF_DOWN = 5;
|
|
229
|
+
static readonly ROUND_HALF_EVEN = 6;
|
|
230
|
+
static readonly ROUND_HALF_CEIL = 7;
|
|
231
|
+
static readonly ROUND_HALF_FLOOR = 8;
|
|
232
|
+
private coefficient;
|
|
233
|
+
private exponent;
|
|
234
|
+
constructor(value?: DecimalValue);
|
|
235
|
+
static set(config: DecimalConfig): typeof Decimal;
|
|
236
|
+
static config(config: DecimalConfig): typeof Decimal;
|
|
237
|
+
static isDecimal(value: unknown): value is Decimal;
|
|
238
|
+
private normalize;
|
|
239
|
+
private static make;
|
|
240
|
+
add(value: DecimalValue): Decimal;
|
|
241
|
+
plus(value: DecimalValue): Decimal;
|
|
242
|
+
sub(value: DecimalValue): Decimal;
|
|
243
|
+
minus(value: DecimalValue): Decimal;
|
|
244
|
+
mul(value: DecimalValue): Decimal;
|
|
245
|
+
times(value: DecimalValue): Decimal;
|
|
246
|
+
div(value: DecimalValue): Decimal;
|
|
247
|
+
dividedBy(value: DecimalValue): Decimal;
|
|
248
|
+
sqrt(): Decimal;
|
|
249
|
+
negated(): Decimal;
|
|
250
|
+
neg(): Decimal;
|
|
251
|
+
abs(): Decimal;
|
|
252
|
+
comparedTo(value: DecimalValue): number;
|
|
253
|
+
cmp(value: DecimalValue): number;
|
|
254
|
+
eq(value: DecimalValue): boolean;
|
|
255
|
+
equals(value: DecimalValue): boolean;
|
|
256
|
+
lt(value: DecimalValue): boolean;
|
|
257
|
+
lte(value: DecimalValue): boolean;
|
|
258
|
+
gt(value: DecimalValue): boolean;
|
|
259
|
+
gte(value: DecimalValue): boolean;
|
|
260
|
+
isZero(): boolean;
|
|
261
|
+
isNegative(): boolean;
|
|
262
|
+
isPositive(): boolean;
|
|
263
|
+
isFinite(): boolean;
|
|
264
|
+
isNaN(): boolean;
|
|
265
|
+
toNumber(): number;
|
|
266
|
+
toString(): string;
|
|
267
|
+
toFixed(decimalPlaces?: number, rounding?: number): string;
|
|
268
|
+
toJSON(): string;
|
|
269
|
+
valueOf(): string;
|
|
270
|
+
}
|
|
271
|
+
|
|
204
272
|
interface IHVec2 {
|
|
205
273
|
x: Decimal;
|
|
206
274
|
y: Decimal;
|
|
@@ -213,7 +281,7 @@ declare class HVec3 implements IHVec3 {
|
|
|
213
281
|
x: Decimal;
|
|
214
282
|
y: Decimal;
|
|
215
283
|
z: Decimal;
|
|
216
|
-
constructor(x?:
|
|
284
|
+
constructor(x?: DecimalValue, y?: DecimalValue, z?: DecimalValue);
|
|
217
285
|
static isVec3(v: unknown): v is IHVec3;
|
|
218
286
|
get isVec3(): boolean;
|
|
219
287
|
static get Up(): HVec3;
|
|
@@ -221,9 +289,9 @@ declare class HVec3 implements IHVec3 {
|
|
|
221
289
|
static get UnitX(): HVec3;
|
|
222
290
|
static get UnitY(): HVec3;
|
|
223
291
|
static get UnitZ(): HVec3;
|
|
224
|
-
set(x:
|
|
225
|
-
setScalar(s:
|
|
226
|
-
setComponent(index: number, value:
|
|
292
|
+
set(x: DecimalValue, y: DecimalValue, z: DecimalValue): this;
|
|
293
|
+
setScalar(s: DecimalValue): this;
|
|
294
|
+
setComponent(index: number, value: DecimalValue): this;
|
|
227
295
|
getComponent(index: number): Decimal;
|
|
228
296
|
copy(v: IHVec3): this;
|
|
229
297
|
clone(): HVec3;
|
|
@@ -231,15 +299,15 @@ declare class HVec3 implements IHVec3 {
|
|
|
231
299
|
addVecs(a: IHVec3, b: IHVec3): this;
|
|
232
300
|
sub(v: IHVec3, w?: IHVec3): this;
|
|
233
301
|
subVecs(a: IHVec3, b: IHVec3): this;
|
|
234
|
-
multiplyScalar(s:
|
|
235
|
-
divideScalar(s:
|
|
302
|
+
multiplyScalar(s: DecimalValue): this;
|
|
303
|
+
divideScalar(s: DecimalValue): this;
|
|
236
304
|
cross(v: IHVec3, w?: IHVec3): this;
|
|
237
305
|
crossVecs(a: IHVec3, b: IHVec3): this;
|
|
238
306
|
dot(v: IHVec3): Decimal;
|
|
239
307
|
lengthSq(): Decimal;
|
|
240
308
|
length(): Decimal;
|
|
241
309
|
normalize(): this;
|
|
242
|
-
lerp(v: IHVec3, alpha:
|
|
310
|
+
lerp(v: IHVec3, alpha: DecimalValue): this;
|
|
243
311
|
distanceTo(v: IHVec3): Decimal;
|
|
244
312
|
equals(v: IHVec3): boolean;
|
|
245
313
|
toArray(): Decimal[];
|
|
@@ -257,7 +325,7 @@ declare class Polygon {
|
|
|
257
325
|
normal: HVec3;
|
|
258
326
|
vertices: HVec3[];
|
|
259
327
|
readonly epsilon: Decimal;
|
|
260
|
-
constructor(vertices?: readonly HVec3[], epsilon?:
|
|
328
|
+
constructor(vertices?: readonly HVec3[], epsilon?: DecimalValue);
|
|
261
329
|
calcPlane(): this;
|
|
262
330
|
flip(): this;
|
|
263
331
|
classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
|
package/dist/three.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
|
4
4
|
import { TransformControls } from 'three/addons/controls/TransformControls.js';
|
|
5
5
|
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
6
6
|
import { Pass } from 'three/addons/postprocessing/Pass.js';
|
|
7
|
-
import Decimal from 'decimal.js';
|
|
8
7
|
|
|
9
8
|
type EventListener<T = unknown> = (data: T) => void;
|
|
10
9
|
declare class EventHandler<Events extends object = Record<string, unknown>> {
|
|
@@ -117,6 +116,9 @@ declare const DiamondShader: {
|
|
|
117
116
|
vertexShader: string;
|
|
118
117
|
fragmentShader: string;
|
|
119
118
|
uniforms: {
|
|
119
|
+
invModelMatrix: {
|
|
120
|
+
value: three.Matrix4;
|
|
121
|
+
};
|
|
120
122
|
tCubeMapNormals: {
|
|
121
123
|
type: string;
|
|
122
124
|
value: null;
|
|
@@ -201,6 +203,72 @@ declare const DiamondShader: {
|
|
|
201
203
|
side: 2;
|
|
202
204
|
};
|
|
203
205
|
|
|
206
|
+
/** Decimal arithmetic owned by cga.js: signed BigInt coefficient × 10^exponent. */
|
|
207
|
+
type DecimalValue = Decimal | string | number | bigint | {
|
|
208
|
+
toString(): string;
|
|
209
|
+
};
|
|
210
|
+
interface DecimalConfig {
|
|
211
|
+
precision?: number;
|
|
212
|
+
/** 0 up, 1 down, 2 ceil, 3 floor, 4 half-up, 5 half-down,
|
|
213
|
+
* 6 half-even, 7 half-ceil, 8 half-floor. */
|
|
214
|
+
rounding?: number;
|
|
215
|
+
}
|
|
216
|
+
/** Finite decimal subset used by HVec3, Robust and CSG.
|
|
217
|
+
* Constructors preserve input digits; arithmetic rounds to configured significant digits.
|
|
218
|
+
* Instances are immutable. Unsupported/non-finite inputs and division by zero throw.
|
|
219
|
+
*/
|
|
220
|
+
declare class Decimal {
|
|
221
|
+
static precision: number;
|
|
222
|
+
static rounding: number;
|
|
223
|
+
static readonly ROUND_UP = 0;
|
|
224
|
+
static readonly ROUND_DOWN = 1;
|
|
225
|
+
static readonly ROUND_CEIL = 2;
|
|
226
|
+
static readonly ROUND_FLOOR = 3;
|
|
227
|
+
static readonly ROUND_HALF_UP = 4;
|
|
228
|
+
static readonly ROUND_HALF_DOWN = 5;
|
|
229
|
+
static readonly ROUND_HALF_EVEN = 6;
|
|
230
|
+
static readonly ROUND_HALF_CEIL = 7;
|
|
231
|
+
static readonly ROUND_HALF_FLOOR = 8;
|
|
232
|
+
private coefficient;
|
|
233
|
+
private exponent;
|
|
234
|
+
constructor(value?: DecimalValue);
|
|
235
|
+
static set(config: DecimalConfig): typeof Decimal;
|
|
236
|
+
static config(config: DecimalConfig): typeof Decimal;
|
|
237
|
+
static isDecimal(value: unknown): value is Decimal;
|
|
238
|
+
private normalize;
|
|
239
|
+
private static make;
|
|
240
|
+
add(value: DecimalValue): Decimal;
|
|
241
|
+
plus(value: DecimalValue): Decimal;
|
|
242
|
+
sub(value: DecimalValue): Decimal;
|
|
243
|
+
minus(value: DecimalValue): Decimal;
|
|
244
|
+
mul(value: DecimalValue): Decimal;
|
|
245
|
+
times(value: DecimalValue): Decimal;
|
|
246
|
+
div(value: DecimalValue): Decimal;
|
|
247
|
+
dividedBy(value: DecimalValue): Decimal;
|
|
248
|
+
sqrt(): Decimal;
|
|
249
|
+
negated(): Decimal;
|
|
250
|
+
neg(): Decimal;
|
|
251
|
+
abs(): Decimal;
|
|
252
|
+
comparedTo(value: DecimalValue): number;
|
|
253
|
+
cmp(value: DecimalValue): number;
|
|
254
|
+
eq(value: DecimalValue): boolean;
|
|
255
|
+
equals(value: DecimalValue): boolean;
|
|
256
|
+
lt(value: DecimalValue): boolean;
|
|
257
|
+
lte(value: DecimalValue): boolean;
|
|
258
|
+
gt(value: DecimalValue): boolean;
|
|
259
|
+
gte(value: DecimalValue): boolean;
|
|
260
|
+
isZero(): boolean;
|
|
261
|
+
isNegative(): boolean;
|
|
262
|
+
isPositive(): boolean;
|
|
263
|
+
isFinite(): boolean;
|
|
264
|
+
isNaN(): boolean;
|
|
265
|
+
toNumber(): number;
|
|
266
|
+
toString(): string;
|
|
267
|
+
toFixed(decimalPlaces?: number, rounding?: number): string;
|
|
268
|
+
toJSON(): string;
|
|
269
|
+
valueOf(): string;
|
|
270
|
+
}
|
|
271
|
+
|
|
204
272
|
interface IHVec2 {
|
|
205
273
|
x: Decimal;
|
|
206
274
|
y: Decimal;
|
|
@@ -213,7 +281,7 @@ declare class HVec3 implements IHVec3 {
|
|
|
213
281
|
x: Decimal;
|
|
214
282
|
y: Decimal;
|
|
215
283
|
z: Decimal;
|
|
216
|
-
constructor(x?:
|
|
284
|
+
constructor(x?: DecimalValue, y?: DecimalValue, z?: DecimalValue);
|
|
217
285
|
static isVec3(v: unknown): v is IHVec3;
|
|
218
286
|
get isVec3(): boolean;
|
|
219
287
|
static get Up(): HVec3;
|
|
@@ -221,9 +289,9 @@ declare class HVec3 implements IHVec3 {
|
|
|
221
289
|
static get UnitX(): HVec3;
|
|
222
290
|
static get UnitY(): HVec3;
|
|
223
291
|
static get UnitZ(): HVec3;
|
|
224
|
-
set(x:
|
|
225
|
-
setScalar(s:
|
|
226
|
-
setComponent(index: number, value:
|
|
292
|
+
set(x: DecimalValue, y: DecimalValue, z: DecimalValue): this;
|
|
293
|
+
setScalar(s: DecimalValue): this;
|
|
294
|
+
setComponent(index: number, value: DecimalValue): this;
|
|
227
295
|
getComponent(index: number): Decimal;
|
|
228
296
|
copy(v: IHVec3): this;
|
|
229
297
|
clone(): HVec3;
|
|
@@ -231,15 +299,15 @@ declare class HVec3 implements IHVec3 {
|
|
|
231
299
|
addVecs(a: IHVec3, b: IHVec3): this;
|
|
232
300
|
sub(v: IHVec3, w?: IHVec3): this;
|
|
233
301
|
subVecs(a: IHVec3, b: IHVec3): this;
|
|
234
|
-
multiplyScalar(s:
|
|
235
|
-
divideScalar(s:
|
|
302
|
+
multiplyScalar(s: DecimalValue): this;
|
|
303
|
+
divideScalar(s: DecimalValue): this;
|
|
236
304
|
cross(v: IHVec3, w?: IHVec3): this;
|
|
237
305
|
crossVecs(a: IHVec3, b: IHVec3): this;
|
|
238
306
|
dot(v: IHVec3): Decimal;
|
|
239
307
|
lengthSq(): Decimal;
|
|
240
308
|
length(): Decimal;
|
|
241
309
|
normalize(): this;
|
|
242
|
-
lerp(v: IHVec3, alpha:
|
|
310
|
+
lerp(v: IHVec3, alpha: DecimalValue): this;
|
|
243
311
|
distanceTo(v: IHVec3): Decimal;
|
|
244
312
|
equals(v: IHVec3): boolean;
|
|
245
313
|
toArray(): Decimal[];
|
|
@@ -257,7 +325,7 @@ declare class Polygon {
|
|
|
257
325
|
normal: HVec3;
|
|
258
326
|
vertices: HVec3[];
|
|
259
327
|
readonly epsilon: Decimal;
|
|
260
|
-
constructor(vertices?: readonly HVec3[], epsilon?:
|
|
328
|
+
constructor(vertices?: readonly HVec3[], epsilon?: DecimalValue);
|
|
261
329
|
calcPlane(): this;
|
|
262
330
|
flip(): this;
|
|
263
331
|
classifyVertex(v: HVec3): Side.COPLANAR | Side.FRONT | Side.BACK;
|