DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="0.9.0-beta" />

 Point

public class Point : Geometry
using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace Autodesk.DesignScript.Geometry { public class Point : Geometry { internal IPointEntity PointEntity => HostImpl as IPointEntity; public double X => PointEntity.X; public double Y => PointEntity.Y; public double Z => PointEntity.Z; internal Point(IPointEntity host, bool persist) : base(host, persist) { } public override string ToString() { return "Point(X = " + X.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ", Y = " + Y.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ", Z = " + Z.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ")"; } protected override bool Equals(DesignScriptEntity other) { if (base.Equals(other)) return true; Point point = other as Point; if (point == null) return false; if (point.X.Equals(X) && point.Y.Equals(Y)) return point.Z.Equals(Z); return false; } protected override int ComputeHashCode() { int num = 17; num = num * 23 + X.GetHashCode(); num = num * 23 + Y.GetHashCode(); return num * 23 + Z.GetHashCode(); } internal static void InitType() { Geometry.RegisterHostType(typeof(IPointEntity), (IGeometryEntity host, bool persist) => new Point(host as IPointEntity, persist)); } internal static Point Wrap(IPointEntity host, bool persist = true) { return Geometry.Wrap(host, false, null) as Point; } internal static Point[] Wrap(IPointEntity[] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static Point[][] Wrap(IPointEntity[][] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static IPointEntity[][] Unwrap(Point[][] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IPointEntity[] Unwrap(Point[] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IPointEntity[] Unwrap(IEnumerable<Point> o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IPointEntity Unwrap(Point o) { return o.PointEntity; } public static Point ByCoordinates(double x = 0, double y = 0) { return Wrap(HostFactory.Factory.PointByCoordinates(x, y), true); } public static Point Origin() { return Wrap(HostFactory.Factory.PointOrigin(), true); } public static Point ByCoordinates(double x = 0, double y = 0, double z = 0) { return Wrap(HostFactory.Factory.PointByCoordinates(x, y, z), true); } public static Point ByCartesianCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double x = 0, double y = 0, double z = 0) { return Wrap(HostFactory.Factory.PointByCartesianCoordinates(CoordinateSystem.Unwrap(cs), x, y, z), true); } public static Point ByCylindricalCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double angle = 0, double elevation = 0, double radius = 1) { return Wrap(HostFactory.Factory.PointByCylindricalCoordinates(CoordinateSystem.Unwrap(cs), angle, elevation, radius), true); } public static Point BySphericalCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double phi = 0, double theta = 0, double radius = 1) { return Wrap(HostFactory.Factory.PointBySphericalCoordinates(CoordinateSystem.Unwrap(cs), phi, theta, radius), true); } public static Point[] PruneDuplicates(IEnumerable<Point> points, double tolerance = 0.001) { return Wrap(HostFactory.Factory.PointPruneDuplicates(Unwrap(points), tolerance), true); } public Vector AsVector() { return Vector.Wrap(PointEntity.AsVector(), true); } public Point Add(Vector vectorToAdd) { return Wrap(PointEntity.Add(Vector.Unwrap(vectorToAdd)), true); } public Point Subtract(Vector vectorToSubtract) { return Wrap(PointEntity.Subtract(Vector.Unwrap(vectorToSubtract)), true); } public Geometry[] Project(Geometry baseGeometry, Vector projectionDirection) { return Geometry.Wrap(PointEntity.Project(Geometry.Unwrap(baseGeometry), Vector.Unwrap(projectionDirection))); } } }