DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="2.0.0-beta3667" />

 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; [Scaling()] public double X { get { return PointEntity.get_X() * DesignScriptEntity.scaleFactor; } } [Scaling()] public double Y { get { return PointEntity.get_Y() * DesignScriptEntity.scaleFactor; } } [Scaling()] public double Z { get { return PointEntity.get_Z() * DesignScriptEntity.scaleFactor; } } internal Point(IPointEntity host, bool persist) : base(host, persist) { } public override string ToString() { string[] obj = new string[7] { "Point(X = ", null, null, null, null, null, null }; double num = X; obj[1] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture); obj[2] = ", Y = "; num = Y; obj[3] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture); obj[4] = ", Z = "; num = Z; obj[5] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture); obj[6] = ")"; return string.Concat(obj); } protected override bool Equals(DesignScriptEntity other) { if (base.Equals(other)) return true; Point point = other as Point; if (point == null) return false; double num = point.X; if (num.Equals(X)) { num = point.Y; if (num.Equals(Y)) { num = point.Z; return num.Equals(Z); } } return false; } protected override int ComputeHashCode() { int num = 17 * 23; double num2 = X; int num3 = (num + num2.GetHashCode()) * 23; num2 = Y; int num4 = (num3 + num2.GetHashCode()) * 23; num2 = Z; return num4 + num2.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([Scaling()] double x = 0, [Scaling()] double y = 0) { x /= DesignScriptEntity.scaleFactor; y /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.PointByCoordinates(x, y), true); } public static Point Origin() { return Wrap(HostFactory.Factory.PointOrigin(), true); } public static Point ByCoordinates([Scaling()] double x = 0, [Scaling()] double y = 0, [Scaling()] double z = 0) { x /= DesignScriptEntity.scaleFactor; y /= DesignScriptEntity.scaleFactor; z /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.PointByCoordinates(x, y, z), true); } public static Point ByCartesianCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, [Scaling()] double x = 0, [Scaling()] double y = 0, [Scaling()] double z = 0) { x /= DesignScriptEntity.scaleFactor; y /= DesignScriptEntity.scaleFactor; z /= DesignScriptEntity.scaleFactor; 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, [Scaling()] double elevation = 0, [Scaling()] double radius = 1) { elevation /= DesignScriptEntity.scaleFactor; radius /= DesignScriptEntity.scaleFactor; 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, [Scaling()] double radius = 1) { radius /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.PointBySphericalCoordinates(CoordinateSystem.Unwrap(cs), phi, theta, radius), true); } public static Point[] PruneDuplicates(IEnumerable<Point> points, [Scaling()] double tolerance = 0.001) { tolerance /= DesignScriptEntity.scaleFactor; 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))); } } }