// ------------------------------------------------------- public void Exec(string fileName, out BxVec3F min, out BxVec3F max, out BxCmSeparatePatch_Object patch) { JsonPatchInfo json; ReadPatch(fileName, out json); FromJson(json, out min, out max, out patch); }
public BxVec3F(BxVec3F a) { fDt = new float[KNumVec3F]; X = a.X; Y = a.Y; Z = a.Z; }
public BxBezier6Line3F(BxVec3F[] /*7*/ a) { fDt = new BxVec3F[7]; for (byte i = 0; i < 7; i++) { fDt[i] = new BxVec3F(a[i]); } }
// ------ public BxBezier6Line3F() { fDt = new BxVec3F[7]; for (byte i = 0; i < 7; i++) { fDt[i] = new BxVec3F(); } }
// ------ public BxBezier5Line3F() { fDt = new BxVec3F[6]; for (byte i = 0; i < 6; i++) { fDt[i] = new BxVec3F(); } }
public BxBezier3Line3F(BxVec3F[] /*4*/ a) { fDt = new BxVec3F[4]; for (byte i = 0; i < 4; i++) { fDt[i] = new BxVec3F(a[i]); } }
// ------ public BxBezier3Line3F() { fDt = new BxVec3F[4]; for (byte i = 0; i < 4; i++) { fDt[i] = new BxVec3F(); } }
public BxBezier2Line3F(BxVec3F[] /*3*/ a) { fDt = new BxVec3F[3]; for (byte i = 0; i < 3; i++) { fDt[i] = new BxVec3F(a[i]); } }
// ------ public BxBezier2Line3F() { fDt = new BxVec3F[3]; for (byte i = 0; i < 3; i++) { fDt[i] = new BxVec3F(); } }
public BxBezier5Line3F(BxVec3F[] /*6*/ a) { fDt = new BxVec3F[6]; for (byte i = 0; i < 6; i++) { fDt[i] = new BxVec3F(a[i]); } }
// ------ public BxVec3F Normalize() { BxErr errResult; BxVec3F result = Normalize(out errResult); Debug.Assert(errResult == BxErr.KBxErrSuccess); return(result); }
private void FromJson_MinMax(List <float> minMax, out BxVec3F min, out BxVec3F max) { min = new BxVec3F(); max = new BxVec3F(); for (byte i = 0; i < 3; i++) { min[i] = minMax[0 + i]; max[i] = minMax[3 + i]; } }
private void Correct(BxBezier3Line3F[] /*7*/ transBez3, uint surfaceNo, byte hvId, BxCmSeparatePatch_Object dst) { BxVec3F[] handle = new BxVec3F[2]; for (byte i = 0; i < 7; i++) { CorrectMain(transBez3[i], handle); for (byte j = 0; j < 2; j++) { if (handle[j] != null) { byte srcBez6Idx = 0; if (j == 1) { srcBez6Idx = 3; } dst[surfaceNo].SurfaceEdge[hvId][j].Inner[i] = handle[j] + transBez3[i][srcBez6Idx]; } } } }
private void FromJson(JsonPatchInfo json, out BxVec3F min, out BxVec3F max, out BxCmSeparatePatch_Object patch) { bool success; min = null; max = null; patch = new BxCmSeparatePatch_Object(); if (json == null || json.surface == null || json.minMax == null) { patch = null; return; } FromJson_MinMax(json.minMax, out min, out max); uint numSurface = 0; foreach (JsonPatchInfo_Surface jsonSurface in json.surface) { numSurface++; } patch = new BxCmSeparatePatch_Object(); patch.Alloc(numSurface); uint cntSurface = 0; foreach (JsonPatchInfo_Surface jsonSurface in json.surface) { if (jsonSurface.vertex == null || jsonSurface.surfaceEdge == null) { patch = null; return; } patch[cntSurface].Alloc(); FromJson_Vertex(jsonSurface.vertex, patch[cntSurface]); success = FromJson_SurfaceEdge(jsonSurface.surfaceEdge, patch[cntSurface]); if (success == false) { patch = null; return; } success = FromJson_TNodeType(jsonSurface.tNodeType, patch[cntSurface]); if (success == false) { patch = null; return; } success = FromJson_PreDivided(jsonSurface.preDivided, patch[cntSurface]); if (success == false) { patch = null; return; } cntSurface++; } Debug.Assert(cntSurface == numSurface); }
private void ToVector3(BxVec3F src, ref Vector3 dst) { dst.X = src.X; dst.Y = src.Y; dst.Z = src.Z; }
private void CorrectMain(BxBezier3Line3F transBez3, BxVec3F[] /*2*/ dstHandle) { sbyte lIdxNoHandleZero, rIdxNoHandleZero; transBez3.GetIdxNoHandleZero(out lIdxNoHandleZero, out rIdxNoHandleZero); sbyte dim = ( sbyte )(rIdxNoHandleZero - lIdxNoHandleZero + 1); dstHandle[0] = null; dstHandle[1] = null; Debug.Assert(1 <= dim && dim <= 3); if (dim == 3) { return; } float lenBetweenVtx = (transBez3[3] - transBez3[0]).Length; float minimumLen = lenBetweenVtx * BxMathF.KDirectionEpsRatioF; if (minimumLen < BxMathF.KDirectionEpsRatioF) { minimumLen = BxMathF.KDirectionEpsRatioF; } if (dim == 2) { if (lIdxNoHandleZero > 0) { dstHandle[0] = (transBez3[2] - transBez3[0]).Normalize() * minimumLen; } else { Debug.Assert(rIdxNoHandleZero < 2); dstHandle[1] = (transBez3[1] - transBez3[3]).Normalize() * minimumLen; } } else if (dim == 1) { if (rIdxNoHandleZero == 2) { dstHandle[0] = (transBez3[3] - transBez3[0]).Normalize() * minimumLen; BxVec3F vecR = transBez3[2] - transBez3[3]; float lenR = vecR.Length; dstHandle[1] = vecR * ((lenR - minimumLen) / lenR); } else if (lIdxNoHandleZero == 0) { BxVec3F vecL = transBez3[1] - transBez3[0]; float lenL = vecL.Length; dstHandle[0] = vecL * ((lenL - minimumLen) / lenL); dstHandle[1] = (transBez3[0] - transBez3[3]).Normalize() * minimumLen; } else { BxVec3F handle = (transBez3[3] - transBez3[0]).Normalize() * minimumLen; dstHandle[0] = handle.Copy; dstHandle[1] = -handle; } } }
public void Set(BxVec3F src) { X = src.X; Y = src.Y; Z = src.Z; }