mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-24 12:03:48 +01:00
85 lines
1.8 KiB
JavaScript
Executable File
85 lines
1.8 KiB
JavaScript
Executable File
/**
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
|
|
Sidebar.Geometry.TorusGeometry = function ( signals, object ) {
|
|
|
|
var container = new UI.Panel();
|
|
|
|
var parameters = object.geometry.parameters;
|
|
|
|
// radius
|
|
|
|
var radiusRow = new UI.Panel();
|
|
var radius = new UI.Number( parameters.radius ).onChange( update );
|
|
|
|
radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
|
|
radiusRow.add( radius );
|
|
|
|
container.add( radiusRow );
|
|
|
|
// tube
|
|
|
|
var tubeRow = new UI.Panel();
|
|
var tube = new UI.Number( parameters.tube ).onChange( update );
|
|
|
|
tubeRow.add( new UI.Text( 'Tube' ).setWidth( '90px' ) );
|
|
tubeRow.add( tube );
|
|
|
|
container.add( tubeRow );
|
|
|
|
// radialSegments
|
|
|
|
var radialSegmentsRow = new UI.Panel();
|
|
var radialSegments = new UI.Integer( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
|
|
|
|
radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
|
|
radialSegmentsRow.add( radialSegments );
|
|
|
|
container.add( radialSegmentsRow );
|
|
|
|
// tubularSegments
|
|
|
|
var tubularSegmentsRow = new UI.Panel();
|
|
var tubularSegments = new UI.Integer( parameters.tubularSegments ).setRange( 1, Infinity ).onChange( update );
|
|
|
|
tubularSegmentsRow.add( new UI.Text( 'Tubular segments' ).setWidth( '90px' ) );
|
|
tubularSegmentsRow.add( tubularSegments );
|
|
|
|
container.add( tubularSegmentsRow );
|
|
|
|
// arc
|
|
|
|
var arcRow = new UI.Panel();
|
|
var arc = new UI.Number( parameters.arc ).onChange( update );
|
|
|
|
arcRow.add( new UI.Text( 'Arc' ).setWidth( '90px' ) );
|
|
arcRow.add( arc );
|
|
|
|
container.add( arcRow );
|
|
|
|
|
|
//
|
|
|
|
function update() {
|
|
|
|
object.geometry.dispose();
|
|
|
|
object.geometry = new THREE.TorusGeometry(
|
|
radius.getValue(),
|
|
tube.getValue(),
|
|
radialSegments.getValue(),
|
|
tubularSegments.getValue(),
|
|
arc.getValue()
|
|
);
|
|
|
|
object.geometry.computeBoundingSphere();
|
|
|
|
signals.geometryChanged.dispatch( object );
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
}
|