About how to calculate intersection of three planes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

About how to calculate intersection of three planes

ivanotero76
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: About how to calculate intersection of three planes

Sebastien Loriot (GeometryFactory)
On 02/09/2017 05:26 PM, Iván otero wrote:

>
> Could you recomend any post link about cgal and about how to calculate
> intersection of 3 planes.
> In my case I have normal vector of plane and centroide.
>
> I need to know the know how of cgal to calculate this point
> I know mathematics to calculate it but I would like to get this point
> with cgal.
>
> On the other hand If I have a group of data with normal vector and
> centroide that are part of a space.
>
> I define space like a bedroom.
> I mean a group of six vectors with its six centroids.
>
> Then I would like to calculate all the eight edges of this space.
>
> Thanks and best regards
>
>
There is a dedicated intersection function:

http://doc.cgal.org/latest/Kernel_23/group__intersection__linear__grp.html

you can do something like this:

typedef CGAL:Exact_predicates_exact_construtions_kernel K;
typedef K::Plane_3 Plane_3;
typedef K::Point_3 Point_3;
typedef K::Vector_3 Vector_3;


Plane_3 p1(Vector_3(x,y,x), Point_3(a,b,c));
Plane_3 p2(.....);
Plane_3 p3(.....);


boost::optional< boost::variant< Point_3, Line_3, Plane_3 > > res =
   CGAL::intersection(p1, p2, p3);

if (res!=boost::none)
{
   if (const Point_3* pt = boost::get<Point_3>(&(*res)))
   {
     // pt is the intersection point of the 3 planes
   }
   else
   {
     if (const Plane_3* pl = boost::get<Plane_3>(&(*res)))
     {
     }
     else
     {
       const Line_3* l = boost::get<Line_3>(&(*res));
       assert(l!=NULL);
     }
   }
}

Sebastien.



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: About how to calculate intersection of three planes

ivanotero76
This post was updated on .
Hi Sebastien!

Thank you for your help.

I have now this.

    Plane_3 suelo(Point_3(0,0,0), Vector_3(0,0,-1));    // Suelo

    Plane_3 principal( Point_3(0,0,0),Vector_3(0,1,0)); // Principal

    Plane_3 lateral3(Point_3(0,5,0),Vector_3(-1,0,0)); // Lateral 3


    boost::optional<boost::variant<Point_3, Line_3, Plane_3>> res =
CGAL::intersection(suelo, principal, lateral3);


    if (res!=boost::none)

    {

        if (const Plane_3* pl = boost::get<Plane_3>(&(*res)))

        {


        }

        else if ( const Line_3* l = boost::get<Line_3>(&(*res)))

        {


            assert(l!=NULL);

        }

        else if ( const Point_3* p = boost::get<Point_3>(&(*res)))

        {


             std::cout<<"el punto es:"<<p<<std::endl;


        }


    }


*What do you think about store this points an after access to this
structure?*

*In my case I want to iterate with all surface of one space and get this
points.*

Some other beginner question.

    How to show or view values of vector and plane?
    I use debugger of Qt and try to view this information but I cant see
them like you can see in this image (view cgal_001.png)

    But p i can't see it.
    Could you help me?


Iván Otero


cgal_001.png (62K) <http://cgal-discuss.949826.n4.nabble.com/attachment/4662512/0/cgal_001.png>
Reply | Threaded
Open this post in threaded view
|

Re: About how to calculate intersection of three planes

ivanotero76
This post was updated on .
Hi again!

I debug this code and I have this result.

debug p

On the other hand.

res intersection result

Then I am wrong to to that?

I need all values (x,y,z) of this p = point intersection but I can't see them.

Could you tell me how?

On the other hand. I have this.

Some points like here:

    Point_3D p1(0.0, 5.0, 3.0);
    Point_3D p2(0.0, 5.0, 0.0);
    Point_3D p3(0.0, 0.0, 3.0);
    Point_3D p4(0.0, 0.0, 0.0);

And I cant access to them like this:

    int x01 = p1.x();
    int y01 = p1.y();
    int z01 = p1.z();

What I do in wrong way?

Reply | Threaded
Open this post in threaded view
|

Re: About how to calculate intersection of three planes

Sebastien Loriot (GeometryFactory)
In reply to this post by ivanotero76
On 02/10/2017 03:46 PM, Iván otero wrote:

