I want to draw a new Line. I have a start point, a length and a direction.
However new THREE.line() seems to require points in its geometry.
Is there anyway to draw it with what I have/know?
I want to draw a new Line. I have a start point, a length and a direction.
However new THREE.line() seems to require points in its geometry.
Is there anyway to draw it with what I have/know?
Yes, you calculate the second (end) point and then draw the line using the start and the end points.
To calculate the end point you multiply each (normalized) direction vector component by length and add the result vector to the start point.
Yes.
you have a start point “S” as given by its x, y, z coordinates.
You have a direction vector “dir” as given by its dx, dy, dz components.
you have a length “L” by which to travel from “S” in the direction “dir”.
The end point “E” is reached via the following:
S = new Vector3.set( x, y, z );
E = new Vector3();
dir = new Vector3.set( dx, dy, dz ).normalize(); // make it unit length
E = S.addScaledVector( dir, L );
Oh nice, thanks!