Reference vector of AcDbArc

Reference vector of AcDbArc

Anonymous
Not applicable
1,247 Views
6 Replies
Message 1 of 7

Reference vector of AcDbArc

Anonymous
Not applicable

Hello!

 

I am trying to get the reference vector of a circular arc.

 

The only information I found is:

AcDbArc* arc = AcDbArc::cast( pEnt );
AcGeVector3d refVec = arc->normal()->perpVector();

However, I was expecting a method to give back the reference vector.

Could somebody help me?

 

Kind regards,

Evangelos

0 Likes
Accepted solutions (1)
1,248 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

In the end I computed the Arbitrary X axis based on the following article:

https://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-E19E5B42-0CC7-4EBA-B29F-5E1D595149EE

 

Now, I am not facing any problems with my arcs.

 

However, I am still curious to know why there is not a method to compute it directly?

 

Evangelos

0 Likes
Message 3 of 7

tbrammer
Advisor
Advisor
Accepted solution
AcGeVector3d refVec = arc->normal()->perpVector();

AcGeVector3d::perpVector() also uses the arbitrary axis algorithm. This is the usual way to determine the reference vector.

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 4 of 7

Anonymous
Not applicable

Dear tbammer,

 

Thank you very much for your reply.

 

I always need to use the OCS X axis as the reference vector. So, I created a small function to compute it, based on the documentation:

 

If (abs (Nx) < 1/64) and (abs (Ny) < 1/64) then
     Ax = Wy X N (where X is the cross-product operator).
Otherwise,
     Ax = Wz X N.

To clarify, I would like to ask: Nx and Ny are the coordinates of normal N?

 

The perpVector indeed returns a reference vector but not the one I need.

 

Kind regards,

Evangelos

 

 

0 Likes
Message 5 of 7

tbrammer
Advisor
Advisor

@Anonymouswrote:

To clarify, I would like to ask: Nx and Ny are the coordinates of normal N?

The perpVector indeed returns a reference vector but not the one I need.


Yes. N is the normal (Nx,Ny,Nz). N must be normalized to a length of 1 if you use your algorithm.

This algorithm is the "Arbitrary Axis Algorithm". It is used by N.perpVector(). Note that perpVector() does not require N to be normalized.

What do you mean by "the returned vector is not the reference vector that you need"? What is wrong with it?

Can you post a sample DWG and your code to clarify?


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 6 of 7

Anonymous
Not applicable

Perhaps I misunderstood the documentation.

What you are saying is that the perVector of a normal vector will return the OCS X axis?

0 Likes
Message 7 of 7

tbrammer
Advisor
Advisor

Yes. See also the docs for AcDbArx::startAngle()


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes