public static XYZ ToXYZ(this PtArray ptArray, int index) { return(new XYZ { X = ptArray.Xyz[index], Y = ptArray.Xyz[index + 1], Z = ptArray.Xyz[index + 2] }); }
// Append vertices and return shift private void AppendVertices(Representation r, IfcSceneExportSummary summary, IEnumerable <XbimPoint3D> points) { PtArray ptArray = new PtArray(); foreach (var p in points) { // Append to vertices and apply scale p.AppendTo(ptArray.Xyz, summary.Scale); } r.Points.Add(ptArray); }
private void TestRunWith(PtArray ptArray, FaceBody body, FacetStarVisitor.InvestigationStrategy strategy) { var facetStar = new FacetStars(body, new PtOffsetArray(ptArray, SHIFT)); Assert.AreEqual(8, facetStar.Vertices.Count(), "8 vertices"); Assert.AreEqual(8, facetStar.Count, "8 stars"); // Use no visitor's index cache var visitor = new FacetStarVisitor(facetStar, (i) => false, strategy); var faces = new List <MeshPtOffsetArray>(); var facets = new HashSet <Facet>(); foreach (Facet f in visitor) { switch (visitor.Strategy) { case FacetStarVisitor.InvestigationStrategy.SameFaceFirst: if (!f.Meshed.Equals(faces.LastOrDefault())) { foreach (var known in faces.Take(faces.Count - 1)) { Assert.AreNotEqual(known, f.Meshed, "Face shouldn't be processed before"); } faces.Add(f.Meshed); Assert.IsTrue(visitor.IsNewFace); } else { Assert.IsFalse(visitor.IsNewFace); } break; } facets.Add(f); Assert.AreEqual(SHIFT, f.Shift); Assert.IsTrue(f.IsTriangle(), "Is Triangle"); Assert.IsTrue(f.IsValid(), "Is Valid"); } Assert.IsFalse(visitor.HasNextCandidate, "All facets have been processed"); Assert.AreEqual(12, facets.Count, "12 facets"); }
public PtOffsetArray(PtArray ptArray, uint offset = 0) { Offset = offset; Points = ptArray; }
protected virtual void DoVisit(PtArray node) => VisitChildren(node);