public Rectangle(ValidateOption should, params Point[] points) : base(points, should) { if (should == ValidateOption.Do) { throw new NotImplementedException(); } }
public Rectangle(Polygon polygon, ValidateOption shouldValidate = ValidateOption.Do) : base(polygon) { if (shouldValidate == ValidateOption.Do && !polygon.IsRectangle()) { throw new Exception("Polygon is not a rectangle!"); } }
public ValidateContext CreateContext(object validateObject, ValidateOption option = ValidateOption.StopOnFirstFailure, params string[] ruleSetList) { var result = Provider.GetService <ValidateContext>(); result.Option = option; result.RuleSetList = ruleSetList; result.ValidateObject = validateObject; return(result); }
/// <summary> /// Creates a polygon from the passed line segments, after validating that they in fact form a closed nondegenerate planar region. /// </summary> public Polygon(IList <LineSegment> lineSegments, ValidateOption shouldValidate = ValidateOption.Do) { if (shouldValidate == ValidateOption.Do) { lineSegments.ThrowIfInvalidPolygon(); lineSegments = lineSegments.FixSegmentOrientation(); } this.Edges = lineSegments.ToList().AsReadOnly(); this.NormalLine = this._getNormalLine(); }
/// <summary> /// Creates a Polyhedron using the passed polygons as its side/polygons /// </summary> public Polyhedron(IEnumerable <Polygon> polygons, ValidateOption shouldValidate = ValidateOption.Do) { var faces = polygons.ToList(); if (shouldValidate == ValidateOption.Do) { faces = _makeFacesWithProperOrientation(faces); } if (faces == null || !faces.Any()) { throw new InvalidPolyhedronException(faces, "The polygons you're attempting to use do not form a single closed region."); } this.Faces = faces.AsReadOnly(); this.Edges = faces.GetAllEdges().AsReadOnly(); this.Vertices = faces.SelectMany(v => v.Vertices).DistinctEquatable().ToList().AsReadOnly(); }
public Polygon(ValidateOption should, params LineSegment[] segments) : this(segments, should) { }
public Polygon(ValidateOption should, params Point[] points) : this(points, should) { }
/// <summary> /// Makes a polygon by connecting the points with line segments in the order they are in the list. If they are not in the correct order you can tell it /// to sort the line segments of the polygon clockwise with the boolean flag unless you need it in the specific order it is in /// </summary> /// <param name="passedPoints">The List of points to make the polygon with. It will create the line segments based on the order the points are inputted</param> public Polygon(IList <Point> passedPoints, ValidateOption shouldValidate = ValidateOption.Do) : this(passedPoints.MakeIntoLineSegmentsThatMeet(), shouldValidate) { }
/// <summary> /// Creates a Polyhedron using the passed polygons as its side/polygons /// </summary> public Polyhedron(ValidateOption shouldValidate, params Polygon[] faces) : this(faces, shouldValidate) { }