public static void CrossToOutUnsafe(Vec3 a, Vec3 b, Vec3 result) { Debug.Assert(result != b); Debug.Assert(result != a); result.X = a.Y * b.Z - a.Z * b.Y; result.Y = a.Z * b.X - a.X * b.Z; result.Z = a.X * b.Y - a.Y * b.X; }
public static void crossToOut(Vec3 a, Vec3 b, Vec3 out_Renamed) { float tempy = a.z * b.x - a.x * b.z; float tempz = a.x * b.y - a.y * b.x; out_Renamed.x = a.y * b.z - a.z * b.y; out_Renamed.y = tempy; out_Renamed.z = tempz; }
public static void crossToOutUnsafe(Vec3 a, Vec3 b, Vec3 out_Renamed) { Debug.Assert(out_Renamed != b); Debug.Assert(out_Renamed != a); out_Renamed.x = a.y * b.z - a.z * b.y; out_Renamed.y = a.z * b.x - a.x * b.z; out_Renamed.z = a.x * b.y - a.y * b.x; }
public static void CrossToOut(Vec3 a, Vec3 b, Vec3 result) { float tempy = a.Z * b.X - a.X * b.Z; float tempz = a.X * b.Y - a.Y * b.X; result.X = a.Y * b.Z - a.Z * b.Y; result.Y = tempy; result.Z = tempz; }
public virtual Vec3 sub(Vec3 argVec) { return new Vec3(x - argVec.x, y - argVec.y, z - argVec.z); }
public Vec3 Add(Vec3 argVec) { return new Vec3(X + argVec.X, Y + argVec.Y, Z + argVec.Z); }
public static Vec3 Cross(Vec3 a, Vec3 b) { return new Vec3(a.Y * b.Z - a.Z * b.Y, a.Z * b.X - a.X * b.Z, a.X * b.Y - a.Y * b.X); }
public Vec3 SubLocal(Vec3 argVec) { X -= argVec.X; Y -= argVec.Y; Z -= argVec.Z; return this; }
public Vec3 Set(Vec3 argVec) { X = argVec.X; Y = argVec.Y; Z = argVec.Z; return this; }
/// <param name="argWorld"></param> /// <param name="def"></param> protected internal WeldJoint(IWorldPool argWorld, WeldJointDef def) : base(argWorld, def) { m_localAnchorA = new Vec2(def.localAnchorA); m_localAnchorB = new Vec2(def.localAnchorB); m_referenceAngle = def.referenceAngle; m_frequencyHz = def.frequencyHz; m_dampingRatio = def.dampingRatio; m_impulse = new Vec3(); m_impulse.setZero(); }
public virtual Vec3 add(Vec3 argVec) { return new Vec3(x + argVec.x, y + argVec.y, z + argVec.z); }
public static float dot(Vec3 a, Vec3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
public static Vec3 cross(Vec3 a, Vec3 b) { return new Vec3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); }
public Vec3(Vec3 argCopy) { x = argCopy.x; y = argCopy.y; z = argCopy.z; }
public virtual Vec3 subLocal(Vec3 argVec) { x -= argVec.x; y -= argVec.y; z -= argVec.z; return this; }
/// <param name="argWorld"></param> /// <param name="def"></param> protected internal WeldJoint(IWorldPool argWorld, WeldJointDef def) : base(argWorld, def) { LocalAnchorA = new Vec2(def.LocalAnchorA); LocalAnchorB = new Vec2(def.LocalAnchorB); m_referenceAngle = def.ReferenceAngle; Frequency = def.FrequencyHz; DampingRatio = def.DampingRatio; m_impulse = new Vec3(); m_impulse.SetZero(); }
public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def) : base(argWorld, def) { LocalAnchorA = new Vec2(def.LocalAnchorA); LocalAnchorB = new Vec2(def.LocalAnchorB); LocalXAxisA = new Vec2(def.LocalAxisA); LocalXAxisA.Normalize(); LocalYAxisA = new Vec2(); Vec2.CrossToOutUnsafe(1f, LocalXAxisA, LocalYAxisA); ReferenceAngle = def.ReferenceAngle; Impulse = new Vec3(); MotorMass = 0.0f; MotorImpulse = 0.0f; LowerTranslation = def.LowerTranslation; UpperTranslation = def.UpperTranslation; m_maxMotorForce = def.MaxMotorForce; m_motorSpeed = def.MotorSpeed; m_limitEnabled = def.EnableLimit; m_motorEnabled = def.EnableMotor; LimitState = LimitState.Inactive; K = new Mat33(); Axis = new Vec2(); Perp = new Vec2(); }
public static void MulToOutUnsafe(Mat33 a, Vec3 v, Vec3 result) { Debug.Assert(result != v); result.X = v.X * a.Ex.X + v.Y * a.Ey.X + v.Z * a.Ez.X; result.Y = v.X * a.Ex.Y + v.Y * a.Ey.Y + v.Z * a.Ez.Y; result.Z = v.X * a.Ex.Z + v.Y * a.Ey.Z + v.Z * a.Ez.Z; }
public Vec3 AddLocal(Vec3 argVec) { X += argVec.X; Y += argVec.Y; Z += argVec.Z; return this; }
// djm pooling from below /// <summary> /// Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse /// in one-shot cases. /// </summary> /// <param name="b"></param> /// <returns></returns> public Vec3 Solve33(Vec3 b) { Vec3 x = new Vec3(); Solve33ToOut(b, x); return x; }
public Vec3 Sub(Vec3 argVec) { return new Vec3(X - argVec.X, Y - argVec.Y, Z - argVec.Z); }
/// <summary> /// Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse /// in one-shot cases. /// </summary> /// <param name="b"></param> /// <param name="result">the result</param> public void Solve33ToOut(Vec3 b, Vec3 result) { Debug.Assert(b != result); Vec3.CrossToOutUnsafe(Ey, Ez, result); float det = Vec3.Dot(Ex, result); if (det != 0.0f) { det = 1.0f / det; } Vec3.CrossToOutUnsafe(Ey, Ez, result); float x = det * Vec3.Dot(b, result); Vec3.CrossToOutUnsafe(b, Ez, result); float y = det * Vec3.Dot(Ex, result); Vec3.CrossToOutUnsafe(Ey, b, result); float z = det * Vec3.Dot(Ex, result); result.X = x; result.Y = y; result.Z = z; }
public Vec3(Vec3 argCopy) { X = argCopy.X; Y = argCopy.Y; Z = argCopy.Z; }
public Mat33() { Ex = new Vec3(); Ey = new Vec3(); Ez = new Vec3(); }
public Mat33(Vec3 argCol1, Vec3 argCol2, Vec3 argCol3) { Ex = argCol1.Clone(); Ey = argCol2.Clone(); Ez = argCol3.Clone(); }
// / Multiply a matrix times a vector. public static Vec3 Mul(Mat33 a, Vec3 v) { return new Vec3(v.X * a.Ex.X + v.Y * a.Ey.X + v.Z + a.Ez.X, v.X * a.Ex.Y + v.Y * a.Ey.Y + v.Z * a.Ez.Y, v.X * a.Ex.Z + v.Y * a.Ey.Z + v.Z * a.Ez.Z); }
public static float Dot(Vec3 a, Vec3 b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; }
public static void MulToOut(Mat33 a, Vec3 v, Vec3 result) { float tempy = v.X * a.Ex.Y + v.Y * a.Ey.Y + v.Z * a.Ez.Y; float tempz = v.X * a.Ex.Z + v.Y * a.Ey.Z + v.Z * a.Ez.Z; result.X = v.X * a.Ex.X + v.Y * a.Ey.X + v.Z * a.Ez.X; result.Y = tempy; result.Z = tempz; }
public PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def) : base(argWorld, def) { m_localAnchorA = new Vec2(def.localAnchorA); m_localAnchorB = new Vec2(def.localAnchorB); m_localXAxisA = new Vec2(def.localAxisA); m_localXAxisA.normalize(); m_localYAxisA = new Vec2(); Vec2.crossToOutUnsafe(1f, m_localXAxisA, m_localYAxisA); m_referenceAngle = def.referenceAngle; m_impulse = new Vec3(); m_motorMass = 0.0f; m_motorImpulse = 0.0f; m_lowerTranslation = def.lowerTranslation; m_upperTranslation = def.upperTranslation; m_maxMotorForce = def.maxMotorForce; m_motorSpeed = def.motorSpeed; m_enableLimit = def.enableLimit; m_enableMotor = def.enableMotor; m_limitState = LimitState.INACTIVE; m_K = new Mat33(); m_axis = new Vec2(); m_perp = new Vec2(); }
public virtual Vec3 set_Renamed(Vec3 argVec) { x = argVec.x; y = argVec.y; z = argVec.z; return this; }