-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
distance to the camera #26
Comments
Hi @fuddl, I just published import {
renderScene,
SCENE_ORIENTATION,
getWorldWrtCameraMatrix,
AxesRenderer,
SceneCube,
DataRenderer,
SceneCubeRenderer,
Vector,
rotateXYZmatrix,
multiply4x4matrix,
radians,
} from "@mithi/bare-minimum-3d" If you check the The You can take a look at lines 42-60 of bare-minimum-3d/src/data-renderer.ts Lines 42 to 60 in 4bfd0ca
Here's what I think you need.
This means, you may want to create your own _projectPointWithVirtualDistanceWrtCam(x_: number, y_: number, z_: number, i: number): Vector {
/*** SNIP **/
const pointWrtCam= new Vector(x, y, z, `${i}`).transform(transformMatrix)
const virtualDistanceWrtCam = // squareRoot of pointWrtCam's x**2 + y**2 + z**2
return {
point2d: pointWrtCam.project(projectionConstant)
virtualDistanceWrtCam
}
} Or something like that. If you'd like to learn more about the math behind translating 2d to 3d, I recommend the following resources
I hope that helps you, thanks! |
That was helpful. Thanks 😅 |
the
DataRenderer
currently returns two dimensional coordinates. I suppose it could additionally return the virtual distance to the camera. This could enable plug-ins to do things like:The text was updated successfully, but these errors were encountered: