Class Point
- Namespace
- OpenMEPSandbox.Geometry
- Assembly
- OpenMEPSandbox.dll
public class Point
- Inheritance
-
Point
- Inherited Members
Methods
AssignmentMatching(List<Point>, List<Point>)
Assignments Optimize by using Hungarian Algorithm
[MultiReturn(new string[] { "assignment", "mincost" })]
public static Dictionary<string, object?> AssignmentMatching(List<Point> lcMachines, List<Point> lcDevices)
Parameters
Returns
- Dictionary<string, object>
Permutation of list index matching optimize
AssignmentMatching(List<Point>, List<Point>, double)
Assignments Optimize by using Hungarian Algorithm
[MultiReturn(new string[] { "lines", "machines", "devices" })]
public static Dictionary<string, object?> AssignmentMatching(List<Point> lcMachines, List<Point> lcDevices, double limit = 1.7976931348623157E+308)
Parameters
lcMachines
List<Point>list location of machine
lcDevices
List<Point>list location of devices
limit
doublenumber distance limit to break
Returns
BruteForceMatching(List<Point>, List<Point>)
Assignments Optimize by using Brute Force
[MultiReturn(new string[] { "assignment", "mincost" })]
public static Dictionary<string, object?> BruteForceMatching(List<Point> lcMachines, List<Point> lcDevices)
Parameters
Returns
- Dictionary<string, object>
minimum cost can optimize
Ceiling(Point)
Returns a new point with the larger integer values that are greater than or equal to the X, Y, and Z coordinates of the input point.
public static Point Ceiling(Point point)
Parameters
point
PointThe input point.
Returns
- Point
The point with the larger integer values that are greater than or equal to the X, Y, and Z coordinates of the input point.
Examples
Centroid(List<Point>)
Get the centroid of a list of points
public static Point Centroid(List<Point> points)
Parameters
points
List<Point>list of points
Returns
- Point
centroid
Examples
CompareTo(Point, Point)
Compares this a point with another point. 0: if this is identical to other 1: if this is greater than other -1: if this is less than other
Component evaluation priority is first X, then Y, then Z.
public static double CompareTo(Point point1, Point point2)
Parameters
point1
Pointthe first point to use in comparison
point2
Pointthe second point to use in comparison
Returns
- double
value compare
Examples
Deconstruct(Point)
Deconstruct a point into its components
[MultiReturn(new string[] { "X", "Y", "Z" })]
public static Dictionary<string, object?> Deconstruct(Point point)
Parameters
point
Pointthe point
Returns
- Dictionary<string, object>
X point
Examples
Euclidean(Point, Point)
return distance two points by Euclidean distance
public static double Euclidean(Point p1, Point p2)
Parameters
p1
Pointthe first point
p2
Pointthe second point
Returns
- double
euclidean between two point
FindLocationShortest(Point, List<Point>, double)
return the closest point from a list of points by manhattan distance
[MultiReturn(new string[] { "point", "distance" })]
public static Dictionary<string, object?> FindLocationShortest(Point lcMachine, List<Point> lcDevices, double limit = 1.7976931348623157E+308)
Parameters
Returns
FindShortestRoute(List<Point>)
takes a list of 3D points as input and returns the shortest route that visits each point exactly once' https://en.wikipedia.org/wiki/Travelling_salesman_problem
public static List<Line> FindShortestRoute(List<Point> points)
Parameters
points
List<Point>the list 3d points
Returns
- List<Line>
shortest route
Examples
Floor(Point)
Returns a new point with the smallest integer values that are greater than or equal to the X, Y, and Z coordinates of the input point.
public static Point Floor(Point point)
Parameters
point
PointThe input point.
Returns
- Point
The point with the smallest integer values that are greater than or equal to the X, Y, and Z coordinates of the input point.
Examples
GenerateRandomPointInCircle(Circle, int)
Generates an array of random 3D points inside a specified circle.
public static Point[] GenerateRandomPointInCircle(Circle circle, int numPoints)
Parameters
circle
CircleThe circle to generate points inside of.
numPoints
intThe number of random points to generate.
Returns
- Point[]
An array of Point3d objects representing the generated random points.
Examples
GenerateRandomPointsInCube(double, double, double, int)
Generates a given number of random points within a rectangular prism (i.e., a cube with different dimensions) of the given size.
public static List<Point> GenerateRandomPointsInCube(double width, double height, double length, int numPoints)
Parameters
width
doubleThe width of the rectangular prism (i.e., the length of the x-axis).
height
doubleThe height of the rectangular prism (i.e., the length of the y-axis).
length
doubleThe length of the rectangular prism (i.e., the length of the z-axis).
numPoints
intThe number of random points to generate.
Returns
- List<Point>
A list of randomly generated points within the rectangular prism.
Examples
GenerateRandomPointsInSphere(double, int)
Generates a given number of random points within a sphere of the given radius.
public static List<Point> GenerateRandomPointsInSphere(double radius, int numPoints)
Parameters
Returns
- List<Point>
A list of randomly generated points within the sphere.
Examples
GenerateRandomPointsOnCircle(Circle, double)
Generates an array of random 3D points on the circumference of a specified circle.
public static List<Point> GenerateRandomPointsOnCircle(Circle circle, double numPoints)
Parameters
circle
CircleThe circle to generate points on the circumference of.
numPoints
doubleThe number of random points to generate.
Returns
- List<Point>
An array of Point3d objects representing the generated random points.
Examples
IsInPolygon(Point, Polygon)
Returns whether an input point is contained within the polygon. If the polygon is not planar then the point will be projected onto the best-fit plane and the containment will be computed using the projection of the polygon onto the best-fit plane. This will return a failed status if the polygon self-intersects.
[NodeCategory("Query")]
public static bool IsInPolygon(Point point, Polygon polygon)
Parameters
point
Pointthe point
polygon
Polygonthe polygon
Returns
- bool
true if point is in polygon
Examples
Exceptions
IsInPolygonPlus(Point, Polygon)
Tests whether a point is inside, outside, or coincident with a polygon.
public static double IsInPolygonPlus(Point point, Polygon polygon)
Parameters
point
Pointpolygon
Polygon
Returns
- double
Returns -1 if point is outside the polygon, 0 if it is coincident with a polygon edge, or 1 if it is inside the polygon.
Examples
IsOnLine(Point, Line, double)
Test whether a point lies on a line.
[NodeCategory("Query")]
public static bool IsOnLine(Point point, Line line, double tolerance = 0.001)
Parameters
point
Pointa point to check
line
LineThe line to test against.
tolerance
doubleDefault is use 1e-6
Returns
- bool
Returns true if point is on line.
Examples
IsOnPlane(Point, Plane, double)
Test whether a point lies on a plane.
[NodeCategory("Query")]
public static bool IsOnPlane(Point point, Plane plane, double tolerance = 0.001)
Parameters
point
Pointpoint to check
plane
PlaneThe plane to test against.
tolerance
doubleDefault is use 1e-6
Returns
- bool
Returns true if point is on plane.
Examples
Manhattan(Point, Point)
return distance between two points by Manhattan distance
public static double Manhattan(Point p1, Point p2)
Parameters
p1
Pointp2
Point
Returns
- double
manhattan distance between two point
Offset(Point, double, Vector)
Offset a point by a distance and a direction
public static Point Offset(Point point, double distance, Vector direction)
Parameters
point
Pointpoint to offset
distance
doubledistance from start point to end point
direction
Vectordirection to direct to
Returns
- Point
new point
Examples
Origin()
Gets a point with X,Y,Z = 0
public static Point Origin()
Returns
- Point
point
Examples
ProjectOnToLine(Point?, Line?)
Project a point onto a line
public static Point ProjectOnToLine(Point? point, Line? line)
Parameters
point
PointPoint need to project
line
LineLine to project the point
Returns
- Point
projected point
Examples
ProjectOntoPlane(Point, Plane)
Project a point onto a plane
public static Point ProjectOntoPlane(Point point, Plane plane)
Parameters
point
Pointpoint need to project
plane
Planeplane to be project
Returns
- Point
new point projected on plane
Examples
Reflect(Point, Plane)
Reflect Point by Plane
public static Point Reflect(Point point, Plane plane)
Parameters
point
Pointpoint need to reflect
plane
Planeplane to reflect point
Returns
- Point
point has reflected
Examples
SortPointsAlongCurve(List<Point>, Curve)
Sort points along a curve
[MultiReturn(new string[] { "SortedPoints", "Indices" })]
public static Dictionary<string, object> SortPointsAlongCurve(List<Point> Points, Curve Guide)
Parameters
Points
List<Point>Points
Guide
CurveGuide curve
Returns
- Dictionary<string, object>
Points sorted along a curve.
Remarks
Index map of sorted points.
SortPointsByClockwise(List<Point>, double)
Sorts a list of Point3D objects by their clockwise order relative to a center point and a specified starting angle in degrees.
public static List<Point> SortPointsByClockwise(List<Point> points, double startAngle = 0)
Parameters
points
List<Point>The list of Point3D objects to be sorted
startAngle
doubleThe starting angle in degrees for the clockwise ordering
Returns
- List<Point>
The sorted list of Point3D objects
Examples
Point.SortPointsByClockwise.dyn
SortPointsByDirection(List<Point>, Vector)
Sorts a list of 3D points by their direction relative to a specified direction vector.
public static List<Point> SortPointsByDirection(List<Point> points, Vector direction)
Parameters
points
List<Point>The list of points to be sorted.
direction
VectorThe direction vector relative to which the points will be sorted.
Returns
- List<Point>
A new list of points sorted by their direction relative to the specified direction vector.