Projects a PVector onto camera


#1

Hello! in three.js exist a function calls Projects (onto a camera):

.project ( camera : Camera ) : this

camera — camera to use in the projection.

project: function ( camera ) {

		return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );

	},

Projects the vector with the camera.

anybody know the maths to do something similar in processing?


#2

Just to make sure I’m clear – do you want to know how to do this in Processing(Java), or in p5.js?


#3

Hi! i want to know how to do this in processing


#4

I’m not seeing Camera.project in the three.js documentation, so I’m not totally clear on what the function does – https://threejs.org/docs/#api/en/cameras/Camera – can you link to the documentation?

Edit – found it: Vector3.project(): https://threejs.org/docs/#api/en/math/Vector3.project

and

I think perhaps you should look at the reference

https://processing.org/reference/

and specifically the Camera section functions and the Matrix functions, such as:

https://processing.org/reference/camera_.html
https://processing.org/reference/perspective_.html
https://processing.org/reference/applyMatrix_.html

Is your question related to this?

See also PMatrix3D.invert:

https://forum.processing.org/one/topic/matrix-invert.html

http://processing.github.io/processing-javadocs/core/processing/core/PMatrix3D.html#invert--