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
dipolebooster.js 2.29 KiB
	import * as THREE from 'three';

	// Bending Dipole booster
	export function dipolebooster(length=1915) {
		const dipoleContainer = new THREE.Object3D();
		const dipoleMaster = new THREE.Object3D();

		//texture
		const loader = new THREE.TextureLoader();
		const texture = loader.load('./components/dipole.png');
		const textureTop = texture.clone();
		const textureSide = texture.clone();
		textureTop.center.set(0.5, 0.5);
		textureTop.rotation = THREE.MathUtils.degToRad(90);
		textureSide.offset.set(0, 0.8);
		const dmaterial = new THREE.MeshLambertMaterial({map: texture});
		const face = new THREE.MeshBasicMaterial({map: texture});
		const faceTop = new THREE.MeshBasicMaterial({map: textureTop});
		const faceSide = new THREE.MeshBasicMaterial({map: textureSide});
		const materials = [face,face,faceTop,faceSide,faceSide,faceSide];
		const d1geometry = new THREE.BoxGeometry(550, 400, length);
		const d1mesh = new THREE.Mesh(d1geometry, materials);
		d1mesh.position.set(-100, 100, 0);
		dipoleMaster.add(d1mesh);	

		//Coil
		const dipoleCoil = new THREE.Object3D();
		const coilmaterial = new THREE.MeshLambertMaterial({color: 0xc08000});
		const d4geometry = new THREE.BoxGeometry(100, 100, length);
		const d4mesh = new THREE.Mesh(d4geometry, coilmaterial);
		d4mesh.position.set(-200, 0, 0);
		dipoleCoil.add(d4mesh);
		const d2geometry = new THREE.CylinderGeometry(150 /*radiusTop*/, 150 /*radiusBottom*/, 100 /*height*/, 20 /*radialSegments*/, 2 /*heightSegments*/, false /*openEnded*/,Math.PI * 1.5 /*thetaStart*/, Math.PI * 1 /*thetaLength*/);
		const d2mesh = new THREE.Mesh(d2geometry, coilmaterial);
		d2mesh.position.set(-100, 0, length/2);
		dipoleCoil.add(d2mesh);
		const d3geometry = new THREE.CylinderGeometry(150 /*radiusTop*/, 150 /*radiusBottom*/, 100 /*height*/, 20 /*radialSegments*/, 2 /*heightSegments*/, false /*openEnded*/,Math.PI * 0.5 /*thetaStart*/, Math.PI * 1 /*thetaLength*/);
		const d3mesh = new THREE.Mesh(d3geometry, coilmaterial);
		d3mesh.position.set(-100, 0, -length/2);
		dipoleCoil.add(d3mesh);
		dipoleCoil.position.set(0, 0, 0);
		dipoleMaster.add(dipoleCoil);
		const dipoleCoil2 = dipoleCoil.clone();
		dipoleCoil2.position.set(0, 200, 0);
		dipoleMaster.add(dipoleCoil2);

		dipoleMaster.position.set(200, 0, 0);
		dipoleContainer.add(dipoleMaster);

		return dipoleContainer;
	}