import * as THREE from 'three';

	// Bending Dipole
	export function dipoleesrf(length=2450) {
		const dipoleMaster = new THREE.Object3D();
		const dmaterial = new THREE.MeshLambertMaterial({color: 0x0000b0});
		const d1geometry = new THREE.BoxGeometry(500, 700, length);
		const d1mesh = new THREE.Mesh(d1geometry, dmaterial);
		d1mesh.position.set(100, 100, 0);
		dipoleMaster.add(d1mesh);				
		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);
		return dipoleMaster;
	}