> Hi Sebastien!
>
> Thank you for your help.
>
> I have now this.
>
> Plane_3suelo(Point_3(0,0,0),Vector_3(0,0,-1));//Suelo
>
> Plane_3principal(Point_3(0,0,0),Vector_3(0,1,0));//Principal
>
> Plane_3lateral3(Point_3(0,5,0),Vector_3(-1,0,0));//Lateral3
>
>
> boost::optional<boost::variant<Point_3,Line_3,Plane_3>>res=CGAL::intersection(suelo,principal,lateral3);
>
>
> if(res!=boost::none)
>
> {
>
> if(constPlane_3*pl=boost::get<Plane_3>(&(*res)))
>
> {
>
>
> }
>
> elseif(constLine_3*l=boost::get<Line_3>(&(*res)))
>
> {
>
>
> assert(l!=NULL);
>
> }
>
> elseif(constPoint_3*p=boost::get<Point_3>(&(*res)))
>
> {
>
>
> std::cout<<"elpuntoes:"<<p<<std::endl;
>
>
> }
>
>
> }
>
>
> *What do you think about store this points an after access to this
> structure?*
> *
> *
> *In my case I want to iterate with all surface of one space and get this
> points.*
> *
> *
> Some other beginner question.
>
>     How to show or view values of vector and plane?

You can access the plane coefficients, see
http://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Plane__3.html



>     I use debugger of Qt and try to view this information but I cant see
> them like you can see in this image (view cgal_001.png)
>
>     But p i can't see it.

p is a pointer, so you need to print *p.


Sebastien.

>     Could you help me?
>
> *
> *
> *Thanks and best regards.*
>
> 2017-02-10 8:05 GMT+01:00 Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>>:
>
>     On 02/09/2017 05:26 PM, Iván otero wrote:
>
>
>         Could you recomend any post link about cgal and about how to
>         calculate
>         intersection of 3 planes.
>         In my case I have normal vector of plane and centroide.
>
>         I need to know the know how of cgal to calculate this point
>         I know mathematics to calculate it but I would like to get this
>         point
>         with cgal.
>
>         On the other hand If I have a group of data with normal vector and
>         centroide that are part of a space.
>
>         I define space like a bedroom.
>         I mean a group of six vectors with its six centroids.
>
>         Then I would like to calculate all the eight edges of this space.
>
>         Thanks and best regards
>
>
>     There is a dedicated intersection function:
>
>     http://doc.cgal.org/latest/Kernel_23/group__intersection__linear__grp.html
>     <http://doc.cgal.org/latest/Kernel_23/group__intersection__linear__grp.html>
>
>     you can do something like this:
>
>     typedef CGAL:Exact_predicates_exact_construtions_kernel K;
>     typedef K::Plane_3 Plane_3;
>     typedef K::Point_3 Point_3;
>     typedef K::Vector_3 Vector_3;
>
>
>     Plane_3 p1(Vector_3(x,y,x), Point_3(a,b,c));
>     Plane_3 p2(.....);
>     Plane_3 p3(.....);
>
>
>     boost::optional< boost::variant< Point_3, Line_3, Plane_3 > > res =
>       CGAL::intersection(p1, p2, p3);
>
>     if (res!=boost::none)
>     {
>       if (const Point_3* pt = boost::get<Point_3>(&(*res)))
>       {
>         // pt is the intersection point of the 3 planes
>       }
>       else
>       {
>         if (const Plane_3* pl = boost::get<Plane_3>(&(*res)))
>         {
>         }
>         else
>         {
>           const Line_3* l = boost::get<Line_3>(&(*res));
>           assert(l!=NULL);
>         }
>       }
>     }
>
>     Sebastien.
>
>
>
>     --
>     You are currently subscribed to cgal-discuss.
>     To unsubscribe or access the archives, go to
>     https://sympa.inria.fr/sympa/info/cgal-discuss
>     <https://sympa.inria.fr/sympa/info/cgal-discuss>
>
>
>
>
>
> --
> Iván Otero González
> Skype: ivanoterouvigo
> Tlf. Lab. 222: 813499
> Tlf. Lab. 218: 813998
> Research Line : ARCHITECTURE AND BUILDING
>
> GeoTech
>
> /Applied Geotechnologies Research Group | Geotech__/
>
> Universidade de Vigo
>
> E.E. Minas
>
> 36310 Vigo (Spain)
>
>


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss