Skip to content

Commit a427d98

Browse files
committed
up
1 parent f73460f commit a427d98

File tree

252 files changed

+993747
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+993747
-18
lines changed

BioRadarv2/src/script/timeSpaceModel.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,10 @@ d3.TimeSpace = function () {
444444
setTimeout(function(){
445445
isneedrender = false;
446446
far = graphicopt.width/2 /Math.tan(fov/180*Math.PI/2)*10;
447-
camera = new THREE.PerspectiveCamera(fov, graphicopt.width/graphicopt.height, near, far + 1);
448-
// far = graphicopt.width/2*10;
449-
// camera = new THREE.OrthographicCamera(graphicopt.width / - 2, graphicopt.width / 2, graphicopt.height / 2, graphicopt.height / - 2, near, far + 1);
447+
// camera = new THREE.PerspectiveCamera(fov, graphicopt.width/graphicopt.height, near, far + 1);
448+
far = graphicopt.width / 2 * 100;
449+
near = 1;
450+
camera = new THREE.OrthographicCamera(graphicopt.width / -2, graphicopt.width / 2, graphicopt.height / 2, graphicopt.height / -2, near, far + 1);
450451
scene = new THREE.Scene();
451452
axesHelper = createAxes( graphicopt.width/4 );
452453
axesTime = createTimeaxis();
@@ -1940,11 +1941,8 @@ d3.TimeSpace = function () {
19401941
}
19411942

19421943
function setUpZoom() {
1943-
// view.call(zoom);
19441944
let initial_scale = 1;
1945-
// var initial_transform = d3.zoomIdentity.translate(graphicopt.width/2, graphicopt.height/2).scale(initial_scale);
1946-
// zoom.transform(view, initial_transform);
1947-
camera.position.set(0, 0, getZFromScale(1));
1945+
camera.position.set(0, 0, getZFromScale(initial_scale));
19481946
}
19491947
function zoomHandler(d3_transform) {
19501948
let scale = d3_transform.k;
@@ -1963,23 +1961,23 @@ d3.TimeSpace = function () {
19631961
}
19641962
camera.lookAt(new THREE.Vector3(0, 0, 0));
19651963
}
1966-
function getScaleFromZ (camera_z_position) {
1967-
let half_fov = fov/2;
1968-
let half_fov_radians = toRadians(half_fov);
1969-
let half_fov_height = Math.tan(half_fov_radians) * camera_z_position;
1970-
let fov_height = half_fov_height * 2;
1971-
let scale = graphicopt.height / fov_height; // Divide visualization height by height derived from field of view
1972-
return scale;
1973-
}
1974-
19751964
function getZFromScale(scale) {
1976-
let half_fov = fov/2;
1965+
let half_fov = fov / 2;
19771966
let half_fov_radians = toRadians(half_fov);
19781967
let scale_height = graphicopt.height / scale;
1979-
let camera_z_position = scale_height / (2 * Math.tan(half_fov_radians));
1968+
let camera_z_position = scale_height;
1969+
console.log('camera_z_position', camera_z_position)
19801970
return camera_z_position;
19811971
}
19821972

1973+
// function getZFromScale(scale) {
1974+
// let half_fov = fov / 2;
1975+
// let half_fov_radians = toRadians(half_fov);
1976+
// let scale_height = graphicopt.height / scale;
1977+
// let camera_z_position = scale_height / (2 * Math.tan(half_fov_radians));
1978+
// return camera_z_position;
1979+
// }
1980+
19831981
function toRadians (angle) {
19841982
return angle * (Math.PI / 180);
19851983
}

0 commit comments

Comments
 (0)