Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Close

.NET

- Autodesk Community
- >
- AutoCAD Customization
- >
- .NET
- >
- Re: How to obtain the angle between two vector3d? ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

615 Views, 5 Replies

07-19-2011 07:46 PM

Hello,I define a vextor via two points(ptStart and ptDirection).And now I want to get the angle between my vector3d and the X Axis.Here is my code:

Dim Ang As Double = ptStart.GetVectorTo(ptDirection).GetAngleTo(Vector

But the range is 0-PI.How can I change it to 0-2PI?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-20-2011 10:12 AM in reply to:
waterharbin

Hi,

I see there is another version of this method:

Vector3d.GetAngleTo Method (Vector3d, Vector3d)

Returns the angle between this vector and the vector vector in the range [0, 2 x Pi].

Please, find its description in the Managed Class Reference Guide (\ObjectARX 2012\docs\arxmgd.chm).

Developer Technical Services

Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-25-2011 05:17 AM in reply to:
waterharbin

Hi! Try this.

double Ang = ptStart.GetVectorTo(ptDirection).GetAngleTo(Vector3d.XAxis, Vector3d.ZAxis.Negate());

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-30-2011 03:21 AM in reply to:
BabylonLion

Nice code.haha.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-07-2011 09:00 AM in reply to:
Marat.Mirgaleev

hi marat

although i do not want to spoil the party, i desperately fail to obtain any angles above the 0-pi interval. i admit i still use autocad 2011, however, the documentation for the .getangleto(vec; vecref) appears as you state.

considering the problem, i could do myself with some clarification as to how it's supposed to work:

starting with a vector3d, i look for the angle to another vector3d. to keep things simple, let's say they both originate in the same point and 'point away' from it in separate directions. why is there an optional reference-vector3d? if it's only to expand the interval from 0-pi to 0-2*pi, then an optional boolean would have been satisfactory.

many thanks, felix

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-07-2011 09:15 AM in reply to:
FFlix

yes of course, as soon as i posted it...

to whom it may concern

the additional vecref can be used to define [or fixate] that one dimension of the three (in 3d) that leaves the other two to span the plane in which the angle is measured. in turn it means that the option without the vecref leaves it completely to the two original vectors, i.e. the calling one and the parameter one, to define a plane and the angle within, which also explains why then with the information given it is not possible to give angles above pi, because 'they technically then do not exist'.

hope you enjoyed the show

felix

Search This Board

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Announcements

The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.

- Privacy | Legal Notices & Trademarks | Report Noncompliance | Site map | © Copyright 2014 Autodesk Inc. All rights reserved

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ for more information.