Skip to content
Snippets Groups Projects
Commit fab6c122 authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Add new file

parent b3ba1e7c
No related branches found
No related tags found
No related merge requests found
import * as THREE from 'three';
// Bending 2400
export function bending_2400(param) {
const length = param && typeof param.length == "number"? param.length: 2400
const bending_2400Container = new THREE.Object3D();
const bending_2400Object = new THREE.Object3D();
// main body
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(500, 700, length);
const d1mesh = new THREE.Mesh(d1geometry, materials);
d1mesh.position.set(100, 100, 0);
bending_2400Object.add(d1mesh);
// longitudinal 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);
// cylinder coil front
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);
// cylinder coil back
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);
bending_2400Object.add(dipoleCoil);
// duplicate coil
const dipoleCoil2 = dipoleCoil.clone();
dipoleCoil2.position.set(0, 200, 0);
bending_2400Object.add(dipoleCoil2);
bending_2400Object.position.set(0, 0, 0);
bending_2400Container.add(bending_2400Object);
return bending_2400Container;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment