private void ExpectOppositeEdgesAreDifferent(VerticalPrismalSurface surface, IPolysurfaceVertex v1, IPolysurfaceVertex v2) { var edge1 = surface.GetEdge(v1, v2); var edge2 = surface.GetEdge(v2, v1); Expect(edge1, Is.Not.EqualTo(edge2)); }
// for a forward edge index is the source vertex; for a backward edge index is the target vertex public HorizontalEdge(VerticalPrismalSurface parent, int index, BaseSide baseSide, Direction direction = Direction.Forward) { _parent = parent; _index = index; _baseSide = baseSide; _direction = direction; }
private void ExpectOppositeEdgesAreEqualAsUndirected(VerticalPrismalSurface surface, IPolysurfaceVertex v1, IPolysurfaceVertex v2) { var edge1 = surface.GetEdge(v1, v2); var edge2 = surface.GetEdge(v2, v1); Expect(edge1, Is.EqualTo(edge2).Using(surface.UndirectedEdgeComparer)); }
private void ExpectTwoConstructionsOfEdgeCoincide(VerticalPrismalSurface surface, IPolysurfaceVertex v1, IPolysurfaceVertex v2) { var edge1 = surface.GetEdge(v1, v2); var edge2 = v1.Edges.Where(e => e.Target.Equals(v2)).Single(); Expect(edge1, Is.EqualTo(edge2)); Expect(edge1, Is.EqualTo(edge2).Using(surface.UndirectedEdgeComparer)); }
public void ZRange_is_equal_to_received_in_ctor() { var @base = Mock.Of <IOpenPolyline>(); var zRange = new Interval(-3.14, 2.88); var surface = new VerticalPrismalSurface(@base, zRange); Expect(surface.ZRange, Is.EqualTo(zRange)); }
public void Base_is_same_as_received_in_ctor() { var @base = Mock.Of <IOpenPolyline>(); var zRange = new Interval(-3.14, 2.88); var surface = new VerticalPrismalSurface(@base, zRange); Expect(surface.Base, Is.SameAs(@base)); }
private void ExpectGetEdgeReturnsCorrectEdge(VerticalPrismalSurface surface, IPolysurfaceVertex v1, IPolysurfaceVertex v2) { var edge1 = surface.GetEdge(v1, v2); Expect(edge1, Is.Not.Null); Expect(edge1.Source, Is.EqualTo(v1)); Expect(edge1.Target, Is.EqualTo(v2)); var edge2 = surface.GetEdge(v2, v1); Expect(edge2, Is.Not.Null); Expect(edge2.Source, Is.EqualTo(v2)); Expect(edge2.Target, Is.EqualTo(v1)); }
public void Face_Normal_is_consistent_with_edge_order_for_convex_base([ValueSource("GetFaceOrientationTestCases")] FaceOrientationTestCase testCase) { var baseVertices = new List <Vector2> { new Vector2(-1, +2), new Vector2(+1, +2), new Vector2(+2, +1), new Vector2(+2, -1), new Vector2(+1, -2), new Vector2(-1, -2), new Vector2(-2, -1), new Vector2(-2, +1) }; var line = new ClosedPolyline(baseVertices); var @base = testCase.IsOrientedOutside ? line.AsReverse() : line; var zRange = new Interval(-3.14, 2.88); var surface = new VerticalPrismalSurface(@base, zRange, isClosed: true); IPolysurfaceFace face; if (testCase.IsVertical) { face = surface.GetVerticalFace(2); } else { face = surface.GetHorizontalFace(testCase.Side); } var edge1 = face.Edges.ElementAt(0); var edge2 = face.Edges.ElementAt(1); var expected = edge1.Vector().Cross(edge2.Vector()); Expect(face.Normal * expected, Is.Positive); }
public HorizontalFace(VerticalPrismalSurface parent, BaseSide side) { _parent = parent; _side = side; }
public VerticalFace(VerticalPrismalSurface parent, int index) { _parent = parent; _index = index; }
public FaceCollection(VerticalPrismalSurface parent) { _parent = parent; }
public VerticalEdge(VerticalPrismalSurface parent, int index, Direction direction = Direction.Up) { _parent = parent; _index = index; _direction = direction; }
public Vertex(VerticalPrismalSurface parent, int index, BaseSide baseFace) { _parent = parent; _index = index; _baseFace = baseFace; }
public UndirectedEdgeComparerImpl(VerticalPrismalSurface parent) { _parent = parent; }