Projecta 2d poin in to 3D plane

Hi
I would like to know is there any API which support 2D coordinates projection into to arbitrary 3D plane.

Benjamin Bihler's picture

Hi,

I guess there is nothing. 2D coordinates are given with respect to a surface. You should compute a 3D point from them and this point you can project onto the plane using linear algebra.

Benjamin

Andrey Pozdeev's picture

Hi M.G

yes there is. use GeomAPI::To3d(2dcurve, 3dplane). here is an example:

//say you had a 2d curve

Handle(Geom2d_Circle) circ2d = new Geom2d_Circle(circ.Axis(),circ.Radius());

// and a 3d plane
Handle(Geom_Plane) plane3d = new Geom_Plane(avrgplane);

// you can transfer the 2d curve to an arbitrary 3d plane using GeomAPI::To3d function
Handle(Geom_Curve) C3D = GeomAPI::To3d(circ2d,avrgplane);

Andrey Pozdeev's picture

if you simply want to evaluate 2d coordinates into an arbitrary plane rather than using 2d curves simply use the D0 of the plane:

build the 3d plane:

Handle(Geom_Plane) plane3d = new Geom_Plane...;

Double X = 20;
Double Y = 30;

gp_Pnt thepoint = plane3d->D0(X,Y);