How to get horizontal compnent of vector if angle is known?

How to get horizontal compnent of vector if angle is known?

prasannamurumkar
Advocate Advocate
628 Views
3 Replies
Message 1 of 4

How to get horizontal compnent of vector if angle is known?

prasannamurumkar
Advocate
Advocate

I have roof i want to get direction of vector along the surface towards end point of roof.

I have following:

1.Surface normal

2.Required Angles.

3.end point of roof.

(Shared in below image)

I have tried by following way:

Since i have vetor surface normal and Z axis And Angle:

double angleBetweenFaceNormalAndZaxis = normalDirectionOfFace.AngleTo(XYZ.BasisZ);
XYZ normalDirectionOfFaceAlongZaxis= (normalDirectionOfFace) * (Math.Cos(angleBetweenFaceNormalAndZaxis));

 

but vector direction not modified when i have drawn line along above vector(normalDirectionOfFaceAlongZaxis).

DIrection is remains as normalDirectionOfFace?

 

IS their anyone knows how do we get vector direction per our requirement?

-----------------------------------------------------------------------------------------------------------

As shown in below image i have calculated following things:

Roof.png

1.t1,t2 angle

2.distance of roof

3.endpointof roof

unknown:

i want to calculate the start point of roof?

 

my thinking is if i get direction along surface i can get solution?

 

 

 

0 Likes
Accepted solutions (1)
629 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni
Accepted solution

If you have the normal vector vN of the roof, all vectors that are perpendicular to that will be parallel to the roof surface.

 

To find the vector pointing "upwards" (towards the Z direction) "as much as possible", you can calculate the vector product between the roof normal vN and a horizontal vector vH that is also parallel to the roof surface.

 

To determine H, I believe that you can calculate the vector product of the Z axis vZ with vN.

 

So, to find your desired vector v "upwards" along the roof, you can say:

 

  vH = vZ x vN
  v = vH x vN

 

Read more about the cross product and all will become clear:

 

https://en.wikipedia.org/wiki/Cross_product

  

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

prasannamurumkar
Advocate
Advocate

Thank you so much.

0 Likes
Message 4 of 4

prasannamurumkar
Advocate
Advocate

Thank you so much.

0 Likes