gabrielpillet
unread,Nov 3, 2010, 5:36:59 AM11/3/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pre3d
Hello and thanks for this handy lib. I found it really easy to use
with Canvas.
I got a specific need, my application need to draw a 3D plane (rotated
on X for perspective), this is working as expected, I just create my
plane and set a transformation to it, positioning my camera
accordingly.
Then I need do create some HTML div on top of the canvas, and one
corner of each div should match the position on my 3D plane, so I need
to apply my world transformation (rotation), along with my camera, and
get the projected coordinates.
Here is my code :
this.getProjectedPoint = function()
{
var p = this.p; //the point to transform (is in the same
coordinate system as my plane before transformation)
var transformPoint = new Pre3d.Transform();
transformPoint.rotateX(anglePlane);
transformPoint.m = transformPoint.m;
var transformCam = new Pre3d.Transform();
transformCam.m = renderer.camera.transform.m;
transformCam.multTransform(transformPoint);
p = transformCam.transformPoint(p);
return renderer.projectPointToCanvas(p);
}
The result is not exactly what I expect, but not far from it (hard to
explain without screenshot), therefor I think it's just a little
mistake. Any ideas ?
Gabriel