-
Notifications
You must be signed in to change notification settings - Fork 14
/
CoordinateSystemGeometry.js
85 lines (63 loc) · 2.08 KB
/
CoordinateSystemGeometry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* @author Ikaros Kappler
* @date 2013-08-12
* @version 1.0.0
**/
THREE.CoordinateSystemGeometry = function( size ) {
// Call super 'constructor'
THREE.Geometry.call( this );
var points = [];
points.push( new THREE.Vector3(0,0,0) ); // origin
points.push( new THREE.Vector3(size,0,0) ); // x
points.push( new THREE.Vector3(0,size,0) ); // y
points.push( new THREE.Vector3(0,0,size) ); // z
/*
// Fetch the points from the shape
var shapePoints = shape.extractAllPoints();
shape = shapePoints.shape;
// Iterate through path elements in n steps
var vertexCount = 0;
for( var i = 0; i <= options.curveSegments; i++ ) {
var t = i / options.curveSegments;
var pathPoint = path.getPointAt( t );
// ...
if( !pathPoint )
window.alert( "pathPoint#" + i + " (t=" + t+ "): " + pathPoint );
for( var s in shape ) {
var shapePoint2 = shapePoints.shape[s];
var shapePoint3 = new THREE.Vector3( shapePoint2.x,
shapePoint2.y,
0 );
// Translate the point along the path
shapePoint3.add( new THREE.Vector3( pathPoint.x,
pathPoint.y,
pathPoint.z
)
); // addSelf instead of add?!
// Add path point?
// this.vertices.push( new THREE.Vertex(shapePoint3) );
// ... Vertex was replaced by Vector3 (Vertex is DEPRECATED!)
this.vertices.push( new THREE.Vector3( shapePoint3.x,
shapePoint3.y,
shapePoint3.z
)
);
// Connect previous shape/level with current?
if( i > 0 ) {
var soffset = (s==0) ? shape.length-1 : -1;
this.faces.push( new THREE.Face4( vertexCount + soffset,
vertexCount,
vertexCount-shape.length,
vertexCount-shape.length + soffset
) );
}
vertexCount++;
}
}
*/
this.computeCentroids();
this.computeFaceNormals();
// return new THREE.ExtrudeGeometry( shape, options );
};
THREE.ExtrudePathGeometry.prototype = new THREE.Geometry();
THREE.ExtrudePathGeometry.prototype.constructor = THREE.CoordinateSystemGeometry;