API Reference
OfficeGeometry
Reusable dependency-free geometry helpers shared by OfficeIMO renderers.
Inheritance
- Object
- OfficeGeometry
Methods
public static List<OfficePoint> BuildConnectorPolyline(OfficePoint start, OfficePoint end, IReadOnlyList<OfficePoint> waypoints, Boolean useRightAngleFallback) #List<OfficePoint>Builds a connector polyline from endpoints, optional waypoints, and optional right-angle fallback routing.
Parameters
- start OfficeIMO.Drawing.OfficePoint
- Connector start point.
- end OfficeIMO.Drawing.OfficePoint
- Connector end point.
- waypoints System.Collections.Generic.IReadOnlyList{OfficeIMO.Drawing.OfficePoint}
- Explicit intermediate points. When present, these take precedence over right-angle fallback routing.
- useRightAngleFallback System.Boolean
- When true and no explicit waypoints exist, inserts one orthogonal elbow at start X and end Y.
Returns
A connector polyline containing start, any intermediate points, and end.
public static List<ValueTuple<Double, Double>> BuildConnectorPolyline(ValueTuple<Double, Double> start, ValueTuple<Double, Double> end, IReadOnlyList<ValueTuple<Double, Double>> waypoints, Boolean useRightAngleFallback) #List<ValueTuple<Double, Double>>Builds a tuple connector polyline from endpoints, optional waypoints, and optional right-angle fallback routing.
Parameters
- start System.ValueTuple{System.Double,System.Double}
- Connector start point.
- end System.ValueTuple{System.Double,System.Double}
- Connector end point.
- waypoints System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.Double,System.Double}}
- Explicit intermediate points. When present, these take precedence over right-angle fallback routing.
- useRightAngleFallback System.Boolean
- When true and no explicit waypoints exist, inserts one orthogonal elbow at start X and end Y.
Returns
A connector polyline containing start, any intermediate points, and end.
public static List<OfficePoint> CreateCubicBezierPoints(OfficePoint start, OfficePoint control1, OfficePoint control2, OfficePoint end, Int32 segments) #List<OfficePoint>Samples a cubic Bezier curve into straight-line points, excluding the start point and including the end point.
Parameters
- start OfficeIMO.Drawing.OfficePoint
- Curve start point.
- control1 OfficeIMO.Drawing.OfficePoint
- First cubic control point.
- control2 OfficeIMO.Drawing.OfficePoint
- Second cubic control point.
- end OfficeIMO.Drawing.OfficePoint
- Curve end point.
- segments System.Int32
- Number of line segments used to approximate the curve.
public static List<ValueTuple<Double, Double>> CreateCubicBezierPoints(ValueTuple<Double, Double> start, ValueTuple<Double, Double> control1, ValueTuple<Double, Double> control2, ValueTuple<Double, Double> end, Int32 segments) #List<ValueTuple<Double, Double>>Samples a tuple cubic Bezier curve into straight-line points, excluding the start point and including the end point.
Parameters
- start System.ValueTuple{System.Double,System.Double}
- Curve start point.
- control1 System.ValueTuple{System.Double,System.Double}
- First cubic control point.
- control2 System.ValueTuple{System.Double,System.Double}
- Second cubic control point.
- end System.ValueTuple{System.Double,System.Double}
- Curve end point.
- segments System.Int32
- Number of line segments used to approximate the curve.
public static List<OfficePathCommand> CreateEllipticalArcCubicBezierCommands(OfficePoint start, Double radiusX, Double radiusY, Double startRadians, Double sweepRadians) #List<OfficePathCommand>Converts an elliptical arc into cubic Bezier path commands, excluding the current move point.
Parameters
- start OfficeIMO.Drawing.OfficePoint
- Current path point. It must represent the point at startRadians on the ellipse.
- radiusX System.Double
- Horizontal ellipse radius.
- radiusY System.Double
- Vertical ellipse radius.
- startRadians System.Double
- Start angle in radians, using the renderer's y-down coordinate system.
- sweepRadians System.Double
- Sweep angle in radians. Positive values sweep clockwise in y-down coordinates.
Returns
Cubic Bezier commands that approximate the requested arc.
public static List<OfficePoint> CreateEllipticalArcPoints(Double centerX, Double centerY, Double radiusX, Double radiusY, Double startRadians, Double sweepRadians, Int32 segments, Double rotationRadians = 0, Double rotationCenterX = 0, Double rotationCenterY = 0) #List<OfficePoint>Samples an elliptical arc into straight-line points, excluding the start point and including the end point.
Parameters
- centerX System.Double
- Arc center X coordinate.
- centerY System.Double
- Arc center Y coordinate.
- radiusX System.Double
- Horizontal radius before optional rotation.
- radiusY System.Double
- Vertical radius before optional rotation.
- startRadians System.Double
- Start angle in radians.
- sweepRadians System.Double
- Sweep angle in radians.
- segments System.Int32
- Number of line segments used to approximate the arc.
- rotationRadians System.Double = 0
- Optional rotation angle in radians.
- rotationCenterX System.Double = 0
- Rotation center X coordinate.
- rotationCenterY System.Double = 0
- Rotation center Y coordinate.
public static List<ValueTuple<Double, Double>> CreateEllipticalArcPointsAsTuples(Double centerX, Double centerY, Double radiusX, Double radiusY, Double startRadians, Double sweepRadians, Int32 segments, Double rotationRadians = 0, Double rotationCenterX = 0, Double rotationCenterY = 0) #List<ValueTuple<Double, Double>>Samples a tuple elliptical arc into straight-line points, excluding the start point and including the end point.
Parameters
- centerX System.Double
- Arc center X coordinate.
- centerY System.Double
- Arc center Y coordinate.
- radiusX System.Double
- Horizontal radius before optional rotation.
- radiusY System.Double
- Vertical radius before optional rotation.
- startRadians System.Double
- Start angle in radians.
- sweepRadians System.Double
- Sweep angle in radians.
- segments System.Int32
- Number of line segments used to approximate the arc.
- rotationRadians System.Double = 0
- Optional rotation angle in radians.
- rotationCenterX System.Double = 0
- Rotation center X coordinate.
- rotationCenterY System.Double = 0
- Rotation center Y coordinate.
public static List<OfficePoint> CreateQuadraticBezierPoints(OfficePoint start, OfficePoint control, OfficePoint end, Int32 segments) #List<OfficePoint>Samples a quadratic Bezier curve into straight-line points, excluding the start point and including the end point.
Parameters
- start OfficeIMO.Drawing.OfficePoint
- Curve start point.
- control OfficeIMO.Drawing.OfficePoint
- Quadratic control point.
- end OfficeIMO.Drawing.OfficePoint
- Curve end point.
- segments System.Int32
- Number of line segments used to approximate the curve.
public static List<ValueTuple<Double, Double>> CreateQuadraticBezierPoints(ValueTuple<Double, Double> start, ValueTuple<Double, Double> control, ValueTuple<Double, Double> end, Int32 segments) #List<ValueTuple<Double, Double>>Samples a tuple quadratic Bezier curve into straight-line points, excluding the start point and including the end point.
Parameters
- start System.ValueTuple{System.Double,System.Double}
- Curve start point.
- control System.ValueTuple{System.Double,System.Double}
- Quadratic control point.
- end System.ValueTuple{System.Double,System.Double}
- Curve end point.
- segments System.Int32
- Number of line segments used to approximate the curve.
public static Double DegreesToRadians(Double degrees) #DoubleConverts degrees to radians.
Parameters
- degrees System.Double
- Angle in degrees.
Returns
The same angle in radians.
public static Double Distance(Double x1, Double y1, Double x2, Double y2) #DoubleCalculates the Euclidean distance between two points.
Parameters
- x1 System.Double
- y1 System.Double
- x2 System.Double
- y2 System.Double
public static Double Distance(OfficePoint from, OfficePoint to) #DoubleCalculates the Euclidean distance between two points.
Parameters
- from OfficeIMO.Drawing.OfficePoint
- to OfficeIMO.Drawing.OfficePoint
public static Double Distance(ValueTuple<Double, Double> from, ValueTuple<Double, Double> to) #DoubleCalculates the Euclidean distance between two tuple points.
Parameters
- from System.ValueTuple{System.Double,System.Double}
- to System.ValueTuple{System.Double,System.Double}
public static ValueTuple<Double, Double, Double, Double> GetRotatedRectangleBounds(Double x, Double y, Double width, Double height, Double rotationDegrees, Double centerX, Double centerY) #ValueTuple<Double, Double, Double, Double>Calculates axis-aligned bounds for a rectangle after rotation around a supplied center.
Parameters
- x System.Double
- Rectangle left coordinate.
- y System.Double
- Rectangle top coordinate.
- width System.Double
- Rectangle width.
- height System.Double
- Rectangle height.
- rotationDegrees System.Double
- Rotation angle in degrees.
- centerX System.Double
- Rotation center X coordinate.
- centerY System.Double
- Rotation center Y coordinate.
Returns
Axis-aligned bounds of the rotated rectangle.
public static OfficePoint InterpolatePolyline(IReadOnlyList<OfficePoint> points, Double position) #OfficePointReturns the point at the supplied normalized position along a polyline.
Parameters
- points System.Collections.Generic.IReadOnlyList{OfficeIMO.Drawing.OfficePoint}
- Polyline points in drawing coordinates.
- position System.Double
- Normalized position where 0 is the first point and 1 is the last point.
public static ValueTuple<Double, Double> InterpolatePolyline(IReadOnlyList<ValueTuple<Double, Double>> points, Double position) #ValueTuple<Double, Double>Returns the tuple point at the supplied normalized position along a polyline.
Parameters
- points System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.Double,System.Double}}
- Polyline points in drawing coordinates.
- position System.Double
- Normalized position where 0 is the first point and 1 is the last point.
public static Double RadiansToDegrees(Double radians) #DoubleConverts radians to degrees.
Parameters
- radians System.Double
- Angle in radians.
Returns
The same angle in degrees.
public static OfficePoint ResolveRectangleBoundaryEndpoint(Double sourceLeft, Double sourceBottom, Double sourceRight, Double sourceTop, Double targetLeft, Double targetBottom, Double targetRight, Double targetTop) #OfficePointResolves the point on a source rectangle boundary that faces a target rectangle.
Parameters
- sourceLeft System.Double
- Source rectangle left X coordinate.
- sourceBottom System.Double
- Source rectangle minimum Y coordinate.
- sourceRight System.Double
- Source rectangle right X coordinate.
- sourceTop System.Double
- Source rectangle maximum Y coordinate.
- targetLeft System.Double
- Target rectangle left X coordinate.
- targetBottom System.Double
- Target rectangle minimum Y coordinate.
- targetRight System.Double
- Target rectangle right X coordinate.
- targetTop System.Double
- Target rectangle maximum Y coordinate.
Returns
The source boundary point nearest the target rectangle by dominant center direction.
public static Void ResolveRectangleBoundaryEndpoint(Double sourceLeft, Double sourceBottom, Double sourceRight, Double sourceTop, Double targetLeft, Double targetBottom, Double targetRight, Double targetTop, out Double x, out Double y) #VoidResolves coordinates on a source rectangle boundary that faces a target rectangle.
Parameters
- sourceLeft System.Double
- Source rectangle left X coordinate.
- sourceBottom System.Double
- Source rectangle minimum Y coordinate.
- sourceRight System.Double
- Source rectangle right X coordinate.
- sourceTop System.Double
- Source rectangle maximum Y coordinate.
- targetLeft System.Double
- Target rectangle left X coordinate.
- targetBottom System.Double
- Target rectangle minimum Y coordinate.
- targetRight System.Double
- Target rectangle right X coordinate.
- targetTop System.Double
- Target rectangle maximum Y coordinate.
- x System.Double@
- Resolved source boundary X coordinate.
- y System.Double@
- Resolved source boundary Y coordinate.
public static OfficePoint RotatePoint(OfficePoint point, Double centerX, Double centerY, Double rotationRadians) #OfficePointRotates a point around the supplied center using radians in raster coordinate space.
Parameters
- point OfficeIMO.Drawing.OfficePoint
- Point to rotate.
- centerX System.Double
- Rotation center X coordinate.
- centerY System.Double
- Rotation center Y coordinate.
- rotationRadians System.Double
- Rotation angle in radians.
Returns
The rotated point.
public static ValueTuple<Double, Double> RotatePoint(ValueTuple<Double, Double> point, Double centerX, Double centerY, Double rotationRadians) #ValueTuple<Double, Double>Rotates a tuple point around the supplied center using radians in raster coordinate space.
Parameters
- point System.ValueTuple{System.Double,System.Double}
- Point to rotate.
- centerX System.Double
- Rotation center X coordinate.
- centerY System.Double
- Rotation center Y coordinate.
- rotationRadians System.Double
- Rotation angle in radians.
Returns
The rotated tuple point.
public static Boolean SegmentIntersectsRectangle(ValueTuple<Double, Double> start, ValueTuple<Double, Double> end, Double left, Double bottom, Double right, Double top) #BooleanDetermines whether a line segment intersects a rectangle, including boundary touches.
Parameters
- start System.ValueTuple{System.Double,System.Double}
- Segment start point.
- end System.ValueTuple{System.Double,System.Double}
- Segment end point.
- left System.Double
- Rectangle left X coordinate.
- bottom System.Double
- Rectangle lower Y coordinate.
- right System.Double
- Rectangle right X coordinate.
- top System.Double
- Rectangle upper Y coordinate.
public static Boolean SegmentIntersectsRectangle(OfficePoint start, OfficePoint end, Double left, Double bottom, Double right, Double top) #BooleanDetermines whether a line segment intersects a rectangle, including boundary touches.
Parameters
- start OfficeIMO.Drawing.OfficePoint
- Segment start point.
- end OfficeIMO.Drawing.OfficePoint
- Segment end point.
- left System.Double
- Rectangle left X coordinate.
- bottom System.Double
- Rectangle lower Y coordinate.
- right System.Double
- Rectangle right X coordinate.
- top System.Double
- Rectangle upper Y coordinate.
public static Boolean SegmentsIntersect(ValueTuple<Double, Double> firstStart, ValueTuple<Double, Double> firstEnd, ValueTuple<Double, Double> secondStart, ValueTuple<Double, Double> secondEnd) #BooleanDetermines whether two line segments intersect, including boundary touches and collinear overlap.
Parameters
- firstStart System.ValueTuple{System.Double,System.Double}
- firstEnd System.ValueTuple{System.Double,System.Double}
- secondStart System.ValueTuple{System.Double,System.Double}
- secondEnd System.ValueTuple{System.Double,System.Double}
public static Boolean SegmentsIntersect(OfficePoint firstStart, OfficePoint firstEnd, OfficePoint secondStart, OfficePoint secondEnd) #BooleanDetermines whether two line segments intersect, including boundary touches and collinear overlap.
Parameters
- firstStart OfficeIMO.Drawing.OfficePoint
- firstEnd OfficeIMO.Drawing.OfficePoint
- secondStart OfficeIMO.Drawing.OfficePoint
- secondEnd OfficeIMO.Drawing.OfficePoint
public static Boolean TryCreateArrowheadPoints(OfficePoint tip, OfficePoint from, Double strokeWidth, out OfficePoint[] points, Double minimumLength = 8, Double lengthMultiplier = 4, Double wingAngleRadians = 0.4487989505128276) #BooleanCalculates the triangular arrowhead points for a connector segment.
Parameters
- tip OfficeIMO.Drawing.OfficePoint
- Arrowhead tip point.
- from OfficeIMO.Drawing.OfficePoint
- A non-collapsed point behind the tip on the connector segment.
- strokeWidth System.Double
- Connector stroke width used to scale the arrowhead length.
- points OfficeIMO.Drawing.OfficePoint[]@
- Three arrowhead points: tip, first wing, and second wing.
- minimumLength System.Double = 8
- Minimum arrowhead length in drawing units.
- lengthMultiplier System.Double = 4
- Multiplier applied to strokeWidth.
- wingAngleRadians System.Double = 0.4487989505128276
- Angle between the connector segment and each arrowhead wing.
Returns
true when the segment and sizing inputs can produce an arrowhead.
public static Boolean TryGetArrowheadSegment(IReadOnlyList<OfficePoint> points, Boolean fromStart, out OfficePoint tip, out OfficePoint from, Double tolerance = 1E-06) #BooleanFinds the terminal non-collapsed segment that should receive an arrowhead.
Parameters
- points System.Collections.Generic.IReadOnlyList{OfficeIMO.Drawing.OfficePoint}
- Connector polyline points in drawing coordinates.
- fromStart System.Boolean
- When true, resolves the first segment; otherwise resolves the last segment.
- tip OfficeIMO.Drawing.OfficePoint@
- Resolved arrow tip point.
- from OfficeIMO.Drawing.OfficePoint@
- Resolved point behind the arrow tip.
- tolerance System.Double = 1E-06
- Minimum segment length considered non-collapsed.
Returns
true when a non-collapsed terminal segment exists.
public static Boolean TryGetArrowheadSegment(IReadOnlyList<ValueTuple<Double, Double>> points, Boolean fromStart, out ValueTuple<Double, Double> tip, out ValueTuple<Double, Double> from, Double tolerance = 1E-06) #BooleanFinds the terminal non-collapsed tuple segment that should receive an arrowhead.
Parameters
- points System.Collections.Generic.IReadOnlyList{System.ValueTuple{System.Double,System.Double}}
- Connector polyline points in drawing coordinates.
- fromStart System.Boolean
- When true, resolves the first segment; otherwise resolves the last segment.
- tip System.ValueTuple{System.Double,System.Double}@
- Resolved arrow tip point.
- from System.ValueTuple{System.Double,System.Double}@
- Resolved point behind the arrow tip.
- tolerance System.Double = 1E-06
- Minimum segment length considered non-collapsed.
Returns
true when a non-collapsed terminal segment exists.
public static Boolean TryGetParallelLineOffsets(Double x1, Double y1, Double x2, Double y2, Double separation, out Double offsetX, out Double offsetY) #BooleanCalculates the perpendicular half-offset for two parallel lines separated by the supplied distance.
Parameters
- x1 System.Double
- Source line start X coordinate.
- y1 System.Double
- Source line start Y coordinate.
- x2 System.Double
- Source line end X coordinate.
- y2 System.Double
- Source line end Y coordinate.
- separation System.Double
- Distance between the two parallel line centers.
- offsetX System.Double@
- Perpendicular X offset from the source line center to either parallel line.
- offsetY System.Double@
- Perpendicular Y offset from the source line center to either parallel line.
Returns
true when the source line has usable length and finite coordinates.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object