How to use the three.CylinderGeometry function in three

To help you get started, we’ve selected a few three examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CreativeCodingLab / Inviso / src / js / app / components / soundobject.js View on Github external
createCone(sound, color = null) {
    sound.volume.gain.value = 1;
    sound.spread = 0.5;

    const coneWidth = sound.spread * 90;
    const coneHeight = sound.volume.gain.value * 50 + 50;

    const coneGeo = new THREE.CylinderGeometry(coneWidth, 0, coneHeight, 100, 1, true);
    const randGreen = color !== null ? color : Math.random();
    const randBlue = color !== null ? color : Math.random();
    //const coneColor = new THREE.Color(0.5, randGreen, randBlue);
    const coneColor = new THREE.Color();
    coneColor.setHSL(randGreen, randBlue, 0.8);
    const coneMaterial = new THREE.MeshBasicMaterial({
      color: coneColor,
      opacity: 0.8,
      transparent:true
    });

    coneGeo.translate(0, coneHeight / 2, 0);
    coneGeo.rotateX(Math.PI / 2);
    coneMaterial.side = THREE.DoubleSide;

    const cone = new THREE.Mesh(coneGeo, coneMaterial);
github yDgunz / gunswap / src / ui / JugglingScene.ts View on Github external
private getArmCylinder(radius1 : number, radius2: number, length: number) : THREE.Mesh {		 
    	var cylinder = new THREE.CylinderGeometry( radius2, radius1, length, 20, 20 );
    	return new THREE.Mesh( cylinder, JugglerMeshMaterial );
	}
github cvdlab / react-planner / demo / src / catalog / holes / panic-door-double / planner-element.jsx View on Github external
function makeHandleBase() {

  let base = new Three.Object3D();
  let BaseGeometry1 = new Three.BoxGeometry(0.038, 0.14, 0.01);
  let BaseGeometry2 = new Three.CylinderGeometry(0.023, 0.023, 0.01, Math.round(32 ));
  let lock = makeLockKey();
  let base1 = new Three.Mesh(BaseGeometry1, black);
  let base2 = new Three.Mesh(BaseGeometry2, black);
  lock.rotation.x = Math.PI / 2;
  lock.position.y = -0.03;
  base2.rotation.x = Math.PI / 2;
  base2.position.y = -0.033;
  base2.scale.z = 1.5;
  base1.add(lock);
  base1.add(base2);
  base.add(base1);

  return base;
}
github salomonelli / nirania / old / js / way / Way.js View on Github external
constructor(length, speed, color) {
        this.length = length;
        this.speed = speed;
        this.group = new THREE.Object3D();
        this.obstacles = [];
        this.radius = 80;
        this.segments = 1000;
        this.geometry = new THREE.CylinderGeometry(this.radius, this.radius, this.length, this.segments);
        this.material = new THREE.MeshLambertMaterial({
            color: color
        });
        this.mesh = new THREE.Mesh(this.geometry, this.material);
        this.mesh.receiveShadow = true;
        this.mesh.castShadow = true;
        this.group.add(this.mesh);
        this.currentPosition = {
            angle: 0,
            anglemin: -5,
            anglemax: 5,
            distance: 50,
            height: 0
        };
    }
github cvdlab / react-planner / demo / src / catalog / items / radiator-modern-style / planner-element.jsx View on Github external
mesh7.position.set(i,newHeight - 17.5,-2);
    mesh7.rotation.x+=Math.PI/4;
    mesh7.scale.set(1,.14,.4);
    ModernRadiator.add(mesh7);

    let mesh8 = new Three.Mesh( geometry, grey ) ;
    mesh8.position.set(i,newHeight-11,5);
    mesh8.scale.set(1,.1,.4);
    ModernRadiator.add(mesh8);

  }


  for (let i = 5; i <= newHeight; i+=newHeight - 12.5) {

    let geometry1 = new Three.CylinderGeometry( newDepth/6,newDepth/6, newWidth, 32 );
    let tube = new Three.Mesh(geometry1,grey);
    tube.rotation.x+=Math.PI/2;
    tube.rotation.z+=Math.PI/2;
    tube.position.set(newWidth/2,i,newDepth/6);
    ModernRadiator.add(tube);

    let geometry2 = new Three.CylinderGeometry( newDepth/4, newDepth/4, newWidth-2.5, 6 );
    let tube2 = new Three.Mesh(geometry2,grey);
    tube2.rotation.x+=Math.PI/2;
    tube2.rotation.z+=Math.PI/2;
    tube2.position.set(newWidth/2,i,newDepth/6);
    ModernRadiator.add(tube2);

    let geometry3 = new Three.CylinderGeometry( newDepth/3.5, newDepth/3.5, newWidth-5, 32 );
    let tube3 = new Three.Mesh(geometry3,grey);
    tube3.rotation.x+=Math.PI/2;
github cvdlab / react-planner / demo / src / catalog / holes / panic-door-double / planner-element.jsx View on Github external
function makeDoorStructure() {

  let door = new Three.Object3D();
  let lowBaseDoorGeometry = new Three.BoxGeometry(0.6,1.2,0.01);
  let middleBaseDoorGeometry = new Three.BoxGeometry(0.2,0.7,0.01);
  let highBaseDoorGeometry = new Three.BoxGeometry(0.2,0.2,0.01);
  let BorderCoverDoorGeometry1 = new Three.CylinderGeometry(0.005,0.005,1.9,Math.round(32));
  let BorderCoverDoorGeometry2 = new Three.BoxGeometry(0.03,1.9,0.01);
  let MiddleDoorGeometry2 = new Three.BoxGeometry(0.2,0.7,0.06);
  let MiddleDoorGeometry1 = new Three.BoxGeometry(0.19,0.7,0.06);
  let HighDoorGeometry = new Three.BoxGeometry(0.2,0.2,0.06);
  let glassGeometry = new Three.BoxGeometry(0.2,0.5,0.05);
  let LowDoorGeometry = new Three.BoxGeometry(0.59,1.2,0.06);
  let glassCoverVertical = new Three.BoxGeometry(0.01,0.52,0.064);
  let glassCoverHorizontal = new Three.BoxGeometry(0.224,0.01,0.064);
  let lowCoverDoor = new Three.Mesh( lowBaseDoorGeometry , green );
  let middleDoor1 = new Three.Mesh( MiddleDoorGeometry1, green);
  let middleDoor2 = new Three.Mesh( MiddleDoorGeometry2, green);
  let baseDoor = new Three.Mesh( LowDoorGeometry, green );
  let middleCoverDoor1 = new Three.Mesh( middleBaseDoorGeometry, green);
  let middleCoverDoor2 = new Three.Mesh( middleBaseDoorGeometry, green);
  let highCoverDoor = new Three.Mesh( highBaseDoorGeometry, green);
  let highDoor = new Three.Mesh( HighDoorGeometry, green);
github cvdlab / react-planner / demo / src / catalog / items / fridge / planner-element.jsx View on Github external
//down door
  let door2 = new Three.Mesh(new Three.BoxGeometry(0.05,0.8,0.95), steel);
  door2.position.set(-0.5,0.425,0);
  base.add(door2);

  //middle plane
  let middlePlane = new Three.Mesh(new Three.BoxGeometry(1,0.05,1), steel);
  middlePlane.position.set(0,0.845,0);
  base.add(middlePlane);

  //handle
  let handle1_p1 = new Three.Mesh(new Three.CylinderGeometry(0.02,0.02,0.8),steel);
  handle1_p1.position.set(-0.56,1.30,-0.4);
  base.add(handle1_p1);

  let handle1_p2 = new Three.Mesh(new Three.CylinderGeometry(0.02,0.02,0.06),steel);
  handle1_p2.position.set(-0.53,1.60,-0.4);
  handle1_p2.rotation.z=0.5*Math.PI;
  base.add(handle1_p2);

  let handle1_p3 = new Three.Mesh(new Three.CylinderGeometry(0.02,0.02,0.06),steel);
  handle1_p3.position.set(-0.53,1,-0.4);
  handle1_p3.rotation.z=0.5*Math.PI;
  base.add(handle1_p3);

  //handle
  let handle2_p1 = new Three.Mesh(new Three.CylinderGeometry(0.02,0.02,0.7),steel);
  handle2_p1.position.set(-0.56,0.425,-0.4);
  base.add(handle2_p1);

  let handle2_p2 = new Three.Mesh(new Three.CylinderGeometry(0.02,0.02,0.06),steel);
  handle2_p2.position.set(-0.53,0.7,-0.4);
github cvdlab / react-planner / demo / src / catalog / items / hanger / planner-element.jsx View on Github external
function makeObjectMaxLOD() {

  let hanger = new Three.Mesh();

  //base
  let base_geom = new Three.CylinderGeometry(0.09, 0.25, 0.08, 20, 2, true);
  blackMaterial.side = Three.DoubleSide;
  let base = new Three.Mesh(base_geom, blackMaterial);
  base.position.set(0, 0.04, 0);

  let base2_geom = new Three.CylinderGeometry(0.09, 0.01, 0.03, 20, 2, true);
  let base2 = new Three.Mesh(base2_geom, blackMaterial);
  base2.position.set(0, 0.015+0.05, 0);

  //central body
  let body_geom = new Three.CylinderGeometry(0.03, 0.03, 2, 32, 32);
  let body = new Three.Mesh(body_geom, greyMaterial);
  body.position.set(0, 1, 0);

  //umbrella base
  let g_umbrella_base = new Three.TorusGeometry(0.045, 0.02, 32, 32);
github cvdlab / react-planner / demo / src / catalog / items / chairdesk / planner-element.jsx View on Github external
function makeWheel(){

  let ArmrestGeometry = new Three.CylinderGeometry( 0.027 , 0.02 , 0.3 , 32, 32 );
  let SupportGeometry = new Three.CylinderGeometry( 0.02 , 0.01 , 0.02 , 32, 32 );
  let PivotGeometry = new Three.CylinderGeometry( 0.008 , 0.008 , 0.01 , 32, 32 );
  let SupportGeometryStart = new Three.SphereGeometry( 0.02 , 32 , 32 );
  let WheelGeometry = new Three.CylinderGeometry( 0.025 , 0.025 , 0.05 , 32, 32 );
  let InsideWheelGeometry = new Three.CylinderGeometry( 0.02 , 0.02 , 0.051 , 32, 32 );
  let WheelCoverGeometry = new Three.CylinderGeometry( 0.026 , 0.026 , 0.045 , 32, 32 );
  let armrest = new Three.Mesh( ArmrestGeometry , metalGrey );
  let support = new Three.Mesh( SupportGeometry , metalGrey );
  let pivot = new Three.Mesh( PivotGeometry , grey );
  let SupportStart = new Three.Mesh( SupportGeometryStart , metalGrey );
  let Wheel = new Three.Mesh( WheelGeometry , black );
  let WheelCover = new Three.Mesh( WheelCoverGeometry , metalGrey );
  let InsideWheel = new Three.Mesh( InsideWheelGeometry , metalGrey );
  let Armrest1 = new Three.Object3D();
  let Armrest2 = new Three.Object3D();
  armrest.rotation.z = Math.PI*80/180;
  armrest.position.x = 0.01 + 0.15;
github cvdlab / react-planner / demo / src / catalog / items / chairdesk / planner-element.jsx View on Github external
function makeArmrest(){

  let armrest = new Three.Object3D();
  let NodeGeometry = new Three.SphereGeometry( 0.01 , 32 , 32 );
  let GeometryP1 = new Three.CylinderGeometry( 0.01 , 0.01 , 0.24 , 32, 32 );
  let GeometryP2 = new Three.CylinderGeometry( 0.01 , 0.01 , 0.04 , 32, 32 );
  let GeometryP3 = new Three.CylinderGeometry( 0.02 , 0.025 , 0.2 , 32, 32 );
  let node1 = new Three.Mesh( NodeGeometry , metalGrey );
  let node2 = new Three.Mesh( NodeGeometry , metalGrey );
  let P1 = new Three.Mesh( GeometryP1 , metalGrey );
  let P2 = new Three.Mesh( GeometryP2 , metalGrey );
  let P3 = new Three.Mesh( GeometryP3 , white );
  P1.rotation.x = Math.PI/2;
  P1.rotation.z = -Math.PI*25/180;
  P1.position.set(  0.12*Math.sin(P1.rotation.z) , 0 , -0.12*Math.cos(P1.rotation.z) );
  P2.rotation.z = Math.PI*100/180;
  P2.position.x = 0.02;
  P2.position.y = 0.0035;
  node2.position.y =-0.12;
  P3.position.y =-0.1 -0.02;
  P2.add(P3);