# Quaternion.GetRotation() method not found in Rhino3dm 7.7.0 nuget

I am working on a C# Windows .Core solution (not NET Framework) and therefore am using the latest rhino3dm nuget library v7.7.0.

I need to transform a brep by a quaternion and therefore wish to obtain the rotation from the quaternion using:
Quaternion.GetRotation(out angle, out axis)

Visual Studio reports that the method cannot be found.
I can see that it is present in the latest github page: rhino3dm/opennurbs_quaternion.cs at e3c3c128ccedbdc502236c6646347514106dcad6 · mcneel/rhino3dm · GitHub

here it is:

``````    public bool GetRotation(out double angle, out Vector3d axis)
{
double s = Length;
angle = (s > double.MinValue) ? 2.0*Math.Acos(m_a/s) : 0.0;
axis.m_x = m_b;
axis.m_y = m_c;
axis.m_z = m_d;
return (axis.Unitize() && s > double.MinValue);
}
``````

Unfortunately a straight copy-paste won’t compile due to other changes to the classes, but here is a slight tweak to make a similar method that does work in the meanwhile until the code is released on nuget…

``````        public static bool RhinoQuaternion_GetRotation(this Rhino.Geometry.Quaternion q, out double angle, out Vector3d axis)
{
double s = Math.Sqrt(q.LengthSquared);
angle = (s > double.MinValue) ? 2.0 * Math.Acos(q.A / s) : 0.0;
axis =  Vector3d.Unset;
axis.X = q.B;
axis.Y = q.C;
axis.Z = q.D;
return (axis.Unitize() && s > double.MinValue);
}
``````

Hope that helps someone else.
Regards
Dan

Hi @MonkeyFace,

What you missed is this line:

Which indicates a Rhino-only build.

Seems like a flaw to me, since all the calculation are either coded in C# or are found in openNURBS. I’ve logged this to have a closer look.

https://mcneel.myjetbrains.com/youtrack/issue/RH-65724

– Dale

1 Like

Yeah I didn’t miss it as such - a lot of the class was marked in this fashion and I didn’t know how to mark my project as RHINO_SDK=true (and more importantly I didn’t know what the implications of marking my project in this manner might have) which is why I went with the quick and transparent option of slightly modifying the method.

Thank you for resolving this for the next release of Rhino3dm
dan

Quaternion.GetRotation is now available in the latest version of rhino3dm on nuget (7.11.0)

1 Like