public void CylG_boundingbox() { var cgd = new CylGridData(); var cd = new CylData(); cd.Add(new GeometryLib.PointCyl(1, 0, 0)); cd.Add(new GeometryLib.PointCyl(1, Math.PI, 1)); cd.Add(new GeometryLib.PointCyl(1, Math.PI / 2, 1)); cd.Add(new GeometryLib.PointCyl(1, 3 * Math.PI / 2, 1)); cgd.Add(cd); var cd2 = new CylData(); cd2.Add(new GeometryLib.PointCyl(2, 0, 0)); cd2.Add(new GeometryLib.PointCyl(2, Math.PI, 1)); cd2.Add(new GeometryLib.PointCyl(2, Math.PI / 2, 1)); cd2.Add(new GeometryLib.PointCyl(2, 3 * Math.PI / 2, 1)); cgd.Add(cd2); var bb = cgd.BoundingBox(); Assert.AreEqual(2.0, bb.Max.X); Assert.AreEqual(-2.0, bb.Min.X); Assert.AreEqual(2.0, bb.Max.Y); Assert.AreEqual(-2.0, bb.Min.Y); Assert.AreEqual(0, bb.Min.Z); Assert.AreEqual(1.0, bb.Max.Z); }
static public CylGridData ColorCodeData(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, COLORCODE colorOption) { try { var resultGrid = new CylGridData(); foreach (var cylstrip in correctedRingList) { var resultStrip = new CylData(correctedRingList[0].FileName); foreach (PointCyl pt in cylstrip) { var c = System.Drawing.Color.LightGray; switch (colorOption) { case COLORCODE.GREEN_RED: c = MapGreenRedColor(barrel, pt); break; case COLORCODE.RAINBOW: c = MapRainbowColor(barrel, pt); break; } pt.Col = c; resultStrip.Add(new PointCyl(pt.R, pt.ThetaRad, pt.Z, c, pt.ID)); } resultGrid.Add(resultStrip); } return(resultGrid); } catch (Exception) { Debug.WriteLine(" exception in colorCodeData"); throw; } }
public void CylGD_countOK() { var cgd = new CylGridData(); var cd = new CylData(); cd.Add(new GeometryLib.PointCyl(1, 0, 0)); cd.Add(new GeometryLib.PointCyl(1, Math.PI, 1)); cd.Add(new GeometryLib.PointCyl(1, Math.PI / 2, 1)); cd.Add(new GeometryLib.PointCyl(1, 3 * Math.PI / 2, 1)); cgd.Add(cd); var cd2 = new CylData(); cd2.Add(new GeometryLib.PointCyl(2, 0, 0)); cd2.Add(new GeometryLib.PointCyl(2, Math.PI, 1)); cd2.Add(new GeometryLib.PointCyl(2, Math.PI / 2, 1)); cd2.Add(new GeometryLib.PointCyl(2, 3 * Math.PI / 2, 1)); cgd.Add(cd2); Assert.AreEqual(2, cgd.Count); Assert.AreEqual(4, cgd[0].Count); Assert.AreEqual(4, cgd[0].Count); Assert.AreEqual(4, cgd[1].Count); }
/// <summary> /// separate point list into rings from spiral /// </summary> /// <returns></returns> static CylGridData BuildRingList(MultiRingScript script, double[] rawInputData) { try { int revCount = 0; int i = 0; double thetaStart = GeomUtilities.ToRadians(script.StartLocation.Adeg); double thetaEnd = Math.Abs(thetaStart + (Math.Sign(script.AngleIncrement) * Math.PI * 2.0)); var pointList = new CylData(script.InputDataFileName); var uncorrectedGridData = new CylGridData(); double z = script.StartLocation.X;; int ringStartIndex = 0; int ringEndIndex = ringStartIndex + script.PointsPerRevolution; int nextRingStartIndex = ringEndIndex + script.PointsToSkip; while (i < rawInputData.Length) { var p = GetRadiusPoint(i, rawInputData[i], z, script); i++; if (i >= ringStartIndex && i < ringEndIndex) { pointList.Add(p); } if (i == ringEndIndex) { revCount++; uncorrectedGridData.Add(pointList); } if (i == nextRingStartIndex) { z += script.RingSpacing; pointList = new CylData(script.InputDataFileName); ringStartIndex = nextRingStartIndex; ringEndIndex = ringStartIndex + script.PointsPerRevolution; nextRingStartIndex = ringEndIndex + script.PointsToSkip; } } return(uncorrectedGridData); } catch (Exception) { throw; } }
/// <summary> /// separate point list into rings from spiral /// </summary> /// <returns></returns> static CylGridData BuildGridList(SpiralInspScript script, double[] rawInputData) { try { int pointCountPerRev = 0; int revCount = 0; int i = 0; double thetaStart = GeomUtilities.ToRadians(script.StartLocation.Adeg); double thetaEnd = Math.Abs(thetaStart + (Math.Sign(script.AngleIncrement) * Math.PI * 2.0)); var pointList = new CylData(script.InputDataFileName); var uncorrectedGridData = new CylGridData(); double zStart = script.StartLocation.X; double z = zStart; while (i < rawInputData.Length) { var p = GetRadiusPoint(i, rawInputData[i], z, script); var thA = Math.Abs(p.ThetaRad); i++; if (thA >= thetaStart && thA < thetaEnd) { pointList.Add(p); pointCountPerRev++; } if (thA >= thetaEnd) { revCount++; z += script.PitchInch; pointCountPerRev = 0; uncorrectedGridData.Add(pointList); pointList = new CylData(script.InputDataFileName); thetaStart = thetaEnd; thetaEnd = Math.Abs(thetaStart + (Math.Sign(script.AngleIncrement) * Math.PI * 2.0)); } } return(uncorrectedGridData); } catch (Exception) { throw; } }