Hi,
Some geometry extensions methods for Point2d, Point3d, CircularArc2d, Polyline and Polyline2d classes and two little (maybe usefull) classes: Triangle2d, Triangle3d.
All these classes work together and have to be compiled in a single DLL.
The extension methods requires to reference System.Core (.NET Framework 3.5)
EDIT: extended
Available on
Github.
The GeomExt class, contains the following extension methods:
Matrix3d
Editor.UCS2WCS()
Matrix3d
Editor.WCS2UCS()
Matrix3d
Editor.DCS2WCS()
Matrix3d
Editor.WCS2DCS()
Matrix3d
Editor.DCS2PSDCS()
Matrix3d
Editor.PSDCS2DCS()
Matrix3d
Viewport.DCS2WCS()
Matrix3d
Viewport.WCS2DCS()
Matrix3d
Viewport.PSDCS2DCS()
Matrix3d
Viewport.DCS2PSDCS()
Point3d
Point2d.Convert3d()
Point3d
Point2d.Convert3d(Plane plane)
Point3d
Point2d.Convert3d(Vector3d normal, double elevation)
Point2d
Point2d.Flatten(Vector3d normal)
bool
IsBetween(Point2d p1, Point2d p2)
bool
IsBetween(Point2d p1, Point2d p2, Tolerance tol)
Point2d
Point2d.Polar(double angle, double distance)
Point3d
Point3d.Convert2d()
Point3d
Point3d.Flatten()
bool
IsBetween(Point3d p1, Point3d p2)
bool
IsBetween(Point3d p1, Point3d p2, Tolerance tol)
Point3d
Point3d.Polar(double angle, double distance)
Point3d
Point3d.Trans(int from, int to)
Point3d
Point3d.Trans(Editor ed, int from, int to)
Point3d
Point3d.Trans(CoordSystem from, CoordSystem to)
Point3d
Point3d.Trans(Editor ed, CoordSystem from, CoordSystem to)
Vector3d
Vector3d .Flatten()
void
Point2dCollection.RemoveDuplicate()
void
Point2dCollection.RemoveDuplicate(Tolerance tol)
bool
Point2dCollection.Contains(Point2d pt, Tolerance tol)
void
Point3dCollection.RemoveDuplicate()
void
Point3dCollection.RemoveDuplicate(Tolerance tol)
bool
Point3dCollection.Contains(Point3d pt, Tolerance tol)
double
CircularArc2d.AlgebricArea()
Point2d
CircularArc2d.Centroid()
Point2d
Polyline.Centroid2d()
Point3d
Polyline.Centroid()
Polyline
Polyline.GetProjectedPolyline(Plane plane, Vector3d direction)
Polyline
Polyline.GetOrthoProjectedPolyline(Plane plane)
Point3d
Polyline2d.Centroid()
CircularArc3d
Polyline2d.GetArcSegmentAt(int index)
CircularArc2d
Polyline2d.GetArcSegment2dAt(int index)
LineSegment3d
Polyline2d.GetLineSegmentAt(int index)
LineSegment2d
Polyline2d.GetLineSegment2dAt(int index)
Polyline
Polyline2d.GetProjectedPolyline(Plane plane, Vector3d direction)
Polyline
Polyline2d.GetOrthoProjectedPolyline(Plane plane)
List<Vertex2d>
Polyline2d.GetVertices()
Polyline
Polyline3d.GetProjectedPolyline(Plane plane, Vector3d direction)
Polyline
Polyline3d.GetOrthoProjectedPolyline(Plane plane)
Point3d
Region.Centroid()
Point3d
Spline.Centroid()
Polyline
Ellipse.ToPolyline()
Triangle<T> abstract class
Constructors
Triangle()
Triangle(T[] pts)
Triangle(T a, T b, T c)
Indexor
T
ItemMethods
T
Inverse()
void
Set(T[] pts)
void
Set(T a, T b, T c)
T[]
ToArray()
Triangle2d : Triangle<Point2d> class
Constructors
Triangle2d() : base()
Triangle2d(Point2d[] pts) : base(pts)
Triangle2d(Point2d a, Point2d b, Point2d c) : base(a, b, c)
Triangle2d(Point2d org, Vector2d v1, Vector2d v2)
Properties
double
AlgebricAreaPoint2d
CentroidCircularArc2d
CircumscribedCircleCircularArc2d
InscribedCirclebool
IsClockwiseMethods
Triangle3d
Convert3d(Plane plane)
Triangle3d
Convert3d(Vector3d normal, double elevation)
double
GetAngleAt(int index)
LineSegment2d
GetSegmentAt(int index)
List<Point2d>
IntersectWith(LinearEntity2d le2d)
List<Point2d>
IntersectWith(LinearEntity2d le2d, Tolerance tol)
bool
IsEqualTo(Triangle2d t2d)
bool
IsEqualTo(Triangle2d t2d, Tolerance tol)
bool
IsPointInside(Point2d pt)
bool
IsPointOn(Point2d pt)
void
Set(Point2d org, Vector2d v1, Vector2d v2)
Triangle2d
TransformBy(Matrix2d mat)
Triangle3d : Triangle<Point3d> class
Constructors
Triangle3d() : base()
Triangle3d(Point3d[] pts) : base(pts)
Triangle3d(Point3d a, Point3d b, Point3d c) : base(a, b, c)
Triangle3d(Point3d org, Vector3d v1, Vector3d v2)
Properties
double
AreaPoint3d
CentroidCircularArc3d
CircumscribedCircledouble
ElevationVector3d
GreatestSlopeVector3d
HorizontalCircularArc3d
InscribedCirclebool
IsHorizontalVector3d
Normaldouble
SlopePerCentMatrix3d
SlopeUCSMethods
Triangle2d
Convert2d()
Triangle2d
Flatten()
double
GetAngleAt(int index)
BoundedPlane
GetBoundedPlane()
Plane
GetPlane()
LineSegment3d
GetSegmentAt(int index)
bool
IsEqualTo(Triangle3d t3d)
bool
IsEqualTo(Triangle3d t3d, Tolerance tol)
bool
IsPointInside(Point3d pt)
bool
IsPointOn(Point3d pt)
void
Set(Point3d org, Vector3d v1, Vector3d v2)
Triangle3d
Transformby(Matrix3d mat)
PolylineSegment class
Constructors
PolylineSegment(Point2d startPoint, Point2d endPoint)
PolylineSegment(Point2d startPoint, Point2d endPoint, double bulge)
PolylineSegment(Point2d startPoint, Point2d endPoint, double bulge, double constantWidth)
PolylineSegment(Point2d startPoint, Point2d endPoint, double bulge, double startWidth, double endWidth)
PolylineSegment(Line2dSegment line)
PolylineSegment(CircularArc2d arc)
Properties
double
BulgePoint2d
EndPointdouble
EndWidthbool
IsLinearPoint2d
StartPointdouble
StartWidthMethods
bool
Equals(object obj)
PolylineSegment
Clone()
int
GetHashCode()
double
GetParameterOf(Point3d pt)
void
Inverse()
CircularArc2d
ToCircularArc()
Curve2d
ToCurve2d()
LineSegment2d
ToLineSegment()
string
ToString()
PolylineSegmentCollection : IList<PolylineSegment> class
Constructors
PolylineSegmentCollection()
PolylineSegmentCollection(Circle circle)
PolylineSegmentCollection(Ellipse ellipse)
PolylineSegmentCollection(Polyline pline)
PolylineSegmentCollection(Polyline2d pline)
PolylineSegmentCollection(IEnumerable<PolylineSegment> segments)
Methods
void
Add(PolylineSegment segment)
void
AddRange(IEnumerable<PolylineSegment> range)
void
Clear()
bool
Contains(PolylineSegment segment)
int
FinIindex(Predicate<PolylineSegment> match)
int
GetClosestSegmentTo(Point2d pt)
IEnumerator<PolylineSegment>
GetEnumerator()
int
IndexOf(PolylineSegment item)
void
Insert(int index, PolylineSegment item)
void
InsertRange(int index, IEnumerable<PolylineSegment> collection)
List<PolylineSegmentCollection>
Join()
List<PolylineSegmentCollection>
Join(Tolerance tol)
bool
Remove(PolylineSegment item)
void
RemoveAt(int index)
public void
RemoveRange(int index, int count)
Polyline
ToPolyline()
For more information, see the attached documentation.
GeomExtDoc.zip contains a .chm documentation file.
GeometryExtensions(1.6).zip contains the C# source code files and the DLLs (GeometryExtensions_18.dll for A2010-2012 and GeometryExtensions_19 for A2013+)
<EDIT: version 1.6> added CircularArc2d and CircularArc3d GetTangentsTo methods, reorganized: one class per extended type.