How to get true north direction in XYZ?

How to get true north direction in XYZ?

prasannamurumkar
Advocate Advocate
1,561 Views
5 Replies
Message 1 of 6

How to get true north direction in XYZ?

prasannamurumkar
Advocate
Advocate

Requirement is to get angle between the roof element face orientation with true north.

 

Want to get true north direction in XYZ beacause i am having face normal direction in XYZ so i can use angle to Api to get angle.

 

 

 

Able to get projectPostion and other things.

ProjectPosition projectPosition = projectLocation.GetProjectPosition(XYZ.Zero);
double angleProject = projectPosition.Angle;

Also got east/west ,south/north.

im1.png

 

 

but from that not sure how to get direction of true north in XYZ could anyone help?.

0 Likes
Accepted solutions (1)
1,562 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni
Accepted solution

You can look at the DirectionCalculation SDK sample and its module FindSouthFacingWalls.cs.

  

It is discussed in various places by The Building Coder:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 6

prasannamurumkar
Advocate
Advocate

Thank you for reply.

Now testing below code for getting true north  may be this will work.

Here assumption is our project north is always upward (new XYZ(0,1,0) and then taken translation and rotation.

From that if we want the true north tried to use below lines:

 

ProjectPosition projectPosition = projectLocation.GetProjectPosition(new XYZ(0,0,0));
Transform rotationTransform = Transform.CreateRotation(
new XYZ(0,0,1) , projectPosition.Angle);

XYZ translationVector = new XYZ(projectPosition.EastWest, projectPosition.NorthSouth, projectPosition.Elevation);
Transform translationTransform = Transform.CreateTranslation(translationVector);
Transform finalTransform = translationTransform.Multiply(rotationTransform);

XYZ pointTrueNorth= finalTransform.OfPoint(new XYZ(0, 1, 0));

 

Could anyone tell whether i am proceeded in right direction?.

0 Likes
Message 4 of 6

mhannonQ65N2
Collaborator
Collaborator

For your last line, you should be using OfVector instead of OfPoint because the XYZ for true north is a vector, not a point.

Message 5 of 6

prasannamurumkar
Advocate
Advocate

thanks.

0 Likes
Message 6 of 6

prasannamurumkar
Advocate
Advocate

thank you.

0 Likes