PageRenderTime 399ms queryTime 50ms sortTime 1ms getByIdsTime 242ms findMatchingLines 41ms

100+ results results for 'quaternion' (399 ms)

Not the results you expected?
mpu9150.c https://bitbucket.org/rui_araujo/edvsboardos.git | C | 416 lines
                    
39static short magnometer_data[3];/* 3 axis compass data from the IMU*/
                    
40static long quaternion[4];/* 4d quaternion data from the IMU DMP*/
                    
41static unsigned long sensor_timestamp;
                    
187
                    
188void QuaternionReport() {
                    
189	readFromMpl(QUARTERNION);
                    
212	if (mpuEnabled && Chip_GPIO_ReadPortBit(LPC_GPIO_PORT, MPU_INT_GND_PORT_GPIO, MPU_INT_GND_PIN_GPIO)) {
                    
213		if (dmp_read_fifo(gyrometer_data, accelerometer_data, quaternion, &sensor_timestamp, &sensors, &more)) {
                    
214			return;
                    
224		inv_build_accel(converter, 0, sensor_timestamp);
                    
225		inv_build_quat(quaternion, 0, sensor_timestamp);
                    
226		for (int i = 0; i < 3; i++) {
                    
256
                    
257		/* Compute 6-axis and 9-axis quaternions. */
                    
258		inv_enable_quaternion();
                    
                
loadview.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 383 lines
                    
53     _ged_cm_vrot,	17, 17},
                    
54    {"orientation", "quaternion", "set view direction from quaternion",
                    
55     _ged_cm_orientation,	5, 5},
                    
                
anim_script.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 257 lines
                    
42 /* info from command line args */
                    
43int relative_a, relative_c, axes, translate, quaternion, rotate;/*flags*/
                    
44int steer, view, readview, permute; /* flags*/
                    
89			val=scanf("%lf %lf %lf", point, point+1, point+2);
                    
90		if(rotate&&quaternion){
                    
91			val = scanf("%lf %lf %lf %lf", quat,quat+1,quat+2,quat+3);
                    
106			go = anim_steer_mat(a,point,last_steer); /* warning: point changed by anim_steer_mat */
                    
107		else if (quaternion) {
                    
108			anim_quat2mat(a,quat);
                    
114
                    
115		/* if input orientation (presumably from quaternion) was
                    
116		 * designed to manipulate the view, first move the object
                    
171	rotate = translate = 1; /* defaults */
                    
172	quaternion = permute = 0;
                    
173	strcpy(mat_cmd, "lmul");
                    
                
vrpn_Tracker_ViewPoint.C https://gitlab.com/sat-metalab/vrpn | C | 225 lines
                    
27//              
                    
28//              Rotation: The (x,y) gaze angle as a quaternion (smoothed or raw).
                    
29//              
                    
164
                    
165		// Convert the gaze angle to a quaternion
                    
166		q_from_euler(d_quat, 0.0, Q_DEG_TO_RAD(ga.y), Q_DEG_TO_RAD(ga.x));
                    
                
anim_keyread.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 167 lines
                    
27 *
                    
28 * default - quaternions in the order x, y, z, w.
                    
29 *
                    
54#define XYZ 1
                    
55#define QUATERNION 2
                    
56
                    
74
                    
75    mode = QUATERNION; /* default */
                    
76    units = DEGREES;
                    
86	    case 'q':
                    
87		mode = QUATERNION;
                    
88		break;
                    
149	    printf("%.10g\t%.10g\t%.10g\n", angle[X], angle[Y], angle[Z]);
                    
150	} else if (mode==QUATERNION) {
                    
151	    anim_mat2quat(quat, viewrot);
                    
                
axisRotationMotion.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 108 lines
                    
84    scalar magOmega = mag(omega);
                    
85    quaternion R(omega/magOmega, magOmega);
                    
86    septernion TR(septernion(origin_)*R*septernion(-origin_));
                    
                
AHRS.c https://bitbucket.org/mituav/udb3_quadrotor_control.git | C | 330 lines
                    
270
                    
271    // Finally get quaternion
                    
272    tQuaternion qroll,qpitch,qyaw;
                    
299
                    
300volatile tQuaternion qerr;
                    
301void AHRS_ZeroCorrect( void )
                    
                
ckgr01.c https://github.com/mattbornski/spice.git | C | 403 lines
                    
110
                    
111/*                The quantities q0 - q3 represent a quaternion. */
                    
112/*                The quantities Av1, Av2, and Av3 represent the */
                    
317/*        QSIZ       is the number of double precision numbers making up */
                    
318/*                   the quaternion portion of a pointing record. */
                    
319
                    
320/*        QAVSIZ     is the number of double precision numbers making up */
                    
321/*                   the quaternion and angular velocity portion of a */
                    
322/*                   pointing record. */
                    
                
TwSimpleGLUT.c https://gitlab.com/dannywillems/mass_collide | C | 344 lines
                    
42float g_Zoom = 1.0f;
                    
43// Shape orientation (stored as a quaternion)
                    
44float g_Rotation[] = { 0.0f, 0.0f, 0.0f, 1.0f };
                    
56
                    
57// Routine to set a quaternion from a rotation axis and angle
                    
58// ( input axis = float[3] angle = float  output: quat = float[4] )
                    
58// ( input axis = float[3] angle = float  output: quat = float[4] )
                    
59void SetQuaternionFromAxisAngle(const float *axis, float angle, float *quat)
                    
60{
                    
70
                    
71// Routine to convert a quaternion to a 4x4 matrix
                    
72// ( input: quat = float[4]  output: mat = float[4*4] )
                    
72// ( input: quat = float[4]  output: mat = float[4*4] )
                    
73void ConvertQuaternionToMatrix(const float *quat, float *mat)
                    
74{
                    
                
hid-sensor-rotation.c https://github.com/andikleen/linux-misc.git | C | 372 lines
                    
21	struct hid_sensor_common common_attributes;
                    
22	struct hid_sensor_hub_attribute_info quaternion;
                    
23	struct {
                    
38		.modified = 1,
                    
39		.channel2 = IIO_MOD_QUATERNION,
                    
40		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
                    
171
                    
172	if (usage_id == HID_USAGE_SENSOR_ORIENT_QUATERNION) {
                    
173		memcpy(&rot_state->scan.sampled_vals, raw_data,
                    
197				usage_id,
                    
198				HID_USAGE_SENSOR_ORIENT_QUATERNION,
                    
199				&st->quaternion);
                    
203	dev_rot_adjust_channel_bit_mask(&channels[0],
                    
204		st->quaternion.size / 4);
                    
205
                    
                
transformPoints.C https://github.com/lakeatmt/OpenFOAM-1.7.x.git | C | 288 lines
                    
226
                    
227        quaternion R(v.x(), v.y(), v.z());
                    
228
                    
228
                    
229        Info<< "Rotating points by quaternion " << R << endl;
                    
230        points = transform(R, points);
                    
253
                    
254        quaternion R = quaternion(vector(0, 0, 1), yaw);
                    
255        R *= quaternion(vector(0, 1, 0), pitch);
                    
255        R *= quaternion(vector(0, 1, 0), pitch);
                    
256        R *= quaternion(vector(1, 0, 0), roll);
                    
257
                    
257
                    
258        Info<< "Rotating points by quaternion " << R << endl;
                    
259        points = transform(R, points);
                    
                
qmath.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 402 lines
                    
32 *
                    
33 *  Additions inspired by "Quaternion Calculus For Animation" by Ken Shoemake,
                    
34 *  SIGGRAPH '89 course notes for "Math for SIGGRAPH", May 1989.
                    
183 *
                    
184 * Gives the quaternion point representing twice the rotation
                    
185 *   from q1 to q2.
                    
205 *
                    
206 * Gives the bisector of quaternions q1 and q2.
                    
207 * (Could be done with quat_slerp and factor 0.5)
                    
221 *
                    
222 * Do Spherical Linear Interpolation between two unit quaternions
                    
223 *  by the given factor.
                    
308 *
                    
309 *  Set the quaternion q1 to the quaternion which yields the
                    
310 *   smallest rotation from q2 (of the two versions of q1 which
                    
                
qmath.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 390 lines
                    
49 *
                    
50 *  Additions inspired by "Quaternion Calculus For Animation" by Ken Shoemake,
                    
51 *  SIGGRAPH '89 course notes for "Math for SIGGRAPH", May 1989.
                    
178 *@brief
                    
179 * Gives the quaternion point representing twice the rotation
                    
180 *   from q1 to q2.
                    
198 *@brief
                    
199 * Gives the bisector of quaternions q1 and q2.
                    
200 * (Could be done with quat_slerp and factor 0.5)
                    
212 *@brief
                    
213 * Do Spherical Linear Interpolation between two unit quaternions
                    
214 *  by the given factor.
                    
293 *@brief
                    
294 *  Set the quaternion q1 to the quaternion which yields the
                    
295 *   smallest rotation from q2 (of the two versions of q1 which
                    
                
bunnygut.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 282 lines
                    
35Vector model_position;         // position of bunny
                    
36Quaternion model_orientation;  // orientation of bunny
                    
37
                    
163        model_position    = Vector(0,0,-3);
                    
164        Quaternion yaw(Vector(0,1,0),-3.14f/4);    // 45 degrees
                    
165        Quaternion pitch(Vector(1,0,0),3.14f/12);  // 15 degrees
                    
266        glTranslatef(model_position.x,model_position.y,model_position.z);
                    
267        // Rotate by quaternion: model_orientation
                    
268        Vector axis=model_orientation.axis();
                    
                
sh_Nfbm.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 280 lines
                    
237
                    
238	/* form quaternion to rotate Normal to new location */
                    
239	VCROSS(q, up, v_noise);
                    
                
parse_hname2.c https://gitlab.com/oded/kamailio | C | 293 lines
                    
118
                    
119#define FIRST_QUATERNIONS       \
                    
120        case _via1_: via1_CASE; \
                    
191	switch(val) {
                    
192	FIRST_QUATERNIONS;
                    
193
                    
                
AHRS.c https://bitbucket.org/mituav/udb3_quadrotor_control.git | C | 283 lines
                    
256
                    
257    // Finally get quaternion
                    
258    tQuaternion qroll,qpitch,qyaw;
                    
                
arcball.c https://gitlab.com/marcelosabino/gimp | C | 510 lines
                    
206
                    
207/* Return quaternion product qL * qR.  Note: order is important! */
                    
208/* To combine rotations, use the product Mul(qSecond, qFirst),   */
                    
223
                    
224/* Construct rotation matrix from (possibly non-unit) quaternion. */
                    
225/* Assumes matrix is used to multiply column vector on the left:  */
                    
246
                    
247/* Return conjugate of quaternion. */
                    
248/* =============================== */
                    
427
                    
428/* Construct a unit quaternion from two points on unit sphere */
                    
429/* ========================================================== */
                    
442
                    
443/* Convert a unit quaternion to two points on unit sphere */
                    
444/* ====================================================== */
                    
                
quaternion.c https://gitlab.com/Mr.Tomato/smooth-drawing | C | 582 lines
                    
35///< Returns pOut, sets pOut to the conjugate of pIn
                    
36kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
37{
                    
46///< Returns the dot product of the 2 quaternions
                    
47const kmScalar kmQuaternionDot(const kmQuaternion* q1, const kmQuaternion* q2)
                    
48{
                    
57///< Returns the exponential of the quaternion
                    
58kmQuaternion* kmQuaternionExp(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
59{
                    
471
                    
472kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
473{
                    
478
                    
479kmQuaternion* kmQuaternionAdd(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2)
                    
480{
                    
                
cpx_vec.c https://gitlab.com/oytunistrator/QuIP | C | 389 lines
                    
180
                    
181#ifdef QUATERNION_SUPPORT
                    
182
                    
182
                    
183/* Quaternions */
                    
184
                    
234
                    
235// Quaternion division is like complex division:  q1 / q2 = q1 * conj(q2) / maqsq(q2)
                    
236// Conjugation negates all three imaginary components...
                    
270
                    
271/* float times quaternion */
                    
272
                    
272
                    
273// These appear to have a quaternion destination, but a real source,
                    
274// and real scalar...  what's the point?
                    
                
demo.ec https://github.com/thexa4/sdk.git | C | 432 lines
                    
23      //type = attached;
                    
24      type = attachedQuaternion;
                    
25      position = { 0, 0, -10 };
                    
105         {
                    
106            Quaternion orientation = dna.transform.orientation;
                    
107            orientation.RotateYawPitch(Degrees { (float)30*diffTime }, 0);
                    
142            {
                    
143               Quaternion a = player.transform.orientation;
                    
144               a.RotateRoll(Radians { x / 60.0f });
                    
150            if(b.right)
                    
151               player.Move({ 0, 0,-(float)diffTime * (camera.type == attachedQuaternion ? 10 : 1) * speed });
                    
152            else if(b.left)
                    
152            else if(b.left)
                    
153               player.Move({ 0, 0, (float)diffTime * (camera.type == attachedQuaternion ? 10 : 1) * speed });
                    
154
                    
                
ahrs_float_cmpl_rmat.c https://github.com/AshuLara/lisa.git | C | 282 lines
                    
74  ahrs_float_get_euler_from_accel_mag(&ahrs_float.ltp_to_imu_euler, &ahrs_aligner.lp_accel, &ahrs_aligner.lp_mag);
                    
75  /* Convert initial orientation in quaternion and rotation matrice representations. */
                    
76  FLOAT_QUAT_OF_EULERS(ahrs_float.ltp_to_imu_quat, ahrs_float.ltp_to_imu_euler);
                    
253/*
                    
254 * Compute ltp to imu rotation in euler angles and quaternion representations
                    
255 * from the rotation matrice representation
                    
                
vrpn_3Space.C https://gitlab.com/sat-metalab/vrpn | C | 266 lines
                    
111
                    
112   // Set output format to be position,quaternion
                    
113   // These are a capitol 'o' followed by comma-separated values that
                    
239
                    
240	// Quarternion orientation.  The 3Space gives quaternions
                    
241	// as w,x,y,z while the VR code handles them as x,y,z,w,
                    
242	// so we need to switch the order when decoding.  Also the
                    
243	// tracker does not normalize the quaternions.
                    
244	d_quat[Q_W] = vrpn_unbuffer_from_little_endian<vrpn_int16>(unbufPtr);
                    
248
                    
249	//Normalize quaternion
                    
250	double norm = sqrt (  d_quat[0]*d_quat[0] + d_quat[1]*d_quat[1]
                    
                
iio_event_monitor.c https://gitlab.com/Skylake/Staging | C | 372 lines
                    
102	[IIO_MOD_LIGHT_DUV] = "duv",
                    
103	[IIO_MOD_QUATERNION] = "quaternion",
                    
104	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
194	case IIO_MOD_LIGHT_DUV:
                    
195	case IIO_MOD_QUATERNION:
                    
196	case IIO_MOD_TEMP_AMBIENT:
                    
                
vrpn_Tracker_ThalmicLabsMyo.C https://gitlab.com/sat-metalab/vrpn | C | 246 lines
                    
164
                    
165void vrpn_Tracker_ThalmicLabsMyo::onOrientationData(myo::Myo* myo, uint64_t timestamp, const myo::Quaternion<float>& rotation)
                    
166{
                    
                
hid-sensor-rotation.c https://github.com/gby/linux.git | C | 386 lines
                    
31	struct hid_sensor_common common_attributes;
                    
32	struct hid_sensor_hub_attribute_info quaternion;
                    
33	u32 sampled_vals[4];
                    
44		.modified = 1,
                    
45		.channel2 = IIO_MOD_QUATERNION,
                    
46		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
                    
180
                    
181	if (usage_id == HID_USAGE_SENSOR_ORIENT_QUATERNION) {
                    
182		memcpy(rot_state->sampled_vals, raw_data,
                    
202				usage_id,
                    
203				HID_USAGE_SENSOR_ORIENT_QUATERNION,
                    
204				&st->quaternion);
                    
208	dev_rot_adjust_channel_bit_mask(&channels[0],
                    
209		st->quaternion.size / 4);
                    
210
                    
                
industrialio-core.c https://github.com/mturquette/linux.git | C | 1506 lines
                    
105	[IIO_MOD_LIGHT_UV] = "uv",
                    
106	[IIO_MOD_QUATERNION] = "quaternion",
                    
107	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
                
ext-script.c https://github.com/deldiablo/GodheadLips.git | C | 214 lines
                    
87	module = liscr_script_get_userdata (args->script, LIEXT_SCRIPT_SOUND);
                    
88	liscr_args_seti_quaternion (args, &module->listener_rotation);
                    
89}
                    
92	LIExtModule* module;
                    
93	LIMatQuaternion value;
                    
94
                    
94
                    
95	if (liscr_args_geti_quaternion (args, 0, &value))
                    
96	{
                    
                
TwDualGLUT.c https://gitlab.com/dannywillems/mass_collide | C | 465 lines
                    
60
                    
61// Routine to set a quaternion from a rotation axis and angle
                    
62// ( input axis = float[3] angle = float  output: quat = float[4] )
                    
62// ( input axis = float[3] angle = float  output: quat = float[4] )
                    
63void SetQuaternionFromAxisAngle(const float *axis, float angle, float *quat)
                    
64{
                    
74
                    
75// Routine to convert a quaternion to a 4x4 matrix
                    
76// ( input: quat = float[4]  output: mat = float[4*4] )
                    
76// ( input: quat = float[4]  output: mat = float[4*4] )
                    
77void ConvertQuaternionToMatrix(const float *quat, float *mat)
                    
78{
                    
104
                    
105// Routine to multiply 2 quaternions (ie, compose rotations)
                    
106// ( input q1 = float[4] q2 = float[4]  output: qout = float[4] )
                    
                
CC3Kazmath.c https://gitlab.com/praveenvelanati/ios-demo | C | 641 lines
                    
327
                    
328// Builds a rotation matrix from a quaternion to a rotation matrix,
                    
329// stores the result in pOut and returns the result
                    
329// stores the result in pOut and returns the result
                    
330kmMat4* kmMat4RotationQuaternion(kmMat4* pOut, const kmQuaternion* pQ) {
                    
331/*
                    
380// Extracts a quaternion from a rotation matrix, stores the result in quat and returns the result.
                    
381// This implementation is actually taken from the Quaternions article in Jeff LaMarche's excellent
                    
382// series on OpenGL programming for the iOS. Jeff's original source and explanation can be found here:
                    
384// It has been adapted here for this library.
                    
385kmQuaternion* kmQuaternionRotationMatrix(kmQuaternion* quat, const kmMat4* pIn) {
                    
386#define QUATERNION_TRACE_ZERO_TOLERANCE 0.0001f
                    
414				s = sqrtf(m[0] - (m[5] + m[10]) + 1.0f);
                    
415				if (s > QUATERNION_TRACE_ZERO_TOLERANCE) {
                    
416					quat->x = s * 0.5f;
                    
                
mat3.c https://bitbucket.org/gontamoteam/gontamo-repo.git | C | 372 lines
                    
32#include "kazmath/mat3.h"
                    
33#include "kazmath/quaternion.h"
                    
34
                    
239
                    
240kmMat3* const kmMat3RotationQuaternion(kmMat3* pOut, const kmQuaternion* pIn)
                    
241{
                    
286    /*Surely not this easy?*/
                    
287    kmQuaternion temp;
                    
288    kmQuaternionRotationMatrix(&temp, pIn);
                    
288    kmQuaternionRotationMatrix(&temp, pIn);
                    
289    kmQuaternionToAxisAngle(&temp, pAxis, radians);
                    
290    return pAxis;
                    
                
quaternion.c https://gitlab.com/Mr.Tomato/Cocos2d-X-text | C | 586 lines
                    
39///< Returns pOut, sets pOut to the conjugate of pIn
                    
40kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
41{
                    
61///< Returns the exponential of the quaternion
                    
62kmQuaternion* kmQuaternionExp(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
63{
                    
126///< Returns the natural logarithm
                    
127kmQuaternion* kmQuaternionLn(kmQuaternion* pOut,
                    
128                                        const kmQuaternion* pIn)
                    
475
                    
476kmQuaternion* kmQuaternionAssign(kmQuaternion* pOut, const kmQuaternion* pIn)
                    
477{
                    
482
                    
483kmQuaternion* kmQuaternionAdd(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2)
                    
484{
                    
                
industrialio-core.c https://bitbucket.org/EaglesBlood_Development/eb_grouper.git | C | 929 lines
                    
70	[IIO_CAPACITANCE] = "capacitance",
                    
71	[IIO_QUATERNION] = "quaternion",
                    
72};
                    
                
industrialio-core.c https://github.com/kvaneesh/linux.git | C | 1912 lines
                    
113	[IIO_MOD_LIGHT_DUV] = "duv",
                    
114	[IIO_MOD_QUATERNION] = "quaternion",
                    
115	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
                
surfaceTransformPoints.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 198 lines
                    
45#include "Pair.H"
                    
46#include "quaternion.H"
                    
47#include "mathematicalConstants.H"
                    
151
                    
152        quaternion R(v.x(), v.y(), v.z());
                    
153
                    
153
                    
154        Info<< "Rotating points by quaternion " << R << endl;
                    
155        points = transform(R, points);
                    
171
                    
172        quaternion R = quaternion(vector(0, 0, 1), yaw);
                    
173        R *= quaternion(vector(0, 1, 0), pitch);
                    
173        R *= quaternion(vector(0, 1, 0), pitch);
                    
174        R *= quaternion(vector(1, 0, 0), roll);
                    
175
                    
                
industrialio-core.c https://github.com/huangrui/linux.git | C | 1383 lines
                    
102	[IIO_MOD_LIGHT_BLUE] = "blue",
                    
103	[IIO_MOD_QUATERNION] = "quaternion",
                    
104	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
                
mat4.c https://bitbucket.org/safetyscissors/mstableview.git | C | 789 lines
                    
36#include "kazmath/mat3.h"
                    
37#include "kazmath/quaternion.h"
                    
38#include "kazmath/plane.h"
                    
464
                    
465/** Converts a quaternion to a rotation matrix,
                    
466 * the result is stored in pOut, returns pOut
                    
467 */
                    
468kmMat4* const kmMat4RotationQuaternion(kmMat4* pOut, const kmQuaternion* pQ)
                    
469{
                    
                
anim_orient.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 290 lines
                    
3 *	Convert between different orientation formats. The formats are:
                    
4 *  quaternion, yaw-pitch-roll, azimuth-elevation-twist, xyz angles, 
                    
5 *  pre-multiplication rotation matrices, and transposed matrices (inverses).
                    
                
axis.c https://github.com/paniwani/ITK.git | C | 1142 lines
                    
125  case nrrdKind4Vector:
                    
126  case nrrdKindQuaternion:
                    
127    ret = 4;
                    
                
industrialio-core.c https://gitlab.com/envieidoc/sprd_project | C | 1046 lines
                    
68	[IIO_PRESSURE] = "pressure",
                    
69	[IIO_QUATERNION] = "quaternion",
                    
70};
                    
                
model_alias.c https://gitlab.com/madscientist159/darkplaces | C | 1293 lines
                    
95		{
                    
96			// blend by transform each quaternion/translation into a dual-quaternion first, then blending
                    
97			const short * RESTRICT pose7s = model->data_poses7s + 7 * (frameblend[0].subframe * model->num_bones + i);
                    
128			}
                    
129			// generate a matrix from the dual-quaternion, implicitly normalizing it in the process
                    
130			scale = 1.0f / (rx*rx + ry*ry + rz*rz + rw*rw);
                    
                
ao_sample.c https://github.com/ajtowns/altos.git | C | 372 lines
                    
23#if HAS_GYRO
                    
24#include <ao_quaternion.h>
                    
25#endif
                    
91__pdata int32_t	ao_sample_roll_sum;
                    
92static struct ao_quaternion ao_rotation;
                    
93#endif
                    
141
                    
142	struct ao_quaternion	orient;
                    
143
                    
146
                    
147	ao_quaternion_init_vector(&orient,
                    
148				  (ao_ground_accel_across - ao_config.accel_zero_across),
                    
151
                    
152	ao_quaternion_normalize(&orient,
                    
153				&orient);
                    
                
cogl-matrix.c https://github.com/collects/cogl.git | C | 1659 lines
                    
70#include <cogl-debug.h>
                    
71#include <cogl-quaternion.h>
                    
72#include <cogl-quaternion-private.h>
                    
74#include <cogl-matrix-private.h>
                    
75#include <cogl-quaternion-private.h>
                    
76
                    
                
tabulated6DoFMotion.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 174 lines
                    
110
                    
111    quaternion R(TRV[1].x(), TRV[1].y(), TRV[1].z());
                    
112    septernion TR(septernion(CofG_ + TRV[0])*R*septernion(-CofG_));
                    
                
anim_keyread.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 156 lines
                    
7 *
                    
8 *	default	 - quaternions in the order x, y, z, w.
                    
9 *
                    
46#define XYZ		1
                    
47#define QUATERNION	2
                    
48 
                    
114		}
                    
115		else if (mode==QUATERNION){
                    
116			mat2quat(quat,viewrot);
                    
131
                    
132	mode = QUATERNION; /* default */
                    
133	units = DEGREES;
                    
143		case 'q':
                    
144			mode = QUATERNION;
                    
145			break;
                    
                
transformations.c https://bitbucket.org/csantoni/progetto-tesi.git | C | 1803 lines
                    
5A Python C extension module for homogeneous transformation matrices and
                    
6quaternions.
                    
7
                    
                
tabinterp.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1240 lines
                    
65#define INTERP_ACCEL  5
                    
66#define INTERP_QUAT   6	/* first chan of 4 that define a quaternion */
                    
67#define INTERP_QUAT2  7	/* an additional quaterion chan (2, 3, 4) */
                    
                
do.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1082 lines
                    
69extern size_t height;		/* # of lines in Y */
                    
70extern mat_t Viewrotscale;	/* view orientation quaternion */
                    
71extern fastf_t viewsize;
                    
                
anim.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 822 lines
                    
239
                    
240    /* quaternions on opposite sides of a four-dimensional sphere are
                    
241       equivalent. Take the quaternion closest to the previous one */
                    
                
tabinterp.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1238 lines
                    
65#define INTERP_ACCEL	5
                    
66#define	INTERP_QUAT	6	/* first chan of 4 that define a quaternion */
                    
67#define INTERP_QUAT2	7	/* an additional quaterion chan (2, 3, 4) */
                    
                
anim.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1015 lines
                    
31 * @li anim_mat2ypr()		extract yaw, pitch, roll from rotation matrix
                    
32 * @li anim_mat2quat()		extract quaternion from rotation matrix
                    
33 * @li anim_ypr2mat()		create rotation matrix from ypr, etc.
                    
309 * This interprets the rotational part of a 4x4 transformation
                    
310 *  matrix in terms of unit quaternions. The result is stored as a vector in
                    
311 * the order x, y, z, w.
                    
311 * the order x, y, z, w.
                    
312 * The algorithm is from Ken Shoemake, Animating Rotation with Quaternion
                    
313 * Curves, 1985 SIGGraph Conference Proceeding, p.245.
                    
349
                    
350    /* quaternions on opposite sides of a four-dimensional sphere
                    
351       are equivalent. Take the quaternion closest to the previous
                    
                
do.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1052 lines
                    
68extern int	height;			/* # of lines in Y */
                    
69extern mat_t	Viewrotscale;		/* view orientation quaternion */
                    
70extern fastf_t	viewsize;
                    
                
chgview.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 2058 lines
                    
45 *      f_qvrot         Set view from direction vector and twist angle
                    
46 *      cmd_orientation   Set current view direction from a quaternion
                    
47 *      cmd_zoom          zoom view
                    
                
anim.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1023 lines
                    
43 * @li anim_mat2ypr()		extract yaw,pitch,roll from rotation matrix
                    
44 * @li anim_mat2quat()		extract quaternion from rotation matrix
                    
45 * @li anim_ypr2mat()		create rotation matrix from ypr, etc.
                    
321 * This interprets the rotational part of a 4x4 transformation
                    
322 *  matrix in terms of unit quaternions. The result is stored as a vector in
                    
323 * the order x,y,z,w.
                    
323 * the order x,y,z,w.
                    
324 * The algorithm is from Ken Shoemake, Animating Rotation with Quaternion
                    
325 * Curves, 1985 SIGGraph Conference Proceeding, p.245.
                    
361
                    
362	/* quaternions on opposite sides of a four-dimensional sphere
                    
363		are equivalent. Take the quaternion closest to the previous
                    
                
tabinterp.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 1287 lines
                    
83#define INTERP_ACCEL	5
                    
84#define	INTERP_QUAT	6	/* first chan of 4 that define a quaternion */
                    
85#define INTERP_QUAT2	7	/* an additional quaterion chan (2,3,4) */
                    
                
anim.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 990 lines
                    
43 *	anim_mat2ypr()		extract yaw,pitch,roll from rotation matrix
                    
44 *	anim_mat2quat()		extract quaternion from rotation matrix
                    
45 *
                    
310/* ANIM_MAT2QUAT -  This interprets the rotational part of a 4x4 transformation 
                    
311 *  matrix in terms of unit quaternions. The result is stored as a vector in 
                    
312 * the order x,y,z,w. 
                    
312 * the order x,y,z,w. 
                    
313 * The algorithm is from Ken Shoemake, Animating Rotation with Quaternion 
                    
314 * Curves, 1985 SIGGraph Conference Proceeding, p.245.
                    
350
                    
351	/* quaternions on opposite sides of a four-dimensional sphere
                    
352		are equivalent. Take the quaternion closest to the previous
                    
                
chgview.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 2056 lines
                    
53 *      f_qvrot         Set view from direction vector and twist angle
                    
54 *      f_orientation   Set current view direction from a quaternion
                    
55 *      f_zoom          zoom view
                    
                
sh_prj.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 724 lines
                    
144 * a new list element.  It also reads in the pixel data for the image, and
                    
145 * computes the matrix from the view quaternion.  
                    
146 *
                    
177
                    
178	/* Generate matrix from the quaternion */
                    
179	quat_quat2mat(img_new->i_mat, img_new->i_orient);
                    
                
rt.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 624 lines
                    
69     * Looking through our history, %.14e seems to be safe as the
                    
70     * value prior to printing quaternions was %.9e, although anything
                    
71     * from 9->14 "should" be safe as it's above our calculation
                    
                
_posemath.c https://github.com/araisrobo/linuxcnc.git | C | 1740 lines
                    
174
                    
175int pmAxisAngleQuatConvert(PmAxis axis, double a, PmQuaternion * q)
                    
176{
                    
217
                    
218int pmRotQuatConvert(PmRotationVector r, PmQuaternion * q)
                    
219{
                    
311{
                    
312    PmQuaternion q;
                    
313    int r1, r2;
                    
322
                    
323int pmQuatRotConvert(PmQuaternion q, PmRotationVector * r)
                    
324{
                    
329#ifdef PM_PRINT_ERROR
                    
330	pmPrintError("Bad quaternion in pmQuatRotConvert\n");
                    
331#endif
                    
                
industrialio-core.c https://gitlab.com/buktemirlnk/mirrors | C | 1375 lines
                    
79	[IIO_RESISTANCE] = "resistance",
                    
80	[IIO_QUATERNION] = "quaternion",
                    
81};
                    
102	[IIO_MOD_LIGHT_BLUE] = "blue",
                    
103	[IIO_MOD_QUATERNION] = "quaternion",
                    
104	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
                
script-args.c https://github.com/deldiablo/GodheadLips.git | C | 1144 lines
                    
278int
                    
279liscr_args_geti_quaternion (LIScrArgs*       self,
                    
280                            int              index,
                    
280                            int              index,
                    
281                            LIMatQuaternion* result)
                    
282{
                    
288		lua_gettable (self->lua, self->input_table);
                    
289		tmp = liscr_isdata (self->lua, -1, LISCR_SCRIPT_QUATERNION);
                    
290		lua_pop (self->lua, 1);
                    
291		if (tmp != NULL)
                    
292			*result = *((LIMatQuaternion*) tmp->data);
                    
293	}
                    
298		index += self->args_start;
                    
299		tmp = liscr_isdata (self->lua, index, LISCR_SCRIPT_QUATERNION);
                    
300		if (tmp != NULL)
                    
                
render-light.c https://github.com/deldiablo/GodheadLips.git | C | 769 lines
                    
316	*value = limat_vector_init (0.0f, 0.0f, -1.0f);
                    
317	*value = limat_quaternion_transform (self->transform.rotation, *value);
                    
318}
                    
331	LIMatMatrix projection;
                    
332	LIMatQuaternion rotation;
                    
333	LIMatTransform transform;
                    
345	if (LIMAT_ABS (a) >= LIMAT_ABS (b))
                    
346		rotation = limat_quaternion_look (direction, limat_vector_init (0.0f, 1.0f, 0.0f));
                    
347	else
                    
347	else
                    
348		rotation = limat_quaternion_look (direction, limat_vector_init (0.0f, 0.0f, 1.0f));
                    
349
                    
                
model-pose.c https://github.com/deldiablo/GodheadLips.git | C | 1357 lines
                    
266	LIAlgU32dicIter iter;
                    
267	LIMatQuaternion quat0;
                    
268	LIMatQuaternion quat1;
                    
341			quat1 = group->pose_node->transform.global.rotation;
                    
342			quat0 = limat_quaternion_conjugate (quat0);
                    
343			group->rotation = limat_quaternion_multiply (quat1, quat0);
                    
348		{
                    
349			group->rotation = limat_quaternion_identity ();
                    
350			group->head_pose = limat_vector_init (0.0f, 0.0f, 0.0f);
                    
                
math-unittest.c https://github.com/deldiablo/GodheadLips.git | C | 848 lines
                    
33
                    
34static inline int check_quaternion (LIMatQuaternion q0, LIMatQuaternion q1)
                    
35{
                    
39	   (q0.w == 0.0f && q0.z == 0.0f && q0.y == 0.0f && q0.x < 0.0f))
                    
40		q0 = limat_quaternion_init (-q0.x, -q0.y, -q0.z, -q0.w);
                    
41	if (q1.w < 0.0f ||
                    
44	   (q1.w == 0.0f && q1.z == 0.0f && q1.y == 0.0f && q1.x < 0.0f))
                    
45		q1 = limat_quaternion_init (-q1.x, -q1.y, -q1.z, -q1.w);
                    
46	if (LIMAT_ABS (q0.x - q1.x) > EPSILON ||
                    
68
                    
69static inline void print_quaternion (const char* s, LIMatQuaternion q)
                    
70{
                    
390		print_matrix ("M", m0);
                    
391		print_quaternion ("M->Q", limat_convert_matrix_to_quaternion (m0));
                    
392		print_quaternion ("Q", q0);
                    
                
algorithm-camera.c https://github.com/deldiablo/GodheadLips.git | C | 710 lines
                    
112	LIMatVector dst;
                    
113	LIMatQuaternion rot;
                    
114
                    
115	/* Calculate eye position. */
                    
116	rot = limat_quaternion_conjugate (self->transform.current.rotation);
                    
117	dir = limat_quaternion_get_basis (rot, 2);
                    
149{
                    
150	LIMatQuaternion rot;
                    
151	LIMatTransform transform;
                    
154	axis = limat_vector_init (1.0f, 0.0f, 0.0f);
                    
155	rot = limat_quaternion_rotation (value, axis);
                    
156	if (self->config.driver == LIALG_CAMERA_MANUAL)
                    
157	{
                    
158		transform = limat_convert_quaternion_to_transform (rot);
                    
159		transform = limat_transform_multiply (self->transform.target, transform);
                    
                
ext-module.c https://github.com/deldiablo/GodheadLips.git | C | 455 lines
                    
55	self->music_fading = 1.0f;
                    
56	self->listener_rotation = limat_quaternion_identity ();
                    
57
                    
412	velocity = self->listener_velocity;
                    
413	direction = limat_quaternion_get_basis (self->listener_rotation, 2);
                    
414	up = limat_quaternion_get_basis (self->listener_rotation, 1);
                    
                
iio_event_monitor.c https://github.com/mturquette/linux.git | C | 350 lines
                    
97	[IIO_MOD_LIGHT_UV] = "uv",
                    
98	[IIO_MOD_QUATERNION] = "quaternion",
                    
99	[IIO_MOD_TEMP_AMBIENT] = "ambient",
                    
178	case IIO_MOD_LIGHT_UV:
                    
179	case IIO_MOD_QUATERNION:
                    
180	case IIO_MOD_TEMP_AMBIENT:
                    
                
vectbl.c https://gitlab.com/oytunistrator/QuIP | C | 507 lines
                    
27 * what precisions (and combinations) are allowed, and a mask
                    
28 * indicating what types (real/complex/quaternion/mixed/etc)
                    
29 * are allowed.
                    
                
vec_call.c https://gitlab.com/oytunistrator/QuIP | C | 1027 lines
                    
16	"mixed (complex/real)",
                    
17	"quaternion",
                    
18	"mixed (quaternion/real)"
                    
54	else if( IS_COMPLEX(dp) ) return("complex");
                    
55	else if( IS_QUAT(dp) ) return("quaternion");
                    
56//#ifdef CAUTIOUS
                    
65
                    
66/* The "type" is real, complex, quaternion, or mixed...
                    
67 * independent of "precision" (byte/short/float etc)
                    
167				if( IS_QUAT( OA_SRC2(oap) ) ){
                    
168					SET_OA_ARGSTYPE(oap, QUATERNION_ARGS);
                    
169				} else if( IS_REAL( OA_SRC2(oap) ) ){
                    
188			if( IS_QUAT( OA_SRC1(oap) ) ){
                    
189				SET_OA_ARGSTYPE(oap, QUATERNION_ARGS);
                    
190			} else if( IS_REAL( OA_SRC1(oap) ) ){
                    
                
dplist.c https://gitlab.com/oytunistrator/QuIP | C | 596 lines
                    
161		if( (SHP_PREC(shpp) & MACH_PREC_MASK) == PREC_SP )
                    
162			sprintf(MSG_STR,", quaternion");
                    
163		else if( (SHP_PREC(shpp) & MACH_PREC_MASK) == PREC_DP )
                    
166		else {
                    
167//			sprintf(MSG_STR,", unknown_precision_quaternion");
                    
168//			WARN("CAUTIOUS:  describe_shape:  unexpected quaternion machine precision!?");
                    
168//			WARN("CAUTIOUS:  describe_shape:  unexpected quaternion machine precision!?");
                    
169			assert( AERROR("unexpected quaternion machine precision!?") );
                    
170		}
                    
260	{	"char",			DT_CHAR			},
                    
261	{	"quaternion",		DT_QUAT			},
                    
262	{	"complex",		DT_COMPLEX		},
                    
                
cu2_menu.c https://gitlab.com/oytunistrator/QuIP | C | 601 lines
                    
189MENU_BEGIN(qsvector)
                    
190//ADD_CMD( add, 	, 		add quaternion scalar to elements of a vector )
                    
191//ADD_CMD( mul, , 		multiply a vector by a quaternion scalar )
                    
191//ADD_CMD( mul, , 		multiply a vector by a quaternion scalar )
                    
192//ADD_CMD( sub, , 		subtract elements of a vector from a quaternion scalar )
                    
193//ADD_CMD( sub2, , 		subtract elements of a vector from a quaternion scalar )
                    
193//ADD_CMD( sub2, , 		subtract elements of a vector from a quaternion scalar )
                    
194//ADD_CMD( div, , 		divide a quaternion scalar by the elements of a vector )
                    
195//ADD_CMD( div2, , 		divide elements of a vector by a quaternion scalar )
                    
435ADD_CMD( csvector,	cvs,		complex scalar-vector operations )
                    
436ADD_CMD( Qsvector,	qvs,		quaternion scalar-vector operations )
                    
437ADD_CMD( minmax,	minmax,	minimum/maximum routines )
                    
                
winmain.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 453 lines
                    
38extern Vector     model_position;      // position of bunny
                    
39extern Quaternion model_orientation;   // orientation of bunny
                    
40
                    
97
                    
98Quaternion VirtualTrackBall(Vector cop,Vector cor,Vector dir1,Vector dir2) {
                    
99        // Implement track ball functionality to spin stuf on the screen
                    
133        if(m>1)m=1; // avoid potential floating point error
                    
134        Quaternion q(Vector(1.0f,0.0f,0.0f),0.0f);
                    
135        if(m>0 && (angle=(float)asin(m))>3.14/180) {
                    
136                        axis = normalize(axis);
                    
137                        q=Quaternion(axis,angle);
                    
138        }
                    
143        // Change the orientation of the bunny according to mouse drag
                    
144        Quaternion q=VirtualTrackBall(Vector(0,0,0),model_position,
                    
145                                      OldMouseVector,MouseVector);
                    
                
searchableSurfaceControl.C https://gitlab.com/johnvarv/OpenFOAM-3.0.x | C | 586 lines
                    
32#include "vectorTools.H"
                    
33#include "quaternion.H"
                    
34
                    
                
mandelbulb.ec https://github.com/thexa4/sdk.git | C | 900 lines
                    
79{
                    
80   attachedQuaternion,
                    
81   position = { 0, 0, -80 };
                    
305               Vector3D vector { 0,0,1 };
                    
306               mat.RotationQuaternion(light->orientation);
                    
307               light->direction.MultMatrix(vector, mat);
                    
309               vector = light->direction;
                    
310               mat.RotationQuaternion(camera.cOrientation);
                    
311               light->direction.MultMatrix(vector, mat);
                    
350   Material material { diffuse = { 40/255.0f, 200/255.0f, 1.0f } };
                    
351   Quaternion orientation { 1, 0, 0, 0 };
                    
352   Vector3D localLightDirection[2];
                    
449      Vector3D vector { 0, 0, 1 };
                    
450      mat.RotationQuaternion(orientation);
                    
451      m2.RotationQuaternion(orientation);
                    
                
orbitWithMouse.ec https://github.com/thexa4/sdk.git | C | 1320 lines
                    
309   // Camera Sliding
                    
310   Quaternion fromAngle, toAngle;
                    
311   Vector3D fromPosition, toPosition;
                    
                
Object.ec https://github.com/thexa4/sdk.git | C | 1543 lines
                    
29   Vector3D position;
                    
30   Quaternion orientation;
                    
31   Vector3Df scaling;
                    
67      Vector3Df position;
                    
68      Quaternion orientation;
                    
69      Vector3Df scaling;
                    
326
                    
327   void GetQuaternion(Quaternion quat, SplinePart what, unsigned int n)
                    
328   {
                    
329      FrameKey *kn_1, *kn, *kn1;
                    
330      Quaternion *qn_1, *qn, *qn1;
                    
331      int d1, d2;
                    
433
                    
434   void InterpolateQuat(Quaternion quat, Quaternion prevQuat, Quaternion nextQuat, int prev, int next, float t)
                    
435   {
                    
                
Camera.ec https://github.com/thexa4/sdk.git | C | 618 lines
                    
4
                    
5public enum CameraType { fixed, fixedQuaternion, attached, attachedQuaternion, lookAt, lookAtObject };
                    
6public enum FovDirection { widest, horizontal, vertical };
                    
15   property Vector3D position { set { position = value; } get { value = position; } };
                    
16   property Quaternion orientation { set { orientation = value; } get { value = orientation; } };
                    
17   property Vector3D cPosition { get { value = cPosition; } };
                    
17   property Vector3D cPosition { get { value = cPosition; } };
                    
18   property Quaternion cOrientation { get { value = cAngle; } };
                    
19   property Degrees fov { set { fov = value; } get { return fov; } };
                    
31         Vector3D vector {0,0,1};
                    
32         Quaternion quat;
                    
33
                    
132
                    
133   void AdjustAngle(Quaternion angle)
                    
134   {
                    
                
Display.ec https://github.com/thexa4/sdk.git | C | 1593 lines
                    
29import "Object"
                    
30import "Quaternion"
                    
31import "Vector3D"
                    
227   Vector3D direction;
                    
228   Quaternion orientation;
                    
229   Object lightObject;
                    
                
quat.c https://github.com/shadoof/CW2.git | C | 392 lines
                    
27/*!
                    
28 * \defgroup quat Quaternion Mathematics
                    
29 *
                    
                
math.c https://github.com/aragaer/wine.git | C | 1596 lines
                    
89
                    
90D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation)
                    
91{
                    
107    if ( !rotation ) D3DXMatrixIdentity(&m3);
                    
108    else D3DXMatrixRotationQuaternion(&m3, rotation);
                    
109
                    
122    D3DXMATRIX m1, m2, m3, m4, m5;
                    
123    D3DXQUATERNION rot;
                    
124    D3DXVECTOR3 rot_center, trans;
                    
159    D3DXMatrixTranslation(&m4, rot_center.x, rot_center.y, rot_center.z);
                    
160    D3DXMatrixRotationQuaternion(&m3, &rot);
                    
161    D3DXMatrixTranslation(&m5, trans.x, trans.y, trans.z);
                    
170
                    
171HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutrotation, D3DXVECTOR3 *pouttranslation, CONST D3DXMATRIX *pm)
                    
172{
                    
                
cknr04.c https://github.com/mattbornski/spice.git | C | 433 lines
                    
134
                    
135/*     Number of quaternion components and number of quaternion and */
                    
136/*     angular rate components together. */
                    
168/*              is applied when seven number integer array containing */
                    
169/*              polynomial degrees for quaternion and angular rate */
                    
170/*              components packed into a single DP number stored in */
                    
202/*              has the greatest packet size, since these packets */
                    
203/*              contain a quaternion, its derivative, an angular */
                    
204/*              velocity vector, and its derivative.  See ck05.inc */
                    
                
results_holder.c https://bitbucket.org/rui_araujo/edvsboardos.git | C | 522 lines
                    
37    long mag_scale[3]; /**< scale factor to apply to magnetic field reading */
                    
38    long compass_correction[4]; /**< quaternion going from gyro,accel quaternion to 9 axis */
                    
39    int acc_state; /**< Describes accel state */
                    
54/** @internal
                    
55* Store a quaternion more suitable for gaming. This quaternion is often determined
                    
56* using only gyro and accel.
                    
66/** @internal
                    
67* Sets the quaternion adjustment from 6 axis (accel, gyro) to 9 axis quaternion.
                    
68* @param[in] data Quaternion Adjustment
                    
78/** @internal
                    
79* Gets the quaternion adjustment from 6 axis (accel, gyro) to 9 axis quaternion.
                    
80* @param[out] data Quaternion Adjustment
                    
221
                    
222/** Returns a quaternion.
                    
223 * @param[out] data 9-axis quaternion scaled such that 1.0 = 2^30.
                    
                
ml_math_func.c https://bitbucket.org/rui_araujo/edvsboardos.git | C | 780 lines
                    
84 * Does the cross product of compass by gravity, then converts that
                    
85 * to the world frame using the quaternion, then computes the angle that
                    
86 * is made.
                    
89 * @param[in] grav Gravity Vector (Body Frame), length 3
                    
90 * @param[in] quat Quaternion, Length 4
                    
91 * @return Angle Cross Product makes after quaternion rotation.
                    
209
                    
210/** Performs a fixed point quaternion multiply.
                    
211* @param[in] q1 First Quaternion Multicand, length 4. 1.0 scaled
                    
212*            to 2^30
                    
213* @param[in] q2 Second Quaternion Multicand, length 4. 1.0 scaled
                    
214*            to 2^30
                    
214*            to 2^30
                    
215* @param[out] qProd Product after quaternion multiply. Length 4.
                    
216*             1.0 scaled to 2^30.
                    
                
hal_outputs.c https://bitbucket.org/rui_araujo/edvsboardos.git | C | 490 lines
                    
188*
                    
189* The three elements of the rotation vector are equal to the last three components of a unit quaternion
                    
190* {x*sin(@f$\theta@f$/2), y*sin(@f$\theta@f$/2), z*sin(@f$\theta@f$/2)>. The 4th element is cos(@f$\theta@f$/2).
                    
259
                    
260    inv_quaternion_to_rotation(hal_out.nav_quat, rot);
                    
261    r[0][0] = rot[0]*conv;
                    
332
                    
333    inv_get_quaternion_set(hal_out.nav_quat, &hal_out.accuracy_quat,
                    
334                           &hal_out.nav_timestamp);
                    
358    if (sensor_cal->quat.status & INV_SENSOR_ON) {
                    
359        // If quaternion sensor is on, gyros are not required as quaternion already has that part
                    
360        if ((sensor_cal->accel.status & sensor_cal->compass.status & INV_SENSOR_ON) == 0) {
                    
386    default:
                    
387        hal_out.nine_axis_status = 0; // Don't output quaternion re
                    
                
quaternion.c https://gitlab.com/NunezG/GLTest | C | 1006 lines
                    
10                                               
                    
11  Description: Common (and not so common) Quaternion Functions
                    
12
                    
30// includes
                    
31#include "quaternion.h"
                    
32#include <math.h>
                    
50
                    
51  Action:   Converts quaternion representation of a rotation to a matrix
                    
52			representation
                    
53
                    
54  Params:   GL_QUAT* (our quaternion), GLfloat (4x4 matrix)
                    
55
                    
98  Action:   Converts representation of a rotation from Euler angles to
                    
99			quaternion representation
                    
100
                    
                
zzckcv05.c https://github.com/mattbornski/spice.git | C | 549 lines
                    
150
                    
151/*     Subtype 0:  Hermite interpolation, 8-element packets. Quaternion */
                    
152/*                 and quaternion derivatives only, no angular velocity */
                    
152/*                 and quaternion derivatives only, no angular velocity */
                    
153/*                 vector provided. Quaternion elements are listed */
                    
154/*                 first, followed by derivatives. Angular velocity is */
                    
154/*                 first, followed by derivatives. Angular velocity is */
                    
155/*                 derived from the quaternions and quaternion */
                    
156/*                 derivatives. */
                    
158
                    
159/*     Subtype 1:  Lagrange interpolation, 4-element packets. Quaternion */
                    
160/*                 only. Angular velocity is derived by differentiating */
                    
166/*                 well as derivatives of each, are provided. The */
                    
167/*                 quaternion comes first, then quaternion derivatives, */
                    
168/*                 then angular velocity and its derivatives. */
                    
                
qdq2av_c.c https://github.com/mattbornski/spice.git | C | 717 lines
                    
2
                    
3-Procedure qdq2av_c (Quaternion and quaternion derivative to a.v.)
                    
4
                    
6 
                    
7   Derive angular velocity from a unit quaternion and its derivative 
                    
8   with respect to time. 
                    
60   --------  ---  -------------------------------------------------- 
                    
61   q          I   Unit SPICE quaternion. 
                    
62   dq         I   Derivative of `q' with respect to time. 
                    
67   q              is a unit length 4-vector representing a SPICE-style
                    
68                  quaternion. See the discussion of "Quaternion Styles"
                    
69                  in the Particulars section below.
                    
182
                    
183   For both styles of quaternions, if a quaternion q represents
                    
184   a rotation matrix M, then -q represents M as well.
                    
                
qdq2av.c https://github.com/mattbornski/spice.git | C | 722 lines
                    
12
                    
13/* $Procedure QDQ2AV (Quaternion and quaternion derivative to a.v.) */
                    
14/* Subroutine */ int qdq2av_(doublereal *q, doublereal *dq, doublereal *av)
                    
134
                    
135/*     There are different "styles" of quaternions used in */
                    
136/*     science and engineering applications. Quaternion styles */
                    
185
                    
186/*     For both styles of quaternions, if a quaternion q represents */
                    
187/*     a rotation matrix M, then -q represents M as well. */
                    
192
                    
193/*     the equivalent SPICE quaternion is */
                    
194
                    
217
                    
218/*     Then if the unit-length SPICE quaternion q represents M, where */
                    
219
                    
                
q2m.c https://github.com/mattbornski/spice.git | C | 592 lines
                    
7
                    
8/* $Procedure      Q2M ( Quaternion to matrix ) */
                    
9/* Subroutine */ int q2m_(doublereal *q, doublereal *r__)
                    
62
                    
63/*     Q              is a unit-length SPICE-style quaternion. Q has the */
                    
64/*                    property that */
                    
67
                    
68/*                    See the discussion of quaternion styles in */
                    
69/*                    Particulars below. */
                    
188
                    
189/*     For both styles of quaternions, if a quaternion q represents */
                    
190/*     a rotation matrix M, then -q represents M as well. */
                    
195
                    
196/*     the equivalent SPICE quaternion is */
                    
197
                    
                
m2q.c https://github.com/mattbornski/spice.git | C | 632 lines
                    
31
                    
32/*     Find a unit quaternion corresponding to a specified rotation */
                    
33/*     matrix. */
                    
84/*     Q              is a unit-length SPICE-style quaternion */
                    
85/*                    representing R. See the discussion of quaternion */
                    
86/*                    styles in Particulars below. */
                    
100/*                    The restriction that theta must be in the range */
                    
101/*                    [0, pi] determines the output quaternion Q */
                    
102/*                    uniquely except when theta = pi; in this special */
                    
167
                    
168/*     There are different "styles" of quaternions used in */
                    
169/*     science and engineering applications. Quaternion styles */
                    
218
                    
219/*     For both styles of quaternions, if a quaternion q represents */
                    
220/*     a rotation matrix M, then -q represents M as well. */
                    
                
ckw05_c.c https://github.com/mattbornski/spice.git | C | 701 lines
                    
124 
                    
125              The rotation matrices represented by the quaternions
                    
126              that are to be written to the segment transform the
                    
150 
                    
151              See the discussion of "Quaternion Styles" in the
                    
152              Particulars section below.
                    
184                 Subtype 0:  Hermite interpolation, 8-element packets.
                    
185                             Quaternion and quaternion derivatives
                    
186                             only, no angular velocity vector provided.
                    
293 
                    
294  12)  If any quaternion is the zero vector, the error 
                    
295       SPICE(ZEROQUATERNION) is signaled. 
                    
389
                    
390   For both styles of quaternions, if a quaternion q represents
                    
391   a rotation matrix M, then -q represents M as well.
                    
                
ckw05.c https://github.com/mattbornski/spice.git | C | 1112 lines
                    
157/*                 first, followed by derivatives. Angular velocity is */
                    
158/*                 derived from the quaternions and quaternion */
                    
159/*                 derivatives. */
                    
167/*     Subtype 2:  Hermite interpolation, 14-element packets. */
                    
168/*                 Quaternion and angular angular velocity vector, as */
                    
169/*                 well as derivatives of each, are provided. The */
                    
169/*                 well as derivatives of each, are provided. The */
                    
170/*                 quaternion comes first, then quaternion derivatives, */
                    
171/*                 then angular velocity and its derivatives. */
                    
290/*                       Subtype 0:  Hermite interpolation, 8-element */
                    
291/*                                   packets. Quaternion and quaternion */
                    
292/*                                   derivatives only, no angular */
                    
296/*                                   Angular velocity is derived from */
                    
297/*                                   the quaternions and quaternion */
                    
298/*                                   derivatives. */
                    
                
ckw04a.c https://github.com/mattbornski/spice.git | C | 764 lines
                    
145
                    
146/*     Number of quaternion components and number of quaternion and */
                    
147/*     angular rate components together. */
                    
179/*              is applied when seven number integer array containing */
                    
180/*              polynomial degrees for quaternion and angular rate */
                    
181/*              components packed into a single DP number stored in */
                    
213/*              has the greatest packet size, since these packets */
                    
214/*              contain a quaternion, its derivative, an angular */
                    
215/*              velocity vector, and its derivative.  See ck05.inc */
                    
306/*     variable length. The gaps between intervals are allowed. The */
                    
307/*     Chebyshev polynomials represent individual SPICE-style quaternion */
                    
308/*     components q0, q1, q2 and q3 and individual angular velocities */
                    
310
                    
311/*     See the discussion of quaternion styles below. */
                    
312
                    
                
ckw03_c.c https://github.com/mattbornski/spice.git | C | 667 lines
                    
133   quats      is an array of SPICE-style quaternions representing a
                    
134              sequence of C-matrices. See the discussion of "Quaternion
                    
135              Styles" in the Particulars section below.
                    
265
                    
266   Quaternion Styles
                    
267   -----------------
                    
293   Quaternions of any other style must be converted to SPICE
                    
294   quaternions before they are passed to CSPICE functions.
                    
295
                    
296
                    
297   Relationship between SPICE and Engineering Quaternions
                    
298   ------------------------------------------------------
                    
319
                    
320   For both styles of quaternions, if a quaternion q represents
                    
321   a rotation matrix M, then -q represents M as well.
                    
                
ckw03.c https://github.com/mattbornski/spice.git | C | 951 lines
                    
154/*                a sequence of C-matrices. See the discussion of */
                    
155/*                quaternion styles in Particulars below. */
                    
156
                    
156
                    
157/*                The C-matrix represented by the Ith quaternion in */
                    
158/*                QUATS is a rotation matrix that transforms the */
                    
293
                    
294/*        - The quaternion multiplication formula */
                    
295
                    
338
                    
339/*     For both styles of quaternions, if a quaternion q represents */
                    
340/*     a rotation matrix M, then -q represents M as well. */
                    
345
                    
346/*     the equivalent SPICE quaternion is */
                    
347
                    
                
ckw02_c.c https://github.com/mattbornski/spice.git | C | 544 lines
                    
189 
                    
190  12)  If any quaternion has magnitude zero, the error
                    
191       SPICE(ZEROQUATERNION) is signaled.
                    
207
                    
208   Quaternion Styles
                    
209   -----------------
                    
261
                    
262   For both styles of quaternions, if a quaternion q represents
                    
263   a rotation matrix M, then -q represents M as well.
                    
264
                    
265   Given an engineering quaternion
                    
266
                    
474      The check for non-unit quaternions has been replaced
                    
475      with a check for zero-length quaternions. (The
                    
476      implementation of the check is located in ckw02_.)
                    
                
ckw02.c https://github.com/mattbornski/spice.git | C | 839 lines
                    
209/*    12)  If the squared length of any quaternion differes from 1 */
                    
210/*         by more than 1.0D-2, the error SPICE(NONUNITQUATERNION) is */
                    
211/*         signalled. */
                    
266/*     counterclockwise direction about unit rotation axis vector A. */
                    
267/*     Then the SPICE quaternions representing M are */
                    
268
                    
273
                    
274/*     while the engineering quaternions representing M are */
                    
275
                    
280
                    
281/*     For both styles of quaternions, if a quaternion q represents */
                    
282/*     a rotation matrix M, then -q represents M as well. */
                    
383
                    
384/*     Given a SPICE quaternion */
                    
385
                    
                
ckw01_c.c https://github.com/mattbornski/spice.git | C | 546 lines
                    
164 
                    
165   9)  If any quaternion has magnitude zero, the error
                    
166       SPICE(ZEROQUATERNION) is signaled.
                    
182
                    
183   Quaternion Styles
                    
184   -----------------
                    
236
                    
237   For both styles of quaternions, if a quaternion q represents
                    
238   a rotation matrix M, then -q represents M as well.
                    
239
                    
240   Given an engineering quaternion
                    
241
                    
454      The check for non-unit quaternions has been replaced
                    
455      with a check for zero-length quaternions. (The
                    
456      implementation of the check is located in ckw01_.)
                    
                
ckw01.c https://github.com/mattbornski/spice.git | C | 772 lines
                    
101/*     SCLKDP     I   Encoded SCLK times. */
                    
102/*     QUATS      I   SPICE quaternions representing instrument pointing. */
                    
103/*     AVVS       I   Angular velocity vectors. */
                    
186/*     9)  If the squared length of any quaternion differes from 1 */
                    
187/*         by more than 1.0D-2, the error SPICE(NONUNITQUATERNION) is */
                    
188/*         signalled. */
                    
203
                    
204/*     Quaternion Styles */
                    
205/*     ----------------- */
                    
257
                    
258/*     For both styles of quaternions, if a quaternion q represents */
                    
259/*     a rotation matrix M, then -q represents M as well. */
                    
260
                    
261/*     Given an engineering quaternion */
                    
262
                    
                
ckr05.c https://github.com/mattbornski/spice.git | C | 1251 lines
                    
173
                    
174/*     Subtype 0:  Hermite interpolation, 8-element packets. Quaternion */
                    
175/*                 and quaternion derivatives only, no angular velocity */
                    
175/*                 and quaternion derivatives only, no angular velocity */
                    
176/*                 vector provided. Quaternion elements are listed */
                    
177/*                 first, followed by derivatives. Angular velocity is */
                    
177/*                 first, followed by derivatives. Angular velocity is */
                    
178/*                 derived from the quaternions and quaternion */
                    
179/*                 derivatives. */
                    
189/*                 well as derivatives of each, are provided. The */
                    
190/*                 quaternion comes first, then quaternion derivatives, */
                    
191/*                 then angular velocity and its derivatives. */
                    
269
                    
270/*     Number of quaternion components and number of quaternion and */
                    
271/*     angular rate components together. */
                    
                
ckr03.c https://github.com/mattbornski/spice.git | C | 995 lines
                    
156/*                   RECORD( 3  ) = lq1   \    Left bracketing */
                    
157/*                   RECORD( 4  ) = lq2   /      quaternion. */
                    
158/*                   RECORD( 5  ) = lq3  / */
                    
167/*                   RECORD( 11 ) = rq1   \    Right bracketing */
                    
168/*                   RECORD( 12 ) = rq2   /       quaternion. */
                    
169/*                   RECORD( 13 ) = rq3  / */
                    
177/*                The quantities lq0 - lq3 and rq0 - rq3 are the */
                    
178/*                components of the quaternions that represent the */
                    
179/*                C-matrices associated with the times that bracket */
                    
                
ckr02.c https://github.com/mattbornski/spice.git | C | 659 lines
                    
141/*                The quantities q0 - q3 are the components of the */
                    
142/*                quaternion that represents the C-matrix associated with */
                    
143/*                the start time of the interval. The quantities av1, */
                    
328/*        PSIZ       is the number of double precision numbers making up */
                    
329/*                   the record containing the quaternion, angular */
                    
330/*                   velocity vector, and seconds per tick rate. */
                    
                
ckr01.c https://github.com/mattbornski/spice.git | C | 602 lines
                    
139
                    
140/*                The quantities q0 - q3 represent a quaternion. */
                    
141/*                The quantities Av1, Av2, and Av3 represent the angular */
                    
392/*        QSIZ       is the number of double precision numbers making up */
                    
393/*                   the quaternion portion of a pointing record. */
                    
394
                    
395/*        QAVSIZ     is the number of double precision numbers making up */
                    
396/*                   the quaternion and angular velocity portion of a */
                    
397/*                   pointing record. */
                    
                
ckgpav_c.c https://github.com/mattbornski/spice.git | C | 759 lines
                    
209      - "0" is used to represent discrete pointing instances 
                    
210        (quaternions, angular velocity vectors, and associated 
                    
211        time tags).
                    
225
                    
226      - The quaternions occurring in the segment need not be
                    
227        evenly spaced in time.
                    
283
                    
284      - The quaternions occurring in the periods of continuous
                    
285        pointing need not be evenly spaced in time.
                    
                
ckgp_c.c https://github.com/mattbornski/spice.git | C | 721 lines
                    
192      - "0" is used to represent discrete pointing instances 
                    
193        (quaternions and associated time tags).
                    
194
                    
207
                    
208      - The quaternions occurring in the segment need not be
                    
209        evenly spaced in time.
                    
265
                    
266      - The quaternions occurring in the periods of continuous
                    
267        pointing need not be evenly spaced in time.
                    
                
cke04.c https://github.com/mattbornski/spice.git | C | 566 lines
                    
137
                    
138/*     Number of quaternion components and number of quaternion and */
                    
139/*     angular rate components together. */
                    
171/*              is applied when seven number integer array containing */
                    
172/*              polynomial degrees for quaternion and angular rate */
                    
173/*              components packed into a single DP number stored in */
                    
205/*              has the greatest packet size, since these packets */
                    
206/*              contain a quaternion, its derivative, an angular */
                    
207/*              velocity vector, and its derivative.  See ck05.inc */
                    
341
                    
342/*     The work done by CKE04 is to calculate quaternion and angular */
                    
343/*     velocity components using Chebyshev polynomial approximation */
                    
344/*     parameters. The second step of evaluation is to convert the */
                    
345/*     pointing portion of the record from quaternion form to C-matrix */
                    
346/*     form. */
                    
                
cke03.c https://github.com/mattbornski/spice.git | C | 545 lines
                    
112/*                   RECORD( 3  ) = lq1   \    Left bracketing */
                    
113/*                   RECORD( 4  ) = lq2   /      quaternion. */
                    
114/*                   RECORD( 5  ) = lq3  / */
                    
123/*                   RECORD( 11 ) = rq1   \    Right bracketing */
                    
124/*                   RECORD( 12 ) = rq2   /       quaternion. */
                    
125/*                   RECORD( 13 ) = rq3  / */
                    
133/*                The quantities lq0 - lq3 and rq0 - rq3 are the */
                    
134/*                components of the quaternions that represent the */
                    
135/*                C-matrices associated with the times that bracket */
                    
214/*     pointing instances in RECORD are for the same time, then this */
                    
215/*     routine will simply unpack the record and convert the quaternion */
                    
216/*     to a C-matrix. */
                    
                
hid-sensor-orientation.c https://gitlab.com/belos-old/android_kernel_xiaomi_virgo | C | 450 lines
                    
46	CHANNEL_SCAN_INDEX_QUATERNION_Y,
                    
47	CHANNEL_SCAN_INDEX_QUATERNION_Z,
                    
48	CHANNEL_SCAN_INDEX_QUATERNION_W,
                    
62static const u32 orient_addresses[ORIENT_ATTRIBUTES_NB] = {
                    
63	[0] = HID_USAGE_SENSOR_DATA_ORIENT_QUATERNION,
                    
64	[1] = HID_USAGE_SENSOR_DATA_ORIENT_MAGNETIC_HEADING,
                    
77			BIT(IIO_CHAN_INFO_HYSTERESIS),
                    
78		.scan_index = CHANNEL_SCAN_INDEX_QUATERNION_X,
                    
79	}, {
                    
86			BIT(IIO_CHAN_INFO_HYSTERESIS),
                    
87		.scan_index = CHANNEL_SCAN_INDEX_QUATERNION_Y,
                    
88	}, {
                    
311
                    
312	for (i = CHANNEL_SCAN_INDEX_QUATERNION_X; i <= CHANNEL_SCAN_INDEX_QUATERNION_W; ++i)
                    
313		hid_sensor_adjust_channel(channels, i, IIO_ROT, &st->common,
                    
                
anim_orient.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 307 lines
                    
23 * Convert between different orientation formats. The formats are:
                    
24 * quaternion, yaw-pitch-roll, azimuth-elevation-twist, xyz angles,
                    
25 * pre-multiplication rotation matrices, and transposed matrices
                    
                
anim_script.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 270 lines
                    
46/* info from command line args */
                    
47int relative_a, relative_c, axes, translate, quaternion, rotate;/*flags*/
                    
48int steer, view, readview, permute; /* flags*/
                    
63    rotate = translate = 1; /* defaults */
                    
64    quaternion = permute = 0;
                    
65    bu_strlcpy(mat_cmd, "lmul", sizeof(mat_cmd));
                    
118	    case 'q':
                    
119		quaternion = 1;
                    
120		break;
                    
187	    val = scanf("%lf %lf %lf", point, point+1, point+2);
                    
188	if (rotate&&quaternion) {
                    
189	    val = scanf("%lf %lf %lf %lf", quat, quat+1, quat+2, quat+3);
                    
205	    go = anim_steer_mat(a, point, last_steer); /* warning: point changed by anim_steer_mat */
                    
206	else if (quaternion) {
                    
207	    anim_quat2mat(a, quat);
                    
                
sharpr.c https://github.com/mattbornski/spice.git | C | 164 lines
                    
100/*     Suppose that you have a rotation matrix that needs to be */
                    
101/*     converted to a quaternion.  The SPICE matrix to quaternion */
                    
102/*     conversion routine M2Q performs error checks on the input */
                    
103/*     matrix and signals an error if it does not meet the checks */
                    
104/*     for a quaternion.  By calling this routine you can ensure that */
                    
105/*     your rotation matrix (provided it's non-singular) will pass */
                    
                
idmap.c https://github.com/nedbass/lustre.git | C | 477 lines
                    
237                                    e->lie_lcl_gid == lcl_gid)
                    
238                                        /* must be quaternion match */
                    
239                                        return e;
                    
                
ahrs_quat_fast_ekf.c https://github.com/AshuLara/paparazzi_lisa.git | C | 404 lines
                    
10
                    
11/* We have seven variables in our state -- the quaternion attitude
                    
12 * estimate and three gyro bias values 
                    
74 * matrix, but with elements only on the diagonals.  Additionally,
                    
75 * since the quaternion has no expected noise (we can't directly measure
                    
76 * it), those are zero.  For the gyro, we expect around 5 deg/sec noise,
                    
104 *
                    
105 * Wxq is the quaternion omega matrix:
                    
106 *
                    
132     However, its [0:3][0:3] region is actually the Wxq(pqr) which is needed to
                    
133     compute the time derivative of the quaternion, so we compute F now */
                    
134
                    
166
                    
167  /* normalize quaternion */
                    
168  AFE_NORM_QUAT();
                    
                
vrlink.c https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git.git | C | 304 lines
                    
136    /* XXX more will be needed */
                    
137    /* Eye point, quaternion for orientation */
                    
138    bu_vls_printf(&str, "pov {%e %e %e}   {%e %e %e %e}   %e   {%e %e %e}  %e\n",
                    
                
 

Source

Language