remove obsolete imports
This commit is contained in:
parent
f0928994a5
commit
748a2839c1
3 changed files with 0 additions and 229 deletions
|
@ -1,153 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- https://discourse.threejs.org/t/line-segment-coordinates/4358/3 -->
|
||||
<!-- http://jsfiddle.net/prisoner849/go0dfwo5/ -->
|
||||
<head>
|
||||
<title> Interaction with Points </title>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
<script src="../js/three.min.97.js"></script>
|
||||
<script src="../js/OrbitControls.js"></script>
|
||||
|
||||
<script> // @author prisoner849
|
||||
Object.assign(THREE.PlaneBufferGeometry.prototype, {
|
||||
toGrid: function() {
|
||||
let segmentsX = this.parameters.widthSegments || 1;
|
||||
let segmentsY = this.parameters.heightSegments || 1;
|
||||
let indices = [];
|
||||
for (let i = 0; i < segmentsY + 1; i++) {
|
||||
let index11 = 0;
|
||||
let index12 = 0;
|
||||
for (let j = 0; j < segmentsX; j++) {
|
||||
index11 = (segmentsX + 1) * i + j;
|
||||
index12 = index11 + 1;
|
||||
let index21 = index11;
|
||||
let index22 = index11 + (segmentsX + 1);
|
||||
indices.push(index11, index12);
|
||||
if (index22 < ((segmentsX + 1) * (segmentsY + 1) - 1)) {
|
||||
indices.push(index21, index22);
|
||||
}
|
||||
}
|
||||
if ((index12 + segmentsX + 1) <= ((segmentsX + 1) * (segmentsY + 1) - 1)) {
|
||||
indices.push(index12, index12 + segmentsX + 1);
|
||||
}
|
||||
}
|
||||
this.setIndex(indices);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
//@author prisoner849
|
||||
|
||||
var scene = new THREE.Scene();
|
||||
var camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000);
|
||||
camera.position.set(1.25, 7, 7);
|
||||
camera.lookAt(scene.position);
|
||||
var renderer = new THREE.WebGLRenderer({antialias: true});
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
var controls = new THREE.OrbitControls(camera, renderer.domElement);
|
||||
|
||||
var geometry = new THREE.PlaneBufferGeometry(10, 10, 10, 10).toGrid();
|
||||
geometry.rotateX(-Math.PI * 0.5);
|
||||
|
||||
var plane = new THREE.LineSegments(geometry, new THREE.MeshBasicMaterial({
|
||||
color: "red"
|
||||
}));
|
||||
scene.add(plane);
|
||||
|
||||
var points = new THREE.Points(geometry, new THREE.PointsMaterial({
|
||||
size: 0.25,
|
||||
color: "yellow"
|
||||
}));
|
||||
scene.add(points);
|
||||
|
||||
var raycaster = new THREE.Raycaster();
|
||||
raycaster.params.Points.threshold = 0.25;
|
||||
var mouse = new THREE.Vector2();
|
||||
var intersects = null;
|
||||
var plane = new THREE.Plane();
|
||||
var planeNormal = new THREE.Vector3();
|
||||
var currentIndex = null;
|
||||
var planePoint = new THREE.Vector3();
|
||||
var dragging = false;
|
||||
|
||||
window.addEventListener("mousedown", mouseDown, false);
|
||||
window.addEventListener("mousemove", mouseMove, false);
|
||||
window.addEventListener("mouseup", mouseUp, false);
|
||||
|
||||
function mouseDown(event) {
|
||||
setRaycaster(event);
|
||||
getIndex();
|
||||
dragging = true;
|
||||
}
|
||||
|
||||
function mouseMove(event) {
|
||||
if (dragging && currentIndex !== null) {
|
||||
setRaycaster(event);
|
||||
raycaster.ray.intersectPlane(plane, planePoint);
|
||||
geometry.attributes.position.setXYZ(currentIndex, planePoint.x, planePoint.y, planePoint.z);
|
||||
geometry.attributes.position.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
function mouseUp(event) {
|
||||
dragging = false;
|
||||
currentIndex = null;
|
||||
controlsEnabled(true);
|
||||
}
|
||||
|
||||
function getIndex() {
|
||||
intersects = raycaster.intersectObject(points);
|
||||
if (intersects.length === 0) {
|
||||
currentIndex = null;
|
||||
return;
|
||||
}
|
||||
controlsEnabled(false);
|
||||
currentIndex = intersects[0].index;
|
||||
setPlane(intersects[0].point);
|
||||
}
|
||||
|
||||
function setPlane(point) {
|
||||
planeNormal.subVectors(camera.position, point).normalize();
|
||||
plane.setFromNormalAndCoplanarPoint(planeNormal, point);
|
||||
}
|
||||
|
||||
function setRaycaster(event) {
|
||||
getMouse(event);
|
||||
raycaster.setFromCamera(mouse, camera);
|
||||
}
|
||||
|
||||
function getMouse(event) {
|
||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||
}
|
||||
|
||||
function controlsEnabled(state){
|
||||
controls.enableZoom = state;
|
||||
controls.enableRotate = state;
|
||||
controls.enablePan = state;
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
function render() {
|
||||
requestAnimationFrame(render);
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
|
@ -11,8 +11,6 @@ import {
|
|||
Camera,
|
||||
} from 'three'
|
||||
|
||||
import data from './testdata.json'
|
||||
|
||||
export interface StarData {
|
||||
name: string
|
||||
type: string
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "* 61 Cyg B",
|
||||
"type": "Eruptive Variable",
|
||||
"theta": 82.3171310715589,
|
||||
"phi": -5.8262372280102,
|
||||
"spectral": "K7V",
|
||||
"radius": 3.4964
|
||||
},
|
||||
{
|
||||
"name": "* 61 Cyg A",
|
||||
"type": "BY Dra Variable",
|
||||
"theta": 82.3197403091576,
|
||||
"phi": -5.8181041502094,
|
||||
"spectral": "K5V",
|
||||
"radius": 3.4965
|
||||
},
|
||||
{
|
||||
"name": "GAT 1383",
|
||||
"type": "High Proper Motion Star",
|
||||
"theta": 85.6450087237446,
|
||||
"phi": -7.3769487234860,
|
||||
"spectral": "M5.5V",
|
||||
"radius": 14.5094
|
||||
},
|
||||
{
|
||||
"name": "BD+40 4631",
|
||||
"type": "High Proper Motion Star",
|
||||
"theta": 89.4905214280362,
|
||||
"phi": -8.8259946066449,
|
||||
"spectral": "K8V",
|
||||
"radius": 19.837
|
||||
},
|
||||
{
|
||||
"name": "V* EV Lac",
|
||||
"type": "Eruptive Variable",
|
||||
"theta": 100.6067176270883,
|
||||
"phi": -13.0693645782006,
|
||||
"spectral": "M4.0Ve",
|
||||
"radius": 5.0515
|
||||
},
|
||||
{
|
||||
"name": "Proxima Centauri",
|
||||
"type": "Eruptive Variable",
|
||||
"theta": 313.9398620493784,
|
||||
"phi": -1.9271491330428,
|
||||
"spectral": "M5.5Ve",
|
||||
"radius": 1.3019
|
||||
},
|
||||
{
|
||||
"name": "Teegarden's Star",
|
||||
"type": "Low-mass Star",
|
||||
"theta": 160.2632765789228,
|
||||
"phi": -37.0261176452823,
|
||||
"spectral": "dM6",
|
||||
"radius": 3.8315
|
||||
},
|
||||
{
|
||||
"name": "Barnard's star",
|
||||
"type": "BY Dra Variable",
|
||||
"theta": 31.0087027177046,
|
||||
"phi": 14.0626510150033,
|
||||
"spectral": "M4V",
|
||||
"radius": 1.8282
|
||||
},
|
||||
{
|
||||
"name": "Wolf 359",
|
||||
"type": "Eruptive Variable",
|
||||
"theta": 244.0543969618636,
|
||||
"phi": 56.1197323657577,
|
||||
"spectral": "dM6",
|
||||
"radius": 2.4086
|
||||
}
|
||||
]
|
Loading…
Add table
Reference in a new issue