-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyPatch.js
50 lines (42 loc) · 1.17 KB
/
MyPatch.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
class MyPatch extends CGFobject
{
/**
* Builds a plane object
*
* @param {CGFscene} scene main scene
* @param {Number} npointsU number of divisions in U
* @param {Number} npointsV number of divisions in V
* @param {Number} npartsU number of divisions in U
* @param {Number} npartsV number of divisions in V
* @param {Number} controlPoints number of divisions in V
*
*/
constructor(scene, npointsU, npointsV, npartsU, npartsV, controlPoints)
{
super(scene);
this.scene=scene;
this.npartsU=npartsU;
this.npartsV=npartsV;
this.matrix=[];
for(var i=0;i<npointsU;i++)
{
var mat=[];
for(var j=0;j<npointsV;j++)
{
controlPoints[j+i*npointsV].push(1);
mat.push(controlPoints[j+i*npointsV]);
}
this.matrix.push(mat);
}
this.surface = new CGFnurbsSurface(
npointsU-1,
npointsV-1,
this.matrix
);
this.object = new CGFnurbsObject(this.scene, this.npartsU, this.npartsV, this.surface);
}
display()
{
this.object.display();
}
}