makeCircularSector method
dynamic
makeCircularSector(
- dynamic center,
- dynamic p1,
- dynamic p2,
- dynamic u,
- dynamic v,
Implementation
makeCircularSector(center, p1, p2, u, v) {
// param p1, p2: Points in the circle arc.
// p1 and p2 are in clockwise direction.
tempV2_1.copy(p1).sub(center).normalize();
tempV2_2.copy(p2).sub(center).normalize();
var angle = Math.PI;
var dot = tempV2_1.dot(tempV2_2);
if (Math.abs(dot) < 1) angle = Math.abs(Math.acos(dot)).toDouble();
angle /= arcDivisions;
tempV2_3.copy(p1);
for (var i = 0, il = arcDivisions - 1; i < il; i++) {
tempV2_4.copy(tempV2_3).rotateAround(center, angle);
addVertex(tempV2_3, u, v);
addVertex(tempV2_4, u, v);
addVertex(center, u, 0.5);
tempV2_3.copy(tempV2_4);
}
addVertex(tempV2_4, u, v);
addVertex(p2, u, v);
addVertex(center, u, 0.5);
}