Comments (5)
Sounds interesting, thanks for creating the issue.
@MaLiN2223 what do you think?
from mathnet-spatial.
Yeah, why not? Expanding is mostly a good idea especially if one have need.
@djowatts could you provide example or some related books? It's very interesting.
How can I help you with it?
from mathnet-spatial.
The code I have using the .Net Numerics stuff is as follows
var roty = Quaternion.Normalize(new Quaternion(0.0f, 0.0f, (float)Math.Sin(rpy.Z / 2.0), (float)Math.Cos(rpy.Z / 2.0))); // yaw is rotation around Z axis
var rotp = Quaternion.Normalize(new Quaternion(0.0f, (float)Math.Sin(rpy.Y / 2.0), 0.0f, (float)Math.Cos(rpy.Y / 2.0))); // pitch is rotation around Y axis
var rotr = Quaternion.Normalize(new Quaternion((float)Math.Sin(rpy.X / 2.0), 0.0f, 0.0f, (float)Math.Cos(rpy.X / 2.0))); // roll is rotation around X axis
//apply in order of roll, pitch, then yaw
var first = rotp.RotateRotationQuat(rotr);
var second = roty.RotateRotationQuat(first);
return second;
And here is some test data to help you verify
yield return new object[]
{
new Vector3(2.1114570353895603f, -2.585985022981525f, 0.6664081165354347f), // rpy
new Quaternion(0.3804738214831853f, -0.3695932081905471f, 0.8350484129621588f, -0.14606395734328323f) // expected quat
};
yield return new object[]
{
new Vector3(1.2221363972810417f, 2.7458063901769885f, -1.1425980259781825f),
new Quaternion(0.5291170318308547f, 0.6145316070072362f, -0.5602830425963242f, -0.16872754011902086f)
};
yield return new object[]
{
new Vector3(-1.1211016954494437f, -0.004126944712585345f, 1.9222979397169384f),
new Quaternion(-0.30297942912094916f, -0.4368753181928898f, 0.6937524685292732f, 0.4858507325228037f)
};
I'll have a root around and see if I can find the materials we used when writing this and get back to you
from mathnet-spatial.
If you think quaternions are the sh*t, check out geometric algebra ;)!
from mathnet-spatial.
I did some research and in my opinion this is no good idea to put any euler angles (a.k.a. roll, pitch, yaw) to this library - the reason for it is that there at least two possible representations for the same rotation see: this link
I have implemented this approach already and I am ready to make a pull request however it will not be compatibile with already written method (ToEulerAngles()) because (as it appears) I am using different algorithm.
and since it would be suprise to users if they would start getting different results after library update I do not think that is recommended.
Ofcourse for sake of compatibility I can implement a wikipedia's version of the algorithm however I cannot vouch if it is a propper one.
Furthermore I would advise to remove ToEulerAngles() method entirely just to avoid confusion.
from mathnet-spatial.
Related Issues (20)
- No 1D line segment support HOT 3
- Plane created from three points returns different result for Equals depending on the order of the points HOT 5
- Readme's Docs link broken
- LineSegment3D.TryShortestLineTo throws when segments intersect HOT 1
- Circle2D.FromPoints gives incorrect results for special cases.
- LineSegment2D - TryIntersect - should this return the intersection of lines or line segments? HOT 3
- Rotation(yaw, pitch, roll) uses extrinsic rotations
- Support for Matrix4D HOT 1
- Suggestion: Plane.TryFromPoints() HOT 3
- Checking for equal input points in Plane.FromPoints() is redundant? HOT 2
- I would like to contribute to the project HOT 5
- Website copyright date is not current
- Vector2D.SignedAngleTo returns bad angle result (fix described)
- Cross product error checks are different depending on whether you pass it a UnitVector3D or a Vector3D HOT 3
- CoordinateSystem: System.TypeInitializationException HOT 1
- Question: still active?
- The API on the official website is down
- Version 0.7.0 not available on Nuget HOT 7
- Why let the X, Y, Z readonly? HOT 2
- MathNet.Spatial.Euclidean.Line3D retruns UnExpected NULL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathnet-spatial.