Threejs convert local X,Y to world co-ordinate - three.js

I would like to convert a local co-ordinate (X,Y)(not mouse click) to world co-ordinate in Threejs.
Thanks And Regards,
Rupak Banerjee.

Related

Three.js always rotate about world center

I'm currently following a tutorial on how to get a 3d model view in three.js
But I notice that whenever I pan the camera (right-click and drag), the center of rotation changes.
Is it possible to make the axis of rotation stay in the world center/object center?
Many thanks!

OpenCV Calibration

I am little confused about world coordinates. How can we find the origin of world coordinate system.
Origin of camera coordinate system is behind the image plan on the optical axis at a distance of focal length. but how can we find the origin of world coordinate system.
Unlike the origin of the camera coordinate system which is at the centre of projection, the world coordinate system is not fixed and should be defined by you depending on the use case. The origin of the world coordinate system can be anywhere, independent of the origin of the camera coordinate system.
The transformation between world and camera coordinates is defined by the pinhole camera model. See this for a brief overview of the pinhole camera model.

NDC coordinates to Camera Coordinates

I have a scenario in which the mouse is over the screen and I want to calculate the 3d coordinate the mouse represents in the XY- plaine of the camera.
The nice way would be to convert NDC mouse coordinates that I have to the matching camera coordinate with which I struggle. Alternatively I could create a fake mesh at the given distance and just use a raycaster - but that seems really ugly.
Since I struggled I tried looking up how three.js raycaster calculates 3d coordinates from ndc coordinates and found the matching lines for PerspectiveCamera
this.ray.origin.setFromMatrixPosition( camera.matrixWorld );
this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();
That doesn't make much sense to me since the ray origin should depend on the mouse coordinates as well and not just the camera. In comparison the ray direction I would only expect to depend on the camera but not on the coordinates.
I guess I am thinking to much in terms of orthogonal coordinate systems and not in terms of a perspective camera, but I can't make any sense of it. IF sb has a good reference for camera perspectives that'd be great too. Cheers Tom

Unity3d Transform View Frustum

How do I transform a Unity3d camera's view frustum so that I can pass in a Plane and have the camera's near clipping plane become that plane? The plane might not be perpendicular to the looking direction. I am not familiar with the Matrix4x4.
image
I am not interested in a solution involving applying a material with a custom shader to every object in my scene.
Thanks for any help!

Three.js : Absolute coordinates of point on surface [duplicate]

I have a 3D object. "Attached" to it is a point. When the object is moved or rotated, the point moves and rotates with it.
Given the object's position and rotation, how can the position of the point in world space be calculated? (Using THREE.js's API if possible)
Thanks
For a point in an object's local coordinate system,
object.localToWorld( point );
will return the world coordinates of the point, assuming the same transform is applied to the point as is applied to the object.
three.js r.55

Resources