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
+ } ;
1
24
/**
2
25
* A superclass for Node and Primitive in the blobtree.
3
26
* @class
@@ -9,26 +32,26 @@ export declare class Element {
9
32
* @param {ElementJSON } _json
10
33
*/
11
34
static fromJSON ( _json : any ) : void ;
35
+ id : number ;
36
+ aabb : Box3 ;
37
+ valid_aabb : boolean ;
38
+ parentNode : Node | null ;
12
39
constructor ( ) ;
13
40
/**
14
41
* Return a Javscript Object respecting JSON convention.
15
42
* All classes must defined it.
16
- * @return {ElementJSON }
17
43
*/
18
- toJSON ( ) : {
19
- type : string ;
20
- } ;
44
+ toJSON ( ) : ElementJSON ;
21
45
/**
22
46
* Clone the object.
23
- * @return {Element }
24
47
*/
25
- clone ( ) : any ;
48
+ clone ( ) : Element ;
26
49
/**
27
- * @return { Node } The parent node of this primitive.
50
+ * @return The parent node of this primitive.
28
51
*/
29
- getParentNode ( ) : any ;
52
+ getParentNode ( ) : Node | null ;
30
53
/**
31
- * @return { string } Type of the element
54
+ * @return Type of the element
32
55
*/
33
56
getType ( ) : string ;
34
57
/**
@@ -49,12 +72,12 @@ export declare class Element {
49
72
* isValidAABB before to ensure the current AABB does correspond to the primitive
50
73
* settings.
51
74
*/
52
- getAABB ( ) : any ;
75
+ getAABB ( ) : Box3 ;
53
76
/**
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
55
78
* correspond to the internal primitive parameters.
56
79
*/
57
- isValidAABB ( ) : any ;
80
+ isValidAABB ( ) : boolean ;
58
81
/**
59
82
* Invalid the bounding boxes recursively up to the root
60
83
*/
@@ -79,29 +102,33 @@ export declare class Element {
79
102
* @param {Vector3 } _p Point where we want to evaluate the primitive field
80
103
* @param {ValueResultType } _res
81
104
*/
82
- value ( _p : any , _res : any ) : void ;
105
+ value ( _p : Vector3 , _res : ValueResultType ) : void ;
83
106
/**
84
107
* @param {Vector3 } p The point where we want the numerical gradient
85
108
* @param {Vector3 } res The resulting gradient
86
109
* @param {number } epsilon The step value for the numerical evaluation
87
110
*/
88
- numericalGradient : ( p : any , res : any , epsilon : any ) => void ;
111
+ numericalGradient : ( this : Element , p : Vector3 , res : Vector3 , epsilon : number ) => void ;
89
112
/**
90
113
* @abstract
91
114
* Get the Area object.
92
115
* Area objects do provide methods useful when rasterizing, raytracing or polygonizing
93
116
* the area (intersections with other areas, minimum level of detail needed to
94
117
* 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
96
119
*/
97
- getAreas ( ) : never [ ] ;
120
+ getAreas ( ) : {
121
+ aabb : Box3 ;
122
+ bv : Area ;
123
+ obj : Primitive ;
124
+ } [ ] ;
98
125
/**
99
126
* @abstract
100
127
* 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
103
130
*/
104
- distanceTo ( _p : any ) : void ;
131
+ distanceTo ( _p : Vector3 ) : number ;
105
132
/**
106
133
* @abstract
107
134
* This function is called when a point is within the potential influence of a primitive/node.
@@ -114,17 +141,17 @@ export declare class Element {
114
141
* Default behaviour is doing nothing, leaves cannot be sub-trimmed, only nodes.
115
142
* Note : only the root can untrim
116
143
*
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.
120
147
*/
121
- trim ( _aabb : any , _trimmed : any , _parents : any ) : void ;
148
+ trim ( _aabb : Box3 , _trimmed : Element [ ] , _parents : Node [ ] ) : void ;
122
149
/**
123
150
* 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
126
153
*/
127
- count ( _cls : any ) : number ;
154
+ count ( _cls : Function ) : number ;
128
155
destroy ( ) : void ;
129
156
}
130
157
//# sourceMappingURL=Element.d.ts.map
0 commit comments