pt2plane.c
来自「图形处理算法合集3:包括图形处理、帧缓存技术、渲染、矩阵运算、建模方法」· C语言 代码 · 共 30 行
C
30 行
/****************************************************************************** Signed Distance from Point to Plane Author: Priamos Georgiades******************************************************************************/#include<stdio.h>typedef struct vect3str { float x, y, z; } vect3;typedef struct vect4str { float x, y, z, w; } vect4;#define Vect3Dot(v1, v2) ((v1).x * (v2).x + (v1).y * (v2).y + (v1).z * (v2).z)/*Compute the distance from a point to a plane. The plane ispleq->x * X + pleq->y * Y + pleq->z * Z + pleq->w = 0.The distance is positive if on same side as the normal, otherwise negative.Assume the plane normal to be of unit length.*/float Pt2Plane(vect3 *pt, vect4 *pleq){float dist;dist = Vect3Dot(*pleq, *pt) + pleq->w;return(dist);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?