qxform.c

来自「模型冲突检测」· C语言 代码 · 共 69 行

C
69
字号
/***************************************************************************** *    qxform.c - does xform of a vector        	Session:		    - Enter quaternion [(x, y, z), w] (no punctuation)	    - Enter vector to be xformed	    - Show quat as col matrix	    - Xform vector and print result	        rich holloway,  9/25/90	     * *****************************************************************************/#include <stdio.h>#include "quat.h"intmain(int argc, char *argv[]){    q_type	multQuat;    q_type 	xformedPoint;    q_type  	point;        double  	matrix[4][4];/* * read in, echo, and normalize 2 quaternions */printf("\nEnter xform quaternion: (vec, s) ");scanf("%lf %lf %lf %lf",     	&multQuat[0], &multQuat[1], &multQuat[2], &multQuat[3]);printf("\nEnter point: (x y z) ");scanf("%lf %lf %lf",     	&point[Q_X], &point[Q_Y], &point[Q_Z]);point[Q_W] = 0.0;/* * matrix of product quat */q_to_col_matrix(matrix, multQuat);printf("Transformation (column) matrix:\n");q_print_matrix(matrix);/*  * xformedPoint = (multQuat * candQuat) * invertedQuat	 */q_xform(xformedPoint, multQuat, point);printf("Xform Result:\n");q_print(xformedPoint);return(0);}	/* main */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?