build/module/lib/geometries/arc3.js
/**
 * Computes a list of points corresponding to an arc centered on the origin.
 * begin {VectorE3} The begin position.
 * angle: {number} The angle of the rotation.
 * generator {SpinorE3} The generator of the rotation.
 * segments {number} The number of segments.
 * @hidden
 */
Computes a list of points corresponding to an arc centered on the origin.
begin {VectorE3} The begin position.
angle: {number} The angle of the rotation.
generator {SpinorE3} The generator of the rotation.
segments {number} The number of segments.
@hidden
Computes a list of points corresponding to an arc centered on the origin . begin { VectorE3 } The begin position . angle : { number } The angle of the rotation . generator { SpinorE3 } The generator of the rotation . segments { number } The number of segments . @hidden
function arc3(begin, angle, generator, segments) {
    mustBeDefined('begin', begin);
    mustBeNumber('angle', angle);
    mustBeDefined('generator', generator);
    mustBeInteger('segments', segments);
    if (isNaN(begin.x) || isNaN(begin.y) || isNaN(begin.z)) {
        throw new Error("arc3(begin=" + begin.toString() + ")");
    }
    var points = [];
    var point = Vector3.copy(begin);
    var rotor = Spinor3.copy(generator).scale((-angle / 2) / segments).exp();
    points.push(point.clone());
    for (var i = 0; i < segments; i++) {
        point.rotate(rotor);
        points.push(point.clone());
    }
    return points;
}
function arc3 ( begin , angle , generator , segments ) { mustBeDefined ( 'begin' , begin ) ; mustBeNumber ( 'angle' , angle ) ; mustBeDefined ( 'generator' , generator ) ; mustBeInteger ( 'segments' , segments ) ; if ( isNaN ( begin . x ) || isNaN ( begin . y ) || isNaN ( begin . z ) ) { throw new Error ( "arc3(begin=" + begin . toString ( ) + ")" ) ; } var points = [ ] ; var point = Vector3 . copy ( begin ) ; var rotor = Spinor3 . copy ( generator ) . scale ( ( - angle / 2 ) / segments ) . exp ( ) ; points . push ( point . clone ( ) ) ; for ( var i = 0 ; i < segments ; i ++ ) { point . rotate ( rotor ) ; points . push ( point . clone ( ) ) ; } return points ; }
Computes a list of points corresponding to an arc centered on the origin.
Computes a list of points corresponding to an arc centered on the origin .
/**
     * The return value is an array of points with length => segments + 1.
     */ /**
     * Temporary point that we will advance for each segment.
     */ /**
     * The rotor that advances us through one segment.
     */