Skip to content
Snippets Groups Projects
  • Lucio Zambon's avatar
    Update 80 files · 0ee5780d
    Lucio Zambon authored
    - /components/src/beamlineDown.svg
    - /components/src/beamlineUP.js
    - /components/src/bending.svg
    - /components/src/blm.js
    - /components/src/blmplus.js
    - /components/src/bpm.js
    - /components/src/bpm.svg
    - /components/src/bst.js
    - /components/src/bst.svg
    - /components/src/cavity.js
    - /components/src/cavity.svg
    - /components/src/cavity_3hc.js
    - /components/src/cavity_3hc.svg
    - /components/src/cavity_3hcfast.js
    - /components/src/cavitylinac.js
    - /components/src/cavitylinac.svg
    - /components/src/chamber.js
    - /components/src/corrector.js
    - /components/src/corrector.svg
    - /components/src/correctorbooster.js
    - /components/src/correctorboosterfast.js
    - /components/src/correctorfast.js
    - /components/src/correctorfermi.js
    - /components/src/dipole.js
    - /components/src/dipolebooster.js
    - /components/src/dipoleboosterfast.js
    - /components/src/dipoleesrf.js
    - /components/src/dipolefast.js
    - /components/src/dipolefermi.js
    - /components/src/dipoleplus.js
    - /components/src/ellipticaltube.js
    - /components/sr...
    0ee5780d
octupole.js 1.98 KiB
	import * as THREE from 'three';

	// octupole
	export function octupole(length=150) {
		const OctupoleContiner = new THREE.Object3D();
		const OctupoleMaster = new THREE.Object3D();
		const dmaterial = new THREE.MeshLambertMaterial({color: 0xf01988});

		// support high
		const geometry_1 = new THREE.BoxGeometry(length, 100, 150);
		const dmesh_1 = new THREE.Mesh(geometry_1, dmaterial);
		dmesh_1.position.set(0, 324, 0);
		OctupoleMaster.add(dmesh_1);

		// support side
		const dmesh_2 = new THREE.Mesh(geometry_1, dmaterial);
		dmesh_2.position.set(0, 299, -124);
		dmesh_2.rotateX(-Math.PI / 8);
		OctupoleMaster.add(dmesh_2);

		const geometry3 = new THREE.BoxGeometry(length-30, 120, 50);
		const dmesh3 = new THREE.Mesh(geometry3, dmaterial);
		dmesh3.position.set(0, 140, 0);
		OctupoleMaster.add(dmesh3);

		// coil
		const coilmaterial = new THREE.MeshLambertMaterial({color: 0xc08000});
		const textureLoader = new THREE.TextureLoader();
		const texture = textureLoader.load('./components/coil_texture.png');
		texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
		texture.repeat.set(5, 5);
		const d6geometry = new THREE.CylinderGeometry(80 /*radiusTop*/, 80 /*radiusBottom*/, 80 /*height*/, 25 /*radialSegments*/, 4 /*heightSegments*/, false /*openEnded*/,Math.PI * 1.5 /*thetaStart*/, Math.PI * 2 /*thetaLength*/);
		const material6 = new THREE.MeshBasicMaterial({ map: texture });
		const materialside6 = new THREE.MeshBasicMaterial({color: 0xcd7f32});
		const materials6 = [material6, materialside6, materialside6];		
		const d6mesh = new THREE.Mesh(d6geometry, materials6);
		d6mesh.position.set(0, 230, 0);
		d6mesh.rotateX(Math.PI * 1.50);
		d6mesh.rotateY(Math.PI * 1.50);
		d6mesh.rotateZ(Math.PI * 1.50);
		OctupoleMaster.add(d6mesh);

		for (let i=1; i<8; i++) {
			const Octupole2 = OctupoleMaster.clone();
			Octupole2.rotateX(-Math.PI / 4*i);
			OctupoleContiner.add(Octupole2);
		}
		OctupoleContiner.add(OctupoleMaster);
		OctupoleContiner.rotateY(Math.PI * -0.5);

		return OctupoleContiner;
	}