Okay. Do you have any suggestions for how I might turn two lean-angles into a quaternion, and then use that to project points on the line? I don't want to make the annealer find the solution itself. It's more precise my way, and the annealer already has enough wildcard variables to solve for.Polygonhell wrote:You use the X and Y portions of the vector as the inputs to the annealer rather than the angles, you compute Z as sqrt(X*X + Y*Y).
If you want to clamp X and Y to reasonable values you clamp them to the sin of the desired angle so for say +/- 10 degrees you's clamp abs(X) and Y to be < 0.17364817766
Your optimizer should end up with approximate tower vectors, but you need to phrase the other math in terms of the tower vectors rather than the angles, I suspect that you will find the other math turns out easier/cheaper without the angles. All the sin/cos stuff just goes away and you end up with a bunch of dot and cross products instead.
What this doesn't let you do is deal with tower rotation in addition for that you need to use a quaternion, the trivial explanation of a quat is it's basically equivalent to a rotation about an arbitrary axis, and in fact toy can trivially compute one from that, but that's a somewhat toy explanation.
When I worked in games we always said if you deal with geometry and convert it to angles to solve a problem you're doing it wrong.
Working on tower lean - could use some trig help!
Re: Working on tower lean - could use some trig help!
Questions? Ask in a thread - PMs are off.
AI Calibration | Dimensional Accuracy Calibration | Hand-Tune your PID | OctoPi + Touchscreen setup | My E3D hot end mount, Z probe, fan ducts, LED ring mount, filament spool holder, etc.
AI Calibration | Dimensional Accuracy Calibration | Hand-Tune your PID | OctoPi + Touchscreen setup | My E3D hot end mount, Z probe, fan ducts, LED ring mount, filament spool holder, etc.
Re: Working on tower lean - could use some trig help!
I found some source code to turn angles into a quaternion:
I suppose I would use X and Y lean as "heading" and "attitude", and for the bank, the Z axis, which I suppose would be 90. Does that look right?
Code: Select all
public final void rotate(double heading, double attitude, double bank) {
double c1 = Math.cos(heading/2);
double s1 = Math.sin(heading/2);
double c2 = Math.cos(attitude/2);
double s2 = Math.sin(attitude/2);
double c3 = Math.cos(bank/2);
double s3 = Math.sin(bank/2);
double c1c2 = c1*c2;
double s1s2 = s1*s2;
w =c1c2*c3 - s1s2*s3;
x =c1c2*s3 + s1s2*c3;
y =s1*c2*c3 + c1*s2*s3;
z =c1*s2*c3 - s1*c2*s3;
}
Questions? Ask in a thread - PMs are off.
AI Calibration | Dimensional Accuracy Calibration | Hand-Tune your PID | OctoPi + Touchscreen setup | My E3D hot end mount, Z probe, fan ducts, LED ring mount, filament spool holder, etc.
AI Calibration | Dimensional Accuracy Calibration | Hand-Tune your PID | OctoPi + Touchscreen setup | My E3D hot end mount, Z probe, fan ducts, LED ring mount, filament spool holder, etc.
-
- ULTIMATE 3D JEDI
- Posts: 2417
- Joined: Mon Mar 26, 2012 1:44 pm
- Location: Redmond WA
Re: Working on tower lean - could use some trig help!
The code looks right, I'd pick my axis so that a perfectly aligned tower is at 0 degrees offset in in all 3 or Roll Pitch and Yaw. i.e. it's the identity Quat (1,0,0,0).
Printer blog http://3dprinterhell.blogspot.com/