public static Matrix4d buildReflection(Point4d point) { float xx = point.x * point.x; float xy = point.x * point.y; float xz = point.x * point.z; float xw = point.x * point.w; float yy = point.y * point.y; float yz = point.y * point.z; float yw = point.y * point.w; float zz = point.z * point.z; float zw = point.z * point.w; float ww = point.w * point.w; float pp_h = xx + yy + zz - ww; float temp = -2.0f / pp_h; Matrix4d ppTI31 = new Matrix4d(); ppTI31.SetRow(0, new Point4d(xx * temp + 1, xy * temp, xz * temp, -xw * temp)); ppTI31.SetRow(1, new Point4d(xy * temp, yy * temp + 1, yz * temp, -yw * temp)); ppTI31.SetRow(2, new Point4d(xz * temp, yz * temp, zz * temp + 1, -zw * temp)); ppTI31.SetRow(3, new Point4d(xw * temp, yw * temp, zw * temp, -ww * temp + 1)); return(ppTI31); }
public static Matrix4d operator *(Matrix4d lhs, float rhs) { Matrix4d temp = new Matrix4d(); temp.SetRow(0, lhs.GetRow(0)); temp.SetRow(1, lhs.GetRow(1)); temp.SetRow(2, lhs.GetRow(2)); temp.SetRow(3, lhs.GetRow(3)); return(temp); }