Added ground plane. Adjustable height above ground.

pull/2/head
miguel 2022-07-28 21:51:31 +10:00
rodzic 9edee40829
commit bebcf83ccd
1 zmienionych plików z 31 dodań i 6 usunięć

Wyświetl plik

@ -36,8 +36,11 @@
var camera, scene, renderer, geometry, controls; var camera, scene, renderer, geometry, controls;
var clock = new THREE.Clock(); var clock = new THREE.Clock();
var tick = 0; var tick = 0;
var ant = 0; var ant = 0;
var current_antenna_object = 0; var current_antenna_object = 0;
var ground_plane = 0;
var height_above_ground = 0;
class Antennas { class Antennas {
// //
@ -74,7 +77,7 @@
'Inverted L' : { 'Inverted L' : {
//'name' : "Inverted L", //'name' : "Inverted L",
'wires' : [ 'wires' : [
[[0.00, 0.00, 0.00], [0.00, 0.35, 0.00], [0.15, 0.35, 0.00]] [[0.00, 0.00, 0.00], [0.00, 0.35, 0.00], [0.00, 0.35, -0.20]]
], ],
}, },
'Loop Large Triangle' : { 'Loop Large Triangle' : {
@ -208,9 +211,10 @@
*/ */
var parameters = { var parameters = {
//
mode: true, mode: true,
axes: true, axis: true,
ground: true,
height: 0.0,
w: "...", // dummy value, only type is important w: "...", // dummy value, only type is important
}; };
@ -221,13 +225,33 @@
.setValue('view') .setValue('view')
.onChange(function(value){ console.log(value); }); .onChange(function(value){ console.log(value); });
// Create the Antennas object, which holds all the antenna types and creates the visual model on-request
ant = new Antennas();
const geometry = new THREE.CircleGeometry( 150, 32 );
const material = new THREE.MeshBasicMaterial( { color: 0x006f00, wireframe: true } );
const ground_plane = new THREE.Mesh( geometry, material );
ground_plane.rotateX(Math.PI * -0.5);
scene.add( ground_plane );
// Add an enable axes-helper button: // Add an enable axes-helper button:
gui.add(parameters, 'axes') gui.add(parameters, 'axis')
.setValue(true) .setValue(true)
.onChange(function(value){ axis.visible = value; }); .onChange(function(value){ axis.visible = value; });
// Create the Antennas object, which holds all the antenna types and creates the visual model on-request // Add an enable axes-helper button:
ant = new Antennas(); gui.add(parameters, 'ground')
.setValue(true)
.onChange(function(value){ ground_plane.visible = value; });
// Add an enable axes-helper button:
gui.add(parameters, 'height', 0.0, 500.0)
.setValue(true)
.onChange(function(value){
//console.log(current_antenna_object['position']);
current_antenna_object['position'].y = value;
//console.log(parameters['height']);
});
gui.add( parameters, 'w', ant.antenna_types['order']) gui.add( parameters, 'w', ant.antenna_types['order'])
.setValue(ant.current_type) .setValue(ant.current_type)
@ -240,6 +264,7 @@
ant.setAntennaType(value); ant.setAntennaType(value);
// Load new antenna visual model into the scene: // Load new antenna visual model into the scene:
current_antenna_object = ant.getThreeObject3D(); current_antenna_object = ant.getThreeObject3D();
current_antenna_object['position'].y = parameters['height'];
scene.add(current_antenna_object); scene.add(current_antenna_object);
}); });