Method Transform
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
Transform(GeoPoint3)
Transforms a point.
public GeoPoint3 Transform(GeoPoint3 point)
Parameters
pointGeoPoint3
Returns
Transform(GeoVector3)
Transforms a vector, ignoring the translation part.
public GeoVector3 Transform(GeoVector3 vector)
Parameters
vectorGeoVector3
Returns
Remarks
A vector has a direction and a length but no position, so moving the whole of space must leave it unchanged. That is why the translation column takes no part here and why transforming a point and transforming the vector between two points give different answers.
Transform(GeoLine3)
Transforms a line segment by transforming both of its endpoints.
public GeoLine3 Transform(GeoLine3 line)
Parameters
lineGeoLine3
Returns
Transform(GeoRay3)
Transforms a ray.
public GeoRay3 Transform(GeoRay3 ray)
Parameters
rayGeoRay3
Returns
Exceptions
- InvalidOperationException
Thrown when the transformation flattens the ray direction to nothing.
Transform(GeoXLine3)
Transforms an infinite line: the origin as a point and the direction as a vector, normalized again.
public GeoXLine3 Transform(GeoXLine3 xline)
Parameters
xlineGeoXLine3
Returns
Remarks
An uneven scaling turns the line as well as moving it: the line through the origin at 45 degrees in the floor, scaled by 2 along X only, runs along (2, 1, 0).
Exceptions
- InvalidOperationException
Thrown when the transformation flattens the line direction to nothing.
Transform(GeoTriangle3)
Transforms a triangle by transforming its three vertices.
public GeoTriangle3 Transform(GeoTriangle3 triangle)
Parameters
triangleGeoTriangle3
Returns
Transform(GeoPlane3)
Transforms a plane.
public GeoPlane3 Transform(GeoPlane3 plane)
Parameters
planeGeoPlane3
Returns
Remarks
A plane normal is not transformed like a direction. Under a non-uniform scaling a direction in the plane and the normal are stretched differently, and applying the same matrix to both would leave them no longer perpendicular. The normal follows the inverse transpose instead, which is the matrix that preserves that right angle. It comes out as long as the inverse makes it, a hundred-thousandth under an even scaling by 100 000, and is made of unit length by its own length, not judged against a tolerance: the plane is carried under any scaling that can be undone, where a scaling of about 1E5 or more threw, the normal read shorter than the vector tolerance.
Exceptions
- InvalidOperationException
Thrown when the transformation is not invertible, or the normal comes out of it of no length to the rounding of its numbers.
Transform(GeoCoordinateSystem3)
Transforms a local coordinate system.
public GeoCoordinateSystem3 Transform(GeoCoordinateSystem3 system)
Parameters
systemGeoCoordinateSystem3
Returns
Exceptions
- ArgumentException
Thrown when the transformation flattens the frame so that its axes no longer span space.
Transform(GeoObb3)
Transforms an oriented box.
public GeoObb3 Transform(GeoObb3 box)
Parameters
boxGeoObb3
Returns
Remarks
A box stays a box only under a transformation that keeps right angles right. A shear turns it into a parallelepiped, which this type cannot represent, and what comes back then is the box spanned by the transformed axes rather than the true sheared shape.
Exceptions
- ArgumentException
Thrown when the transformation collapses the box orientation.
Transform(GeoAabb3)
Transforms an axis-aligned box.
public GeoAabb3 Transform(GeoAabb3 box)
Parameters
boxGeoAabb3
Returns
Remarks
A box aligned with the world axes does not stay aligned once it is rotated, so what comes back is the smallest aligned box holding the transformed corners. That is larger than the true transformed shape whenever the transformation turns it, which is the price of insisting on alignment; transform a GeoObb3 instead to keep the shape exactly.
Transform(GeoCircle3)
Transforms a circle.
public GeoCircle3 Transform(GeoCircle3 circle)
Parameters
circleGeoCircle3
Returns
Remarks
A circle survives a transformation only when every direction in its plane is stretched by the same amount: when the two axes of its plane 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 is read (Transform(GeoSphere3)). A turn that keeps them alike to the rounding of its numbers moves a circle of any size; a turn whose numbers are rounded to six places on their own leaves them some 1E-6 apart, and moves the circle of radius 100 at the scale it is drawn, 0.000065 off, but not scaled by 1 000, where it would be 0.065 off. Under a non-uniform scaling or a shear it becomes an ellipse, which Transform(GeoEllipse3) gives, so the attempt is refused rather than answered with a circle of some averaged radius. The skew that sends X to (1, 0, 0) and Y to (0.6, 0.8, 0) keeps both lengths, and is refused for a circle in the plan: it would be an ellipse of radii 126.5 and 63.2 for a radius of 100. The circle's plane is carried by its normal (Transform(GeoPlane3)), under an even scaling of 1E5 or more as under any other: the circle of radius 10 scaled by a million is the circle of radius 10 000 000, where it threw. An arc on a circle is carried by TransformBy(GeoTransform3), through where its ends and its middle land.
Exceptions
- InvalidOperationException
Thrown when the transformation would turn the circle into an ellipse.
Transform(GeoSphere3)
Transforms a ball.
public GeoSphere3 Transform(GeoSphere3 sphere)
Parameters
sphereGeoSphere3
Returns
Remarks
A ball survives a transformation only when every direction is stretched by the same amount and none is sheared against another, so nearly that the ball moved lands within the global point tolerance of where the transformation puts each of its points, the three axes read in pairs as a circle reads two (Transform(GeoCircle3)): a turn, a shift, a mirror or an even scaling, under which the radius is scaled by the stretch (a ball of radius 50 scaled by 3 has a radius of 150). A turn, a shift or a mirror leaves the radius as it is. Under a non-uniform scaling or a shear it would be an ellipsoid, which this library has no type for, so the attempt is refused rather than answered with a ball of some averaged radius. A transformation that keeps lengths, or shapes round, to the rounding of a matrix built from axes is read by the same rule, its axes differing by a share of up to some 1E-9: the ball of radius 1E8 under X stretched by a share of 4E-10 is refused, where it came through 0.04 off.
Exceptions
- InvalidOperationException
Thrown when the transformation would turn the ball into an ellipsoid, or flatten it.
Transform(GeoEllipse3)
Transforms an ellipse in space. Every transformation that does not flatten its plane gives an ellipse, an uneven scaling and a shear among them: a circle of radius 100 in the plan made an ellipse and scaled by 3 along X is the ellipse 300 by 100.
public GeoEllipse3 Transform(GeoEllipse3 ellipse)
Parameters
ellipseGeoEllipse3
Returns
Remarks
Exceptions
- InvalidOperationException
Thrown when the transformation is not invertible, as for a circle.
Transform(IEnumerable<GeoPoint3>)
Transforms a sequence of points.
public IEnumerable<GeoPoint3> Transform(IEnumerable<GeoPoint3> points)
Parameters
pointsIEnumerable<GeoPoint3>