Skip to Content.
Sympa Menu

cgal-discuss - Re: [?? Probable Spam] [cgal-discuss] Calculate angle

Subject: CGAL users discussion list

List archive

Re: [?? Probable Spam] [cgal-discuss] Calculate angle


Chronological Thread 
  • From: "Max" <>
  • To: "" <>
  • Subject: Re: [?? Probable Spam] [cgal-discuss] Calculate angle
  • Date: Tue, 26 Aug 2008 09:29:30 +0800
  • Organization: Max

>Hello,
>I want to get the angle value between three points but I only find the angle
>function that returns only the type of the angle.
>I would like to know if there is another function to help in this task.
>
try this

Point p1, p2, p3;
Vector v1 = p1-p2;
v1 = v1 / std::sqrt( v1 * v1);
Vector v2 = p3-p2;
v2 = v2 / std::sqrt( v2 * v2);

double angle = std::acos( v1 * v2 ) / CGAL_PI * 180;

any pre-condition checking code is omitted here.

B/Rgds
Max





Archive powered by MHonArc 2.6.16.

Top of Page