/** * get[4]. * @return min[2] */ @Override public double getMin2() { return _min.get2(); }
@Override public int hashCode() { return (int) (Double.doubleToRawLongBits(get0()) * Double.doubleToRawLongBits(get1()) * Double.doubleToRawLongBits(get2())); }
private void addOscillatingTorqueAbout(double tscale, DVector3 v) { //TZ static double a=0; body[0].addTorque( tscale*Math.cos(a_2) * v.get0(), tscale*Math.cos(a_2) * v.get1(), tscale * Math.cos(a_2) * v.get2()); a_2 += 0.02; }
public void setCol(int i, DVector3 v3) { int ofs = i*4; v[ofs] = v3.get0(); v[ofs+1] = v3.get1(); v[ofs+2] = v3.get2(); //v[ofs+3] = v3.v[3]; } public void set(double[] da, int da_ofs) {
/** * Return the 'dot' product of two vectors. * r = a0*b0 + a1*b1 + a2*b2; * @param da vector a * @param pos offset in a * @return (this) * b */ public final double dot(double[] da, int pos) { return get0()*da[pos] + get1()*da[pos+1] + get2()*da[pos+2]; }
/** * Set this vector equal to abs(this). */ public final void eqAbs() { set0( Math.abs(get0())); set1( Math.abs(get1())); set2( Math.abs(get2())); }
static void dConstructPlane(final DVector3 normal,final double distance, DVector4 plane) { plane.set( normal.get0(), normal.get1(), normal.get2(), distance); }
/** * @param space space * @param lxyz lengths * @return new box * @see #createBox(DSpace, double, double, double) */ public static DBox createBox(DSpace space, DVector3 lxyz) { return DxBox.dCreateBox((DxSpace) space, lxyz.get0(), lxyz.get1(), lxyz.get2()); }
/** * @param lxyz lengths * @return new Box * @see #createBox(double, double, double) */ public static DBox createBox(DVector3 lxyz) { return DxBox.dCreateBox(null, lxyz.get0(), lxyz.get1(), lxyz.get2()); } /**
private void updatecam() { xyz[0] = (float) (platpos.get0() + 3.3f); xyz[1] = (float) (platpos.get1() - 1.8f); xyz[2] = (float) (platpos.get2() + 2f); dsSetViewpoint (xyz, hpr); }
/** * Distance between this vector and a. * @param a a * @return distance */ @Override public final double distance(DVector3C a) { double r1 = get0()-a.get0(); double r2 = get1()-a.get1(); double r3 = get2()-a.get2(); return Math.sqrt(r1*r1 + r2*r2 + r3*r3); }
public final void set(DVector3 v2) { set0( v2.get0() ); set1( v2.get1() ); set2( v2.get2() ); }
static void ccdGeomToBox(final DxBox g, ccd_box_t box) { DVector3 dim = new DVector3(); ccdGeomToObj(g, box); g.getLengths(dim); box.dim[0] = dim.get0() / 2.; box.dim[1] = dim.get1() / 2.; box.dim[2] = dim.get2() / 2.; }
/** * Check whether two vectors contains the same values. * Due to Java's polymorphism handling, this method can be much faster than * v.equals(a). * @param a a * @return quality */ @Override public final boolean isEq(DVector3C a) { return get0()==a.get0() && get1()==a.get1() && get2()==a.get2(); }
/** * Return a new vector v0 = v(this) - v2. * @param v2 v2 * @return new vector */ @Override public final DVector3 reSub(DVector3C v2) { return new DVector3( get0() - v2.get0(), get1() - v2.get1(), get2() - v2.get2()); }
@Override void setRelativeValues() { DVector3 vec = new DVector3(); dJointGetHingeAnchor(vec); setAnchors( vec, anchor1, anchor2 ); dJointGetHingeAxis(vec); setAxes( vec.get0(), vec.get1(), vec.get2(), _axis1, _axis2 ); computeInitialRelativeRotation(); }
/** * 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()); }