Method Transform
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
Transform(GeoPoint2)
Transforms a point.
public GeoPoint2 Transform(GeoPoint2 point)
Parameters
pointGeoPoint2
Returns
Transform(GeoVector2)
Transforms a vector, which the translation does not touch.
public GeoVector2 Transform(GeoVector2 vector)
Parameters
vectorGeoVector2
Returns
Transform(GeoLine2)
Transforms a segment.
public GeoLine2 Transform(GeoLine2 line)
Parameters
lineGeoLine2
Returns
Transform(GeoRay2)
Transforms a ray: the origin as a point and the direction as a vector, normalized again.
public GeoRay2 Transform(GeoRay2 ray)
Parameters
rayGeoRay2
Returns
Remarks
An uneven scaling turns the ray as well as moving it: the ray from the origin at 45 degrees, scaled by 2 along X only, runs towards (2, 1).
Exceptions
- InvalidOperationException
Thrown when the transformation flattens the ray direction to nothing.
Transform(GeoXLine2)
Transforms an infinite line: the origin as a point and the direction as a vector, normalized again.
public GeoXLine2 Transform(GeoXLine2 xline)
Parameters
xlineGeoXLine2
Returns
Remarks
An uneven scaling turns the line as well as moving it: the line through the origin at 45 degrees, scaled by 2 along X only, runs along (2, 1).
Exceptions
- InvalidOperationException
Thrown when the transformation flattens the line direction to nothing.
Transform(GeoPolyline2)
Transforms a chain.
public GeoPolyline2 Transform(GeoPolyline2 polyline)
Parameters
polylineGeoPolyline2
Returns
Remarks
The chain is transformed leg for leg, however short a leg, as Transform(GeoPolygon2) transforms a polygon side for side.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Transform(GeoPolygon2)
Transforms a polygon.
public GeoPolygon2 Transform(GeoPolygon2 polygon)
Parameters
polygonGeoPolygon2
Returns
Remarks
A transformation that turns shapes round, a mirror or a negative scaling, reverses the winding: a polygon that ran counter-clockwise comes back clockwise.
The polygon is transformed side for side, however short a side, and however small the transformation leaves it: at a millionth, the triangle (0, 0), (10, 0), (10, 10) with every corner cut by 0.0003 keeps its six corners turned, moved or mirrored, where it was put back together within the global tolerance of a thousandth and came back three, and the square 10 by 10 scaled by 1E-5 is the square 0.0001 across, where it was refused as having fewer than three corners. Only a corner the transformation lands on the very same point as the one before it goes.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
Transform(GeoFace2)
Transforms a face and its holes.
public GeoFace2 Transform(GeoFace2 face)
Parameters
faceGeoFace2
Returns
Remarks
The boundary and each hole are transformed side for side, as Transform(GeoPolygon2) transforms a polygon.
Exceptions
- ArgumentNullException
Thrown when the face is null.
Transform(GeoCircle2)
Transforms a circle.
public GeoCircle2 Transform(GeoCircle2 circle)
Parameters
circleGeoCircle2
Returns
Remarks
A circle survives a transformation only when every direction is stretched by the same amount: when the two axes come out so nearly equally long and square to each other that the circle moved lands within the global point tolerance of where the transformation puts each of its points, as a ball in space is read (Transform(GeoSphere3)). A turn whose numbers are rounded to six places or to a float on their own keeps the two axes alike to the last digit and moves a circle of any size; a stretch of 3E-6 along X moves the circle of radius 100 at the scale it is drawn, 0.0003 off at the most, and is refused scaled by 1 000, where it would be 0.3 off. Under a scaling that differs between the axes, or a shear, it becomes an ellipse, so the attempt is refused rather than answered with a circle of some averaged radius; transform FromCircle(GeoCircle2) to get the ellipse. The skew that sends X to (1, 0) and Y to (0.6, 0.8) keeps both lengths, and is refused: the circle of radius 100 would be an ellipse of radii 126.5 and 63.2.
Exceptions
- InvalidOperationException
Thrown when the transformation would turn the circle into an ellipse.
Transform(GeoRectangle2)
Transforms a rectangle.
public GeoRectangle2 Transform(GeoRectangle2 rectangle)
Parameters
rectangleGeoRectangle2
Returns
Remarks
A rectangle stays a rectangle under a move, a turn, a mirror and a uniform scaling. A scaling
that differs between the axes, or a shear, leaves a parallelogram instead, which this library
has no type for: transform rectangle.ToPolygon() when that is what you want. The axes are read as a
circle as large as the rectangle's half diagonal reads them: they have to come out so nearly equally long and
square to each other that its corners land within the global point tolerance of where the transformation puts
them. The rectangle 100 by 50 is moved under a shear of 5E-6 at the scale it is drawn, its corners 0.00018 off,
and refused scaled by 1 000, where they would be 0.18 off; a turn whose numbers are rounded to six places
or to a float on their own moves it at any scale. A transformation that keeps shapes round to the rounding of a
matrix built from axes is read alike: a scaling by 1 000 with X a share of 4E-10 longer moves the rectangle 200 by 100
at the scale it is drawn, and refuses the one 2E8 by 1E8, whose corners it took 44 off.
Exceptions
- InvalidOperationException
Thrown when the transformation would turn the rectangle into a parallelogram.
Transform(GeoTriangle2)
Transforms a triangle, corner by corner.
public GeoTriangle2 Transform(GeoTriangle2 triangle)
Parameters
triangleGeoTriangle2The triangle to transform.
Returns
- GeoTriangle2
The triangle the transformation makes of it. Any affine map takes a triangle to a triangle, so nothing is refused; a mirror or a negative scaling reverses the winding.
Transform(IEnumerable<GeoPoint2>)
Transforms a sequence of points.
public IEnumerable<GeoPoint2> Transform(IEnumerable<GeoPoint2> points)
Parameters
pointsIEnumerable<GeoPoint2>
Returns
Exceptions
- ArgumentNullException
Thrown when the sequence is null.