ArcCurve 圆弧曲线

—> EllipseCurve —> Curve

绘制2D的圆弧曲线, 当 aEndAngle - aStartAngle = 2 * Math.PI 时, 便是一个完整的圆.

function ArcCurve( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) { } var arcCurve = new THREE.ArcCurve(0, 0, 4, 0, Math.PI * 2, false), points = arcCurve.getPoints(60); var geometry = new THREE.Geometry().setFromPoints(points), material = new THREE.LineBasicMaterial({ color: '#00ff99'}), line = new THREE.Line(geometry, material); scene.add(line);

Attributes

type : String

Default value : 'ArcCurve'
Description : 类型

aX : Float

Default value : 0
Description : 中心点x坐标.

aY : Float

Default value : 0
Description : 中心点y坐标.

aRadius : Float

Default value : 1
Description : 半径.

aStartAngle : Float

Default value : 0
Description : 开始角度.

aEndAngle : Float

Default value : 2 * Math.PI
Description : 结束角度.

aClockwise : Boolean

Default value : false
Description : 顺时针.

aRotation : Float

Default value : 0
Description : 从x轴开始旋转了的角度.

isArcCurve : Boolean

Default value : true
Description : 类型是否为ArcCurve

图解API

ArcCurve 是椭圆 EllipseCurve 的子类, 构造函数少了aRotation. 上两个圆弧的起始角和结束角度都一样, 差别在于aClockwise. 左边的圆从逆时针画, 右边的圆从顺时针画. 点开查看

drawArc(0, Math.PI * 3/2, false, -6); drawArc(0, Math.PI * 3/2, true, 6); function drawArc(aStartAngle, aEndAngle, aClockwise, x){ var arcCurve = new THREE.ArcCurve(0, 0, 4, aStartAngle, aEndAngle, aClockwise), points = arcCurve.getPoints(60); var geometry = new THREE.Geometry().setFromPoints(points), material = new THREE.LineBasicMaterial({ color: '#00ff99'}), line = new THREE.Line(geometry, material); scene.add(line); line.position.x = x; }