private static void LogCYLINDER(CYLINDER cyl, int i, string logHeader) { string cylinderHeader = logHeader + "CYLINDER "; Log.Trace(cylinderHeader + "index=" + i.ToString()); Log.Trace(cylinderHeader + "position=" + cyl.position.ToString()); Log.Trace(cylinderHeader + "igas=" + cyl.igas.ToString()); Log.Trace(cylinderHeader + "manifold=" + cyl.manifold); Log.Trace(cylinderHeader + "cylinderId=" + cyl.cylinderId.ToString()); LogCOMPONENT((COMPONENT)cyl, cylinderHeader); LogSpecifiedDate(cyl.expirationDate, cyl.expirationDateSpecified, cylinderHeader, "expirationDate"); Log.Trace(cylinderHeader + "cylinderCode=" + cyl.cylinderCode); Log.Trace(cylinderHeader + "currentPressure=" + cyl.currentPressure); LogSpecifiedDate(cyl.refillDate, cyl.refillDateSpecified, cylinderHeader, "refillDate"); LogSpecifiedDate(cyl.installTime, cyl.installTimeSpecified, cylinderHeader, "installTime"); cylinderHeader = cylinderHeader + " "; if (cyl.cylinderGas != null) { for (int g = 0; g < cyl.cylinderGas.Length; g++) { LogCYLINDER_GAS(cyl.cylinderGas[g], g, cylinderHeader); } } }
public CYLINDER(CYLINDER src) { Center = src.Center; AxisX = src.AxisX; AxisY = src.AxisY; AxisZ = src.AxisZ; HalfLen = src.HalfLen; Radius = src.Radius; }
public bool Import(CYLINDER cylinder, int nbFaceInSide) { if (nbFaceInSide < 3) { return(false); } float fHalfRad = Mathf.PI / nbFaceInSide; float fRad = fHalfRad * 2; float fNewR = cylinder.Radius / Mathf.Cos(fHalfRad); Matrix4x4 mat = Matrix4x4.identity; mat.SetRow(0, cylinder.AxisX); mat.SetRow(1, cylinder.AxisY); mat.SetRow(2, cylinder.AxisZ); mat.SetRow(3, cylinder.Center); Vector3 vHalfHigh = cylinder.AxisY * cylinder.HalfLen; int nAllCount = nbFaceInSide * 2; Vector3[] vertBuf = new Vector3[nAllCount]; Vector3 p = Vector3.zero; int idx = 0; float fTheta = 0; for (int i = 0; i < nbFaceInSide; ++i) { p.Set(0, 0, 0); p.z -= fNewR * Mathf.Cos(fTheta); p.x += fNewR * Mathf.Sin(fTheta); p = mat.MultiplyPoint3x4(p); vertBuf[idx] = p + vHalfHigh; vertBuf[idx + 1] = p - vHalfHigh; idx += 2; fTheta += fRad; } Vector3 vTopCenter = cylinder.Center + vHalfHigh; float fTopD = Vector3.Dot(cylinder.AxisY, vTopCenter); CovFace faceTop = new CovFace(); faceTop.Normal = cylinder.AxisY; faceTop.Dist = fTopD; Vector3 vBtmCenter = cylinder.Center - vHalfHigh; float fBtmD = Vector3.Dot(cylinder.AxisY * -1, vBtmCenter); CovFace faceBottom = new CovFace(); faceBottom.Normal = cylinder.AxisY * -1; faceBottom.Dist = fBtmD; return(CreateConvexHullData(vertBuf, faceTop, faceBottom)); }