import ant; word-wrap: break-word !ant;">FUNC orient eulerAnglesToQuaternion(num hdg,num pitch,num roll) import
import ant; word-wrap: break-word !ant;"> //返回四元数 import
import ant; word-wrap: break-word !ant;"> VAR num cosRoll; import
import ant; word-wrap: break-word !ant;"> VAR num sinRoll; import
import ant; word-wrap: break-word !ant;"> VAR num cospitch; import
import ant; word-wrap: break-word !ant;"> VAR num sinpitch; import
import ant; word-wrap: break-word !ant;"> VAR num cosheading; import
import ant; word-wrap: break-word !ant;"> VAR num sinheading; import
import ant; word-wrap: break-word !ant;"> VAR orient orient1; import
import ant; word-wrap: break-word !ant;"> import
import ant; word-wrap: break-word !ant;"> cosRoll:=Cos(roll*0.5); import
import ant; word-wrap: break-word !ant;"> sinRoll:=Sin(roll*0.5); import
import ant; word-wrap: break-word !ant;"> cosPitch:=Cos(pitch*0.5); import
import ant; word-wrap: break-word !ant;"> sinPitch:=Sin(pitch*0.5); import
import ant; word-wrap: break-word !ant;"> cosHeading:=Cos(hdg*0.5); import
import ant; word-wrap: break-word !ant;"> sinHeading:=Sin(hdg*0.5); import
import ant; word-wrap: break-word !ant;"> import
import ant; word-wrap: break-word !ant;"> orient1.q1:=cosRoll*cosPitch*cosHeading+sinRoll*sinPitch*sinHeading; import
import ant; word-wrap: break-word !ant;"> orient1.q2:=sinRoll*cosPitch*cosHeading-cosRoll*sinPitch*sinHeading; import
import ant; word-wrap: break-word !ant;"> orient1.q3:=cosRoll*sinPitch*cosHeading+sinRoll*cosPitch*sinHeading; import
import ant; word-wrap: break-word !ant;"> orient1.q4:=cosRoll*cosPitch*sinHeading-sinRoll*sinPitch*cosHeading; import
import ant; word-wrap: break-word !ant;"> RETURN orient1; import
import ant; word-wrap: break-word !ant;"> ENDFUNC import
import ant; word-wrap: break-word !ant;"> import
import ant; word-wrap: break-word !ant;"> FUNC num quaternionToEulerAngles(\switch X|switch Y|switch Z,orient orient1) import
import ant; word-wrap: break-word !ant;"> //返回欧拉角 import
import ant; word-wrap: break-word !ant;"> VAR num q0 import
import ant; word-wrap: break-word !ant;"> VAR num q1; import
import ant; word-wrap: break-word !ant;"> VAR num q2; import
import ant; word-wrap: break-word !ant;"> VAR num q3; import
import ant; word-wrap: break-word !ant;"> q0:=orient1.q1; import
import ant; word-wrap: break-word !ant;"> q1:=orient1.q2; import
import ant; word-wrap: break-word !ant;"> q2:=orient1.q3; import
import ant; word-wrap: break-word !ant;"> q3:=orient1.q4; import
import ant; word-wrap: break-word !ant;"> IF present(x) return atan2(2*(q2*q3+q0*q1),q0*q0-q1*q1-q2*q2+q3*q3); import
import ant; word-wrap: break-word !ant;"> IF present(y) return asin(2*(q0*q2-q1*q3)); import
import ant; word-wrap: break-word !ant;"> IF present(z) RETURN atan2(2*(q1*q2+q0*q3),q0*q0+q1*q1-q2*q2-q3*q3); import
import ant; word-wrap: break-word !ant;"> //roll=atan2f(2. f*(q2q3+q0q1),q0q0-q1q1-q2q2+q3q3); import
import ant; word-wrap: break-word !ant;"> //pitch=asinf(2. f*(q0q2-q1q3)); import
import ant; word-wrap: break-word !ant;"> //yaw=atan2f(2. f*(q1q2+q0q3),q0q0+q1q1-q2q2-q3q3); import
import ant; word-wrap: break-word !ant;"> ENDFUNC import
新闻中心