Struct ClipRect
- Namespace
- CADability
- Assembly
- CADability.dll
An axis aligned 2d rectangle (Left, Right, Bottom, Top) which provides primitive clipping functions: classification of points by outcodes (Cohen-Sutherland), clipping of line segments and fast hit tests of line segments against the rectangle. Used by the 2d curves and borders for hit testing.
public struct ClipRect
- Inherited Members
Constructors
ClipRect(BoundingRect)
public ClipRect(BoundingRect r)
Parameters
ClipRect(double, double, double, double)
public ClipRect(double Left, double Right, double Bottom, double Top)
Parameters
Fields
Bottom
public double Bottom
Field Value
Left
public double Left
Field Value
Right
public double Right
Field Value
Top
public double Top
Field Value
Properties
Center
public GeoPoint2D Center { get; }
Property Value
Size
public double Size { get; }
Property Value
Methods
ArcHitTest(GeoPoint2D, double, int, GeoPoint2D, GeoPoint2D)
public bool ArcHitTest(GeoPoint2D c, double r, int q, GeoPoint2D ps, GeoPoint2D pe)
Parameters
cGeoPoint2DrdoubleqintpsGeoPoint2DpeGeoPoint2D
Returns
ClipCode(ref GeoPoint2D, ref BoundingRect)
public static int ClipCode(ref GeoPoint2D p, ref BoundingRect rect)
Parameters
pGeoPoint2DrectBoundingRect
Returns
ClipLine(ref GeoPoint2D, ref GeoPoint2D)
Clips the line segment given by the two points to this rectangle: the points are moved onto the sides of the rectangle so that the resulting segment is the part of the original segment inside the rectangle. If the segment lies completely outside, false is returned (the points may then have been partially modified).
public bool ClipLine(ref GeoPoint2D p1, ref GeoPoint2D p2)
Parameters
p1GeoPoint2DStart point of the line, modified on return
p2GeoPoint2DEnd point of the line, modified on return
Returns
- bool
true if a part of the line remains visible (inside the rectangle), false otherwise
Contains(GeoPoint2D)
public bool Contains(GeoPoint2D p)
Parameters
Returns
EllipseArcHitTest(GeoPoint2D, double, double, Angle, int, GeoPoint2D, GeoPoint2D)
public bool EllipseArcHitTest(GeoPoint2D cnt, double rx, double ry, Angle a, int q, GeoPoint2D ps, GeoPoint2D pe)
Parameters
cntGeoPoint2DrxdoublerydoubleaAngleqintpsGeoPoint2DpeGeoPoint2D
Returns
LineHitTest(GeoPoint2D, GeoPoint2D)
Tests whether the line segment given by the two points touches or crosses this rectangle. The points are not modified.
public bool LineHitTest(GeoPoint2D p1, GeoPoint2D p2)
Parameters
p1GeoPoint2DStart point of the line
p2GeoPoint2DEnd point of the line
Returns
- bool
true if the line segment intersects the rectangle or lies (partially) inside of it
LineHitTest(GeoPoint2D, GeoPoint2D, ref BoundingRect)
public static bool LineHitTest(GeoPoint2D p1, GeoPoint2D p2, ref BoundingRect rect)
Parameters
p1GeoPoint2Dp2GeoPoint2DrectBoundingRect
Returns
ParallelogramHitTest(GeoPoint2D, GeoVector2D, GeoVector2D)
public bool ParallelogramHitTest(GeoPoint2D p, GeoVector2D v1, GeoVector2D v2)
Parameters
pGeoPoint2Dv1GeoVector2Dv2GeoVector2D
Returns
PointsHitTest(GeoPoint2D[])
public int PointsHitTest(GeoPoint2D[] points)
Parameters
pointsGeoPoint2D[]
Returns
Split()
public ClipRect[] Split()
Returns
- ClipRect[]
TriangleHitTest(GeoPoint2D, GeoPoint2D, GeoPoint2D)
public bool TriangleHitTest(GeoPoint2D p1, GeoPoint2D p2, GeoPoint2D p3)
Parameters
p1GeoPoint2Dp2GeoPoint2Dp3GeoPoint2D