AngleAboutAxis in C#

AngleAboutAxis in C#

vanlion
Advocate Advocate
820 Views
4 Replies
Message 1 of 5

AngleAboutAxis in C#

vanlion
Advocate
Advocate

Hi,

 

I'm trying to get the same result from the dynamo node vector.AngleAboutAxis in dynamo with the following code in C#. But the result isn't the same as you can see under the dynamo node and my C# results. Does anybode know how to do this in C#? 

 

 

rotateAxis.PNG

// new XYZ from average point
XYZ pA = new XYZ(averageX, averageY, 0);  
XYZ pB = new XYZ(averageX-100, averageY, 0);

 XYZ res = pA - pB;

//Other vector from all points foreach (XYZ d1 in coord) { XYZ vv = res -d1; double angle = vv.AngleTo(res); double resultAngle = angle * 180 / (Math.PI); }

C# result.PNG

0 Likes
821 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Please explain exactly what you are trying to achieve.

 

Does anybody know how to do this in C#? 

 

'This' is not clear to me. 

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

vanlion
Advocate
Advocate

Hi Jeremy,

 

I already found how to do this in C#. In the picture below you can see how to translate the Vector.AngleAboutAxis in dynamo. With this diagram (in yellow) it is very easy to make the convertion to C#.

 

DynamoToC#.PNG

0 Likes
Message 4 of 5

dhanait_ajay13
Enthusiast
Enthusiast
can you please share the code with me? how we can convert
Message 5 of 5

jeremy_tammik
Alumni
Alumni

For me, it would be easier if you describe exactly what you are trying to achieve in pure geometric terms, since I am not familiar with the Dynamo node that you refer to. It is probably really simple and a standard operation, but which one?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes