static void GetPointFromBarycentric(vec3f dv[], double u, double v, DVector3 Out){ double w = 1.0 - u - v; Out.set0( dv[0].f[0]*w + dv[1].f[0]*u + dv[2].f[0]*v ); Out.set1( dv[0].f[1]*w + dv[1].f[1]*u + dv[2].f[1]*v ); Out.set2( dv[0].f[2]*w + dv[1].f[2]*u + dv[2].f[2]*v ); // Out.set0( dv[0].get3()*w + dv[1].get3()*u + dv[2].get3()*v ); //TODO ? // Out[0] = (dv[0][0] * w) + (dv[1][0] * u) + (dv[2][0] * v); // Out[1] = (dv[0][1] * w) + (dv[1][1] * u) + (dv[2][1] * v); // Out[2] = (dv[0][2] * w) + (dv[1][2] * u) + (dv[2][2] * v); // Out[3] = (dv[0][3] * w) + (dv[1][3] * u) + (dv[2][3] * v); }
static void GetPointFromBarycentric(vec3f dv[], double u, double v, DVector3 Out){ double w = 1.0 - u - v; Out.set0( dv[0].f[0]*w + dv[1].f[0]*u + dv[2].f[0]*v ); Out.set1( dv[0].f[1]*w + dv[1].f[1]*u + dv[2].f[1]*v ); Out.set2( dv[0].f[2]*w + dv[1].f[2]*u + dv[2].f[2]*v ); // Out.set0( dv[0].get3()*w + dv[1].get3()*u + dv[2].get3()*v ); //TODO ? // Out[0] = (dv[0][0] * w) + (dv[1][0] * u) + (dv[2][0] * v); // Out[1] = (dv[0][1] * w) + (dv[1][1] * u) + (dv[2][1] * v); // Out[2] = (dv[0][2] * w) + (dv[1][2] * u) + (dv[2][2] * v); // Out[3] = (dv[0][3] * w) + (dv[1][3] * u) + (dv[2][3] * v); }
/** * Set this vector equal to abs(this). */ public final void eqAbs() { set0( Math.abs(get0())); set1( Math.abs(get1())); set2( Math.abs(get2())); }
/** * Set this vector equal to abs(this). */ public final void eqAbs() { set0( Math.abs(get0())); set1( Math.abs(get1())); set2( Math.abs(get2())); }
private static void dMULTIPLYOP0_331(DVector3 A, DMatrix3C B, double[] C, int c) { A.set0( B.dotRow(0, C, c) );//dDOT(B.v, 0, C, c) ); A.set1( B.dotRow(1, C, c) );//dDOT(B.v, 4, C, c) ); A.set2( B.dotRow(2, C, c) );//dDOT(B.v, 8, C, c) ); } //TZ
private static void dMULTIPLYOP0_331(DVector3 A, DMatrix3C B, double[] C, int c) { A.set0( B.dotRow(0, C, c) );//dDOT(B.v, 0, C, c) ); A.set1( B.dotRow(1, C, c) );//dDOT(B.v, 4, C, c) ); A.set2( B.dotRow(2, C, c) );//dDOT(B.v, 8, C, c) ); } //TZ
public final DVector3 set(DVector3C v2) { set0( v2.get0() ); set1( v2.get1() ); set2( v2.get2() ); return this; }
public final DVector3 set(DVector3C v2) { set0( v2.get0() ); set1( v2.get1() ); set2( v2.get2() ); return this; }
public final DVector3 set(DVector3ColView v2) { set0( v2.get0() ); set1( v2.get1() ); set2( v2.get2() ); return this; }
/** * Sets current vector = v2 + v3. * @param v2 v2 * @param v3 v3 * @return Current vector. */ public final DVector3 eqSum(DVector3C v2, DVector3C v3) { set0( v2.get0() + v3.get0() ); set1( v2.get1() + v3.get1() ); set2( v2.get2() + v3.get2() ); return this; }
/** * Sets current vector = v2 + v3. * @param v2 v2 * @param v3 v3 * @return Current vector. */ public final DVector3 eqSum(DVector3C v2, DVector3C v3) { set0( v2.get0() + v3.get0() ); set1( v2.get1() + v3.get1() ); set2( v2.get2() + v3.get2() ); return this; }
private static void SET3_SUB(DVector3 a, double f1, DVector3 b, double f2, DVector3 c) { a.set0(b.get0()*f1 - c.get0()*f2); a.set1(b.get1()*f1 - c.get1()*f2); a.set2(b.get2()*f1 - c.get2()*f2); } private static void SET3_ADD(DVector3 a, double f1, DVector3 b, double f2, DVector3 c) {
/** * Expand this AABB to include the given point. * @param point point */ public void expand(DVector3C point) { if (point.get0() < _min.get0()) _min.set0(point.get0()); if (point.get1() < _min.get1()) _min.set1(point.get1()); if (point.get2() < _min.get2()) _min.set2(point.get2()); if (point.get0() > _max.get0()) _max.set0(point.get0()); if (point.get1() > _max.get1()) _max.set1(point.get1()); if (point.get2() > _max.get2()) _max.set2(point.get2()); }
/** * Expand this AABB to include the given AABB. * @param aabb aabb */ public void expand(DAABBC aabb) { if (aabb.getMin0() < _min.get0()) _min.set0(aabb.getMin0()); if (aabb.getMin1() < _min.get1()) _min.set1(aabb.getMin1()); if (aabb.getMin2() < _min.get2()) _min.set2(aabb.getMin2()); if (aabb.getMax0() > _max.get0()) _max.set0(aabb.getMax0()); if (aabb.getMax1() > _max.get1()) _max.set1(aabb.getMax1()); if (aabb.getMax2() > _max.get2()) _max.set2(aabb.getMax2()); }
/** * Expand this AABB to include the given point. * @param point point */ public void expand(DVector3C point) { if (point.get0() < _min.get0()) _min.set0(point.get0()); if (point.get1() < _min.get1()) _min.set1(point.get1()); if (point.get2() < _min.get2()) _min.set2(point.get2()); if (point.get0() > _max.get0()) _max.set0(point.get0()); if (point.get1() > _max.get1()) _max.set1(point.get1()); if (point.get2() > _max.get2()) _max.set2(point.get2()); }
/** * Expand this AABB to include the given AABB. * @param aabb aabb */ public void expand(DAABBC aabb) { if (aabb.getMin0() < _min.get0()) _min.set0(aabb.getMin0()); if (aabb.getMin1() < _min.get1()) _min.set1(aabb.getMin1()); if (aabb.getMin2() < _min.get2()) _min.set2(aabb.getMin2()); if (aabb.getMax0() > _max.get0()) _max.set0(aabb.getMax0()); if (aabb.getMax1() > _max.get1()) _max.set1(aabb.getMax1()); if (aabb.getMax2() > _max.get2()) _max.set2(aabb.getMax2()); }
/** * Cross product, set a = b x c. * @param a a * @param b b * @param c c */ public static void dCalcVectorCross3(DVector3 a, DVector3C b, DVector3C c) { a.set0( b.get1()*c.get2() - b.get2()*c.get1() ); a.set1( b.get2()*c.get0() - b.get0()*c.get2() ); a.set2( b.get0()*c.get1() - b.get1()*c.get0() ); } /**
/** * Set this vector = b x c. * @param b b * @param c c */ public final void eqCross(DVector3C b, DVector3C c) { set0( b.get1()*c.get2() - b.get2()*c.get1() ); set1( b.get2()*c.get0() - b.get0()*c.get2() ); set2( b.get0()*c.get1() - b.get1()*c.get0() ); }
/** * Set this vector = b x c. * @param b b * @param c c */ public final void eqCross(DVector3C b, DVector3C c) { set0( b.get1()*c.get2() - b.get2()*c.get1() ); set1( b.get2()*c.get0() - b.get0()*c.get2() ); set2( b.get0()*c.get1() - b.get1()*c.get0() ); }
/** * Cross product, set a = b x c. * @param a a * @param b b * @param c c */ public static void dCalcVectorCross3(DVector3 a, DVector3C b, DVector3C c) { a.set0( b.get1()*c.get2() - b.get2()*c.get1() ); a.set1( b.get2()*c.get0() - b.get0()*c.get2() ); a.set2( b.get0()*c.get1() - b.get1()*c.get0() ); } /**