Plane
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Plane : Geometry
{
internal IPlaneEntity PlaneEntity => HostImpl as IPlaneEntity;
public Point Origin => Point.Wrap(PlaneEntity.get_Origin(), true);
public Vector Normal => Vector.Wrap(PlaneEntity.get_Normal(), true);
public Vector XAxis => Vector.Wrap(PlaneEntity.get_XAxis(), true);
public Vector YAxis => Vector.Wrap(PlaneEntity.get_YAxis(), true);
internal Plane(IPlaneEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "Plane(Origin = " + Origin + ", Normal = " + Normal + ", XAxis = " + XAxis + ", YAxis = " + YAxis + ")";
}
internal static void InitType()
{
Geometry.RegisterHostType(typeof(IPlaneEntity), (IGeometryEntity host, bool persist) => new Plane(host as IPlaneEntity, persist));
}
internal static Plane Wrap(IPlaneEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Plane;
}
internal static Plane[] Wrap(IPlaneEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Plane[][] Wrap(IPlaneEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IPlaneEntity[][] Unwrap(Plane[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPlaneEntity[] Unwrap(Plane[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPlaneEntity[] Unwrap(IEnumerable<Plane> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPlaneEntity Unwrap(Plane o)
{
return o.PlaneEntity;
}
public static Plane ByOriginNormal([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point origin, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector normal)
{
return Wrap(HostFactory.Factory.PlaneByOriginNormal(Point.Unwrap(origin), Vector.Unwrap(normal)), true);
}
public static Plane ByOriginNormalXAxis([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point origin, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector normal, [DefaultArgument("Vector.ByCoordinates(1, 0, 0)")] Vector xAxis)
{
return Wrap(HostFactory.Factory.PlaneByOriginNormalXAxis(Point.Unwrap(origin), Vector.Unwrap(normal), Vector.Unwrap(xAxis)), true);
}
public static Plane ByOriginXAxisYAxis([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point origin, [DefaultArgument("Vector.ByCoordinates(1, 0, 0)")] Vector xAxis, [DefaultArgument("Vector.ByCoordinates(0, 1, 0)")] Vector yAxis)
{
return Wrap(HostFactory.Factory.PlaneByOriginXAxisYAxis(Point.Unwrap(origin), Vector.Unwrap(xAxis), Vector.Unwrap(yAxis)), true);
}
public static Plane ByBestFitThroughPoints(IEnumerable<Point> points)
{
return Wrap(HostFactory.Factory.PlaneByBestFitThroughPoints(Point.Unwrap(points)), true);
}
public static Plane ByLineAndPoint(Line line, Point point)
{
return Wrap(HostFactory.Factory.PlaneByLineAndPoint(Line.Unwrap(line), Point.Unwrap(point)), true);
}
public static Plane ByThreePoints(Point origin, Point planePoint, Point xAxisPoint)
{
return Wrap(HostFactory.Factory.PlaneByThreePoints(Point.Unwrap(origin), Point.Unwrap(planePoint), Point.Unwrap(xAxisPoint)), true);
}
public static Plane XY()
{
return Wrap(HostFactory.Factory.PlaneXY(), true);
}
public static Plane XZ()
{
return Wrap(HostFactory.Factory.PlaneXZ(), true);
}
public static Plane YZ()
{
return Wrap(HostFactory.Factory.PlaneYZ(), true);
}
public CoordinateSystem ToCoordinateSystem()
{
return CoordinateSystem.Wrap(PlaneEntity.ToCoordinateSystem(), true);
}
public Plane Offset(double dist = 1)
{
return Wrap(PlaneEntity.Offset(dist), true);
}
}
}