private static bool TryGetArcBoundingBox(DxfVertex v1, DxfVertex v2, out DxfBoundingBox bbox) { if (!DxfArc.TryCreateFromVertices(v1, v2, out var arc)) { bbox = default(DxfBoundingBox); return(false); } var boundingBox = arc.GetBoundingBox(); if (!boundingBox.HasValue) { bbox = default(DxfBoundingBox); return(false); } bbox = boundingBox.Value; return(true); }
protected override IEnumerable <DxfPoint> GetExtentsPoints() { if (GetEntities != null) { var boundingBoxes = GetEntities().Select(e => e.GetBoundingBox()).Where(bb => bb.HasValue).Select(bb => bb.GetValueOrDefault()).ToList(); if (boundingBoxes.Count == 0) { yield break; } var boundingBox = DxfBoundingBox.FromEnumerable(boundingBoxes); var minX = boundingBox.MinimumPoint.X * XScaleFactor + Location.X; var minY = boundingBox.MinimumPoint.Y * YScaleFactor + Location.Y; var minZ = boundingBox.MinimumPoint.Z * ZScaleFactor + Location.Z; var maxX = boundingBox.MaximumPoint.X * XScaleFactor + Location.X; var maxY = boundingBox.MaximumPoint.Y * YScaleFactor + Location.Y; var maxZ = boundingBox.MaximumPoint.Z * ZScaleFactor + Location.Z; var minP = new DxfPoint(minX, minY, minZ); var maxP = new DxfPoint(maxX, maxY, maxZ); yield return(minP); yield return(maxP); } }
public DxfBoundingBox? GetBoundingBox() { return DxfBoundingBox.FromPoints(GetExtentsPoints()); }
public ConverterDxfRect(DxfBoundingBox bbox) : this(bbox.MinimumPoint.X, bbox.MaximumPoint.X, bbox.MinimumPoint.Y, bbox.MaximumPoint.Y) { }