public void Vector3Sub(MmdVector3 pvec3Sub1, MmdVector3 pvec3Sub2) { this.x = pvec3Sub1.x - pvec3Sub2.x; this.y = pvec3Sub1.y - pvec3Sub2.y; this.z = pvec3Sub1.z - pvec3Sub2.z; return; }
public void setValue(MmdVector3 v) { this.x = v.x; this.y = v.y; this.z = v.z; return; }
public void Vector3Add(MmdVector3 pvec3Add1, MmdVector3 pvec3Add2) { this.x = pvec3Add1.x + pvec3Add2.x; this.y = pvec3Add1.y + pvec3Add2.y; this.z = pvec3Add1.z + pvec3Add2.z; return; }
public void Vector3Normalize(MmdVector3 pvec3Src) { double fSqr = (1.0f / Math.Sqrt(pvec3Src.x * pvec3Src.x + pvec3Src.y * pvec3Src.y + pvec3Src.z * pvec3Src.z)); this.x = (float)(pvec3Src.x * fSqr); this.y = (float)(pvec3Src.y * fSqr); this.z = (float)(pvec3Src.z * fSqr); return; }
public void Vector3Lerp(MmdVector3 pvec3Src1, MmdVector3 pvec3Src2, float fLerpValue) { float t0 = 1.0f - fLerpValue; this.x = pvec3Src1.x * t0 + pvec3Src2.x * fLerpValue; this.y = pvec3Src1.y * t0 + pvec3Src2.y * fLerpValue; this.z = pvec3Src1.z * t0 + pvec3Src2.z * fLerpValue; return; }
public static MmdVector3[] createArray(int i_length) { MmdVector3[] ret = new MmdVector3[i_length]; for (int i = 0; i < i_length; i++) { ret[i] = new MmdVector3(); } return(ret); }
public void Vector3Rotate(MmdVector3 pVec3In, MmdMatrix matRotate) { double vx = pVec3In.x; double vy = pVec3In.y; double vz = pVec3In.z; this.x = (float)(vx * matRotate.m[0, 0] + vy * matRotate.m[1, 0] + vz * matRotate.m[2, 0]); this.y = (float)(vx * matRotate.m[0, 1] + vy * matRotate.m[1, 1] + vz * matRotate.m[2, 1]); this.z = (float)(vx * matRotate.m[0, 2] + vy * matRotate.m[1, 2] + vz * matRotate.m[2, 2]); return; }
public void Vector3Transform(MmdVector3 pVec3In, MmdMatrix matTransform) { double vx = pVec3In.x; double vy = pVec3In.y; double vz = pVec3In.z; this.x = (float)(vx * matTransform.m[0, 0] + vy * matTransform.m[1, 0] + vz * matTransform.m[2, 0] + matTransform.m[3, 0]); this.y = (float)(vx * matTransform.m[0, 1] + vy * matTransform.m[1, 1] + vz * matTransform.m[2, 1] + matTransform.m[3, 1]); this.z = (float)(vx * matTransform.m[0, 2] + vy * matTransform.m[1, 2] + vz * matTransform.m[2, 2] + matTransform.m[3, 2]); return; }
public void Vector3CrossProduct(MmdVector3 pvec3Src1, MmdVector3 pvec3Src2) { float vx1 = pvec3Src1.x; float vy1 = pvec3Src1.y; float vz1 = pvec3Src1.z; float vx2 = pvec3Src2.x; float vy2 = pvec3Src2.y; float vz2 = pvec3Src2.z; this.x = vy1 * vz2 - vz1 * vy2; this.y = vz1 * vx2 - vx1 * vz2; this.z = vx1 * vy2 - vy1 * vx2; }
public void QuaternionCreateEuler(MmdVector3 pvec3EulerAngle) { double xRadian = pvec3EulerAngle.x * 0.5; double yRadian = pvec3EulerAngle.y * 0.5; double zRadian = pvec3EulerAngle.z * 0.5; double sinX = Math.Sin(xRadian); double cosX = Math.Cos(xRadian); double sinY = Math.Sin(yRadian); double cosY = Math.Cos(yRadian); double sinZ = Math.Sin(zRadian); double cosZ = Math.Cos(zRadian); // XYZ this.x = sinX * cosY * cosZ - cosX * sinY * sinZ; this.y = cosX * sinY * cosZ + sinX * cosY * sinZ; this.z = cosX * cosY * sinZ - sinX * sinY * cosZ; this.w = cosX * cosY * cosZ + sinX * sinY * sinZ; }
public void QuaternionCreateAxis(MmdVector3 pvec3Axis, double fRotAngle) { if (Math.Abs(fRotAngle) < 0.0001f) { this.x = this.y = this.z = 0.0f; this.w = 1.0f; } else { fRotAngle *= 0.5f; double fTemp = Math.Sin(fRotAngle); this.x = pvec3Axis.x * fTemp; this.y = pvec3Axis.y * fTemp; this.z = pvec3Axis.z * fTemp; this.w = Math.Cos(fRotAngle); } return; }
public double Vector3DotProduct(MmdVector3 pvec3Src2) { return(this.x * pvec3Src2.x + this.y * pvec3Src2.y + this.z * pvec3Src2.z); }
public void Vector3MulAdd(MmdVector3 pvec3Add1, MmdVector3 pvec3Add2, float fRate) { this.x = pvec3Add1.x + pvec3Add2.x * fRate; this.y = pvec3Add1.y + pvec3Add2.y * fRate; this.z = pvec3Add1.z + pvec3Add2.z * fRate; }