X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FQuaternions.cpp;h=ff1ad7116b90ba2e73561d65047e53854db5de74;hb=c5dc3750efbc615b70917f19bb95cbd352cd00f6;hp=b73b047be1fce708ab30401576d3b6288cf90b35;hpb=24004d6ab1e68faaf85ece11b566449997da5013;p=lugaru.git diff --git a/Source/Quaternions.cpp b/Source/Quaternions.cpp index b73b047..ff1ad71 100644 --- a/Source/Quaternions.cpp +++ b/Source/Quaternions.cpp @@ -1,22 +1,21 @@ /* Copyright (C) 2003, 2010 - Wolfire Games +Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. -Lugaru is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +Lugaru is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, +Lugaru is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +along with Lugaru. If not, see . */ #include "Quaternions.h" @@ -280,9 +279,8 @@ bool PointInTriangle(Vector *p, Vector normal, float p11, float p12, float p13, bool LineFacet(Vector p1, Vector p2, Vector pa, Vector pb, Vector pc, Vector *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static Vector n, pa1, pa2, pa3; + static float denom, mu; + static Vector n; //Calculate the parameters for the plane n.x = (pb.y - pa.y) * (pc.z - pa.z) - (pb.z - pa.z) * (pc.y - pa.y); @@ -393,9 +391,8 @@ bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ *p2, XYZ *p3) bool LineFacet(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static XYZ n, pa1, pa2, pa3; + static float denom, mu; + static XYZ n; //Calculate the parameters for the plane n.x = (pb.y - pa.y) * (pc.z - pa.z) - (pb.z - pa.z) * (pc.y - pa.y); @@ -425,9 +422,8 @@ bool LineFacet(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p) float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static XYZ n, pa1, pa2, pa3; + static float denom, mu; + static XYZ n; //Calculate the parameters for the plane n.x = (pb.y - pa.y) * (pc.z - pa.z) - (pb.z - pa.z) * (pc.y - pa.y); @@ -457,9 +453,7 @@ float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p) float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ n, XYZ *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static XYZ pa1, pa2, pa3; + static float denom, mu; //Calculate the parameters for the plane d = - n.x * pa.x - n.y * pa.y - n.z * pa.z; @@ -484,9 +478,8 @@ float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ n, XYZ *p) float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static XYZ pa1, pa2, pa3, n; + static float denom, mu; + static XYZ n; //Calculate the parameters for the plane n.x = (pb->y - pa->y) * (pc->z - pa->z) - (pb->z - pa->z) * (pc->y - pa->y); @@ -516,9 +509,7 @@ float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *p) float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *n, XYZ *p) { static float d; - static float a1, a2, a3; - static float total, denom, mu; - static XYZ pa1, pa2, pa3; + static float denom, mu; //Calculate the parameters for the plane d = - n->x * pa->x - n->y * pa->y - n->z * pa->z;