[vtkusers] How to get angle between two 3D points

Marco Nawijn nawijn at gmail.com
Mon Apr 22 11:05:48 EDT 2013


As the other Marco already mentioned, you need at least three points (or 2
vectors) to calculate the angle between them.
If you have them, you can simply apply the cosine rule which states (in
words):
the cosine of the angle between two vectors is the dot product of the
vectors divided by the their lengths multiplied.
so in math:
                          dot(a,b)
   cos(angle) =   -----------
                        norm(a)*norm(b)

I have not checked it, but I guess vtk will have buildin functions for
calculating dot (or inner) products and norms.
Take a look at the functionality provided in the vtkMath library.

Kind regards,

(another) Marco




On Mon, Apr 22, 2013 at 10:23 AM, Marco Sambin <m.sambin at gmail.com> wrote:

> Hi.
> In order to define an angle, you will need at least THREE points. Is the
> third point the origin (0,0,0) in your case?
> I guess you will need to identify the plane "containing" those three
> points, and then you will be able to compute the angle on that plane, in a
> "2D fashion".
> Regards,
>
> Marco
>
>
>
> On Mon, Apr 22, 2013 at 10:19 AM, Arindam <arindam at triassicsolutions.com>wrote:
>
>>  Hi,
>>
>> I want to calculate angle between two 3D points.Suppose the points are
>> (5,5,5) and (1,2,3). For 2D points i know how can i do this.But for 3D
>> points i need help from some one.Any help will be appreciated.
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130422/605c4614/attachment.htm>


More information about the vtkusers mailing list