1+ import { Box3 , Vector3 } from "three" ;
2+ import type { Node } from "./Node" ;
3+ import type { Area } from "./areas" ;
4+ import type { Primitive } from "./Primitive" ;
5+ import type { Material } from "./Material" ;
6+ /**
7+ * Computed values will be stored here. Each values should exist and be allocated already.
8+ * @property {number } v Value, must be defined
9+ * @property {Material= } m Material, must be allocated and defined if wanted
10+ * @property {Vector3= } g Gradient, must be allocated and defined if wanted
11+ * @property {number= } step ??? Not sure, probably a "safe" step for raymarching
12+ * @property {number= } stepOrtho ??? Same as step but in orthogonal direction ?
13+ */
14+ export type ValueResultType = {
15+ v : number ;
16+ m : Material ;
17+ g : Vector3 ;
18+ step : number ;
19+ stepOrtho : number ;
20+ } ;
21+ export type ElementJSON = {
22+ type : string ;
23+ } ;
124/**
225 * A superclass for Node and Primitive in the blobtree.
326 * @class
@@ -9,26 +32,26 @@ export declare class Element {
932 * @param {ElementJSON } _json
1033 */
1134 static fromJSON ( _json : any ) : void ;
35+ id : number ;
36+ aabb : Box3 ;
37+ valid_aabb : boolean ;
38+ parentNode : Node | null ;
1239 constructor ( ) ;
1340 /**
1441 * Return a Javscript Object respecting JSON convention.
1542 * All classes must defined it.
16- * @return {ElementJSON }
1743 */
18- toJSON ( ) : {
19- type : string ;
20- } ;
44+ toJSON ( ) : ElementJSON ;
2145 /**
2246 * Clone the object.
23- * @return {Element }
2447 */
25- clone ( ) : any ;
48+ clone ( ) : Element ;
2649 /**
27- * @return { Node } The parent node of this primitive.
50+ * @return The parent node of this primitive.
2851 */
29- getParentNode ( ) : any ;
52+ getParentNode ( ) : Node | null ;
3053 /**
31- * @return { string } Type of the element
54+ * @return Type of the element
3255 */
3356 getType ( ) : string ;
3457 /**
@@ -49,12 +72,12 @@ export declare class Element {
4972 * isValidAABB before to ensure the current AABB does correspond to the primitive
5073 * settings.
5174 */
52- getAABB ( ) : any ;
75+ getAABB ( ) : Box3 ;
5376 /**
54- * @return { boolean } True if the current aabb is valid, ie it does
77+ * @return True if the current aabb is valid, ie it does
5578 * correspond to the internal primitive parameters.
5679 */
57- isValidAABB ( ) : any ;
80+ isValidAABB ( ) : boolean ;
5881 /**
5982 * Invalid the bounding boxes recursively up to the root
6083 */
@@ -79,29 +102,33 @@ export declare class Element {
79102 * @param {Vector3 } _p Point where we want to evaluate the primitive field
80103 * @param {ValueResultType } _res
81104 */
82- value ( _p : any , _res : any ) : void ;
105+ value ( _p : Vector3 , _res : ValueResultType ) : void ;
83106 /**
84107 * @param {Vector3 } p The point where we want the numerical gradient
85108 * @param {Vector3 } res The resulting gradient
86109 * @param {number } epsilon The step value for the numerical evaluation
87110 */
88- numericalGradient : ( p : any , res : any , epsilon : any ) => void ;
111+ numericalGradient : ( this : Element , p : Vector3 , res : Vector3 , epsilon : number ) => void ;
89112 /**
90113 * @abstract
91114 * Get the Area object.
92115 * Area objects do provide methods useful when rasterizing, raytracing or polygonizing
93116 * the area (intersections with other areas, minimum level of detail needed to
94117 * capture the feature nicely, etc etc...).
95- * @returns { Array.<{aabb: Box3, bv:Area, obj:Primitive}> } The Areas object corresponding to the node/primitive, in an array
118+ * @returns The Areas object corresponding to the node/primitive, in an array
96119 */
97- getAreas ( ) : never [ ] ;
120+ getAreas ( ) : {
121+ aabb : Box3 ;
122+ bv : Area ;
123+ obj : Primitive ;
124+ } [ ] ;
98125 /**
99126 * @abstract
100127 * This function is called when a point is outside of the potential influence of a primitive/node.
101- * @param { Vector3 } _p
102- * @return { number } The next step length to do with respect to this primitive/node
128+ * @param _p
129+ * @return The next step length to do with respect to this primitive/node
103130 */
104- distanceTo ( _p : any ) : void ;
131+ distanceTo ( _p : Vector3 ) : number ;
105132 /**
106133 * @abstract
107134 * This function is called when a point is within the potential influence of a primitive/node.
@@ -114,17 +141,17 @@ export declare class Element {
114141 * Default behaviour is doing nothing, leaves cannot be sub-trimmed, only nodes.
115142 * Note : only the root can untrim
116143 *
117- * @param { Box3 } _aabb
118- * @param { Array.<Element> } _trimmed Array of trimmed Elements
119- * @param { Array.<Node> } _parents Array of fathers from which each trimmed element has been removed.
144+ * @param _aabb
145+ * @param _trimmed Array of trimmed Elements
146+ * @param _parents Array of fathers from which each trimmed element has been removed.
120147 */
121- trim ( _aabb : any , _trimmed : any , _parents : any ) : void ;
148+ trim ( _aabb : Box3 , _trimmed : Element [ ] , _parents : Node [ ] ) : void ;
122149 /**
123150 * count the number of elements of class cls in this node and subnodes
124- * @param { Function } _cls the class of the elements we want to count
125- * @return { number } The number of element of class cls
151+ * @param _cls the class of the elements we want to count
152+ * @return The number of element of class cls
126153 */
127- count ( _cls : any ) : number ;
154+ count ( _cls : Function ) : number ;
128155 destroy ( ) : void ;
129156}
130157//# sourceMappingURL=Element.d.ts.map
0 commit comments