Doodle3D-Slicer/three.js-master/editor_slicer/js/Sidebar.Geometry.IcosahedronGeometry.js
2015-06-12 21:19:56 +02:00

52 lines
966 B
JavaScript
Executable File

/**
* @author mrdoob / http://mrdoob.com/
*/
Sidebar.Geometry.IcosahedronGeometry = 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 );
// detail
var detailRow = new UI.Panel();
var detail = new UI.Integer( parameters.detail ).setRange( 0, Infinity ).onChange( update );
detailRow.add( new UI.Text( 'Detail' ).setWidth( '90px' ) );
detailRow.add( detail );
container.add( detailRow );
//
function update() {
object.geometry.dispose();
object.geometry = new THREE.IcosahedronGeometry(
radius.getValue(),
detail.getValue()
);
object.geometry.computeBoundingSphere();
signals.objectChanged.dispatch( object );
}
return container;
}