Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Angle between vectors

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Angle between vectors


Chronological Thread 
  • From: Martin Baeker <>
  • To:
  • Subject: Re: [cgal-discuss] Angle between vectors
  • Date: Tue, 5 Jun 2007 09:03:04 +0200 (CEST)
  • Organization: Institut fuer Werkstoffe TU Braunschweig

> I need to compute the angle between two vectors. I've got two Vector_3
> objects and I was thinking to compute their dot product and then divide
> this by the product of the magnitude of the two vectors. The problem is
> that I can't evaluate the sqrt of the sum of the squared components of
> the vectors. Is there an in-built function that computes the magnitude
> of a vector.

In principle, you shoul dbe able to calculate the sqrt. Make sure that
you convert your numbers to double:
sqrt(CGAL::to_double( X)).

Be aware, however, that you loose the arbitrary precision and enter
the irrational...


>
> Another possibility would be using Direction_3, but it seems that there
> is no dot product defined for this object.
> Anyway, if I transform my vectors into Direction_3 objects and then I
> transform the Direction_3 objects into vector do I end up with unit
> vectors? In this case I could easily evaluate the dot product of these
> vectors and I have solved my problems.
> Thank You
> Angelo
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>

Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
e-mail
<>




  • Angle between vectors, Tardugno, Angelo, 06/04/2007
    • Re: [cgal-discuss] Angle between vectors, Martin Baeker, 06/05/2007

Archive powered by MHonArc 2.6.16.

Top of Page