Skip to content

Commit cbe555e

Browse files
authored
LatheGeometry: Make all parameters optional. (mrdoob#22499)
1 parent 0579cde commit cbe555e

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

docs/api/en/geometries/LatheGeometry.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2>Constructor</h2>
4848

4949
<h3>[name]([param:Array points], [param:Integer segments], [param:Float phiStart], [param:Float phiLength])</h3>
5050
<p>
51-
points — Array of Vector2s. The x-coordinate of each point must be greater than zero.<br />
51+
points — Array of Vector2s. The x-coordinate of each point must be greater than zero. Default is an array with (0,0.5), (0.5,0) and (0,-0.5) which creates a simple diamond shape.<br />
5252
segments — the number of circumference segments to generate. Default is 12.<br />
5353
phiStart — the starting angle in radians. Default is 0.<br />
5454
phiLength — the radian (0 to 2PI) range of the lathed section 2PI is a closed lathe, less than 2PI is a portion. Default is 2PI.

docs/api/zh/geometries/LatheGeometry.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2>构造器</h2>
4848

4949
<h3>[name]([param:Array points], [param:Integer segments], [param:Float phiStart], [param:Float phiLength])</h3>
5050
<p>
51-
points — 一个Vector2对象数组。每个点的X坐标必须大于0。<br />
51+
points — 一个Vector2对象数组。每个点的X坐标必须大于0。 Default is an array with (0,0.5), (0.5,0) and (0,-0.5) which creates a simple diamond shape.<br />
5252
segments — 要生成的车削几何体圆周分段的数量,默认值是12。<br />
5353
phiStart — 以弧度表示的起始角度,默认值为0。<br />
5454
phiLength — 车削部分的弧度(0-2PI)范围,2PI将是一个完全闭合的、完整的车削几何体,小于2PI是部分的车削。默认值是2PI。

editor/js/Menubar.Add.js

+1-15
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,7 @@ function MenubarAdd( editor ) {
126126
option.setTextContent( strings.getKey( 'menubar/add/lathe' ) );
127127
option.onClick( function () {
128128

129-
var points = [
130-
new THREE.Vector2( 0, 0 ),
131-
new THREE.Vector2( 0.4, 0 ),
132-
new THREE.Vector2( 0.35, 0.05 ),
133-
new THREE.Vector2( 0.1, 0.075 ),
134-
new THREE.Vector2( 0.08, 0.1 ),
135-
new THREE.Vector2( 0.08, 0.4 ),
136-
new THREE.Vector2( 0.1, 0.42 ),
137-
new THREE.Vector2( 0.14, 0.48 ),
138-
new THREE.Vector2( 0.2, 0.5 ),
139-
new THREE.Vector2( 0.25, 0.54 ),
140-
new THREE.Vector2( 0.3, 1.2 )
141-
];
142-
143-
var geometry = new THREE.LatheGeometry( points, 12, 0, Math.PI * 2 );
129+
var geometry = new THREE.LatheGeometry();
144130
var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
145131
mesh.name = 'Lathe';
146132

src/geometries/LatheGeometry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as MathUtils from '../math/MathUtils.js';
66

77
class LatheGeometry extends BufferGeometry {
88

9-
constructor( points, segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {
9+
constructor( points = [ new Vector2( 0, 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, - 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {
1010

1111
super();
1212

0 commit comments

Comments
 (0)