CoordinateSystem
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class CoordinateSystem : DesignScriptEntity
{
internal ICoordinateSystemEntity CoordinateSystemEntity => HostImpl as ICoordinateSystemEntity;
public bool IsSingular => CoordinateSystemEntity.get_IsSingular();
public bool IsScaledOrtho => CoordinateSystemEntity.get_IsScaledOrtho();
public bool IsUniscaledOrtho => CoordinateSystemEntity.get_IsUniscaledOrtho();
public double Determinant => CoordinateSystemEntity.get_Determinant();
public Point Origin => Point.Wrap(CoordinateSystemEntity.get_Origin(), true);
public Vector XAxis => Vector.Wrap(CoordinateSystemEntity.get_XAxis(), true);
public Vector YAxis => Vector.Wrap(CoordinateSystemEntity.get_YAxis(), true);
public Vector ZAxis => Vector.Wrap(CoordinateSystemEntity.get_ZAxis(), true);
public double XScaleFactor => CoordinateSystemEntity.get_XScaleFactor();
public double YScaleFactor => CoordinateSystemEntity.get_YScaleFactor();
public double ZScaleFactor => CoordinateSystemEntity.get_ZScaleFactor();
public Plane XYPlane => Plane.Wrap(CoordinateSystemEntity.get_XYPlane(), true);
public Plane YZPlane => Plane.Wrap(CoordinateSystemEntity.get_YZPlane(), true);
public Plane ZXPlane => Plane.Wrap(CoordinateSystemEntity.get_ZXPlane(), true);
internal CoordinateSystem(ICoordinateSystemEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "CoordinateSystem(Origin = " + Origin + ", XAxis = " + XAxis + ", YAxis = " + YAxis + ", ZAxis = " + ZAxis + ", XScaleFactor = " + XScaleFactor + ", YScaleFactor = " + YScaleFactor + ", ZScaleFactor = " + ZScaleFactor + ")";
}
internal static CoordinateSystem Wrap(ICoordinateSystemEntity host, bool persist = true)
{
if (host == null)
return null;
return new CoordinateSystem(host, persist);
}
internal static CoordinateSystem[] Wrap(ICoordinateSystemEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static ICoordinateSystemEntity[] Unwrap(CoordinateSystem[] o)
{
return o.Select(Unwrap).ToArray();
}
internal static ICoordinateSystemEntity Unwrap(CoordinateSystem o)
{
return o.CoordinateSystemEntity;
}
public static CoordinateSystem Identity()
{
return Wrap(HostFactory.Factory.CoordinateSystemIdentity(), true);
}
public static CoordinateSystem ByMatrix(double[] matrix)
{
return Wrap(HostFactory.Factory.CoordinateSystemByMatrix(matrix), true);
}
public static CoordinateSystem ByOrigin(double x = 0, double y = 0)
{
return Wrap(HostFactory.Factory.CoordinateSystemByOrigin(x, y), true);
}
public static CoordinateSystem ByOrigin(double x = 0, double y = 0, double z = 0)
{
return Wrap(HostFactory.Factory.CoordinateSystemByOrigin(x, y, z), true);
}
public static CoordinateSystem ByOrigin([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point origin)
{
return Wrap(HostFactory.Factory.CoordinateSystemByOrigin(Point.Unwrap(origin)), true);
}
public static CoordinateSystem ByPlane([DefaultArgument("Plane.XY()")] Plane plane)
{
return Wrap(HostFactory.Factory.CoordinateSystemByPlane(Plane.Unwrap(plane)), true);
}
public static CoordinateSystem ByOriginVectors([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.CoordinateSystemByOriginVectors(Point.Unwrap(origin), Vector.Unwrap(xAxis), Vector.Unwrap(yAxis)), true);
}
public static CoordinateSystem ByOriginVectors([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point origin, [DefaultArgument("Vector.ByCoordinates(1, 0, 0)")] Vector xAxis, [DefaultArgument("Vector.ByCoordinates(0, 1, 0)")] Vector yAxis, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector zAxis)
{
return Wrap(HostFactory.Factory.CoordinateSystemByOriginVectors(Point.Unwrap(origin), Vector.Unwrap(xAxis), Vector.Unwrap(yAxis), Vector.Unwrap(zAxis)), true);
}
public static CoordinateSystem ByCylindricalCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double radius = 0, double theta = 0, double height = 0)
{
return Wrap(HostFactory.Factory.CoordinateSystemByCylindricalCoordinates(Unwrap(cs), radius, theta, height), true);
}
public static CoordinateSystem BySphericalCoordinates([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double radius = 0, double theta = 0, double phi = 0)
{
return Wrap(HostFactory.Factory.CoordinateSystemBySphericalCoordinates(Unwrap(cs), radius, theta, phi), true);
}
public CoordinateSystem Inverse()
{
return Wrap(CoordinateSystemEntity.Inverse(), true);
}
public CoordinateSystem Mirror(Plane mirrorPlane)
{
return Wrap(CoordinateSystemEntity.Mirror(mirrorPlane.PlaneEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem PostMultiplyBy(CoordinateSystem other)
{
return Wrap(CoordinateSystemEntity.PostMultiplyBy(Unwrap(other)), true);
}
public CoordinateSystem PreMultiplyBy(CoordinateSystem other)
{
return Wrap(CoordinateSystemEntity.PreMultiplyBy(Unwrap(other)), true);
}
public Vector ScaleFactor()
{
return Vector.Wrap(CoordinateSystemEntity.ScaleFactor(), true);
}
public bool IsEqualTo(CoordinateSystem other)
{
return CoordinateSystemEntity.IsEqualTo(Unwrap(other));
}
public CoordinateSystem Translate(double xTranslation = 0, double yTranslation = 0, double zTranslation = 0)
{
return Wrap(CoordinateSystemEntity.Translate(xTranslation, yTranslation, zTranslation) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Translate(Vector direction)
{
return Wrap(CoordinateSystemEntity.Translate(direction.VectorEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Translate(Vector direction, double distance = 0)
{
return Wrap(CoordinateSystemEntity.Translate(direction.VectorEntity, distance) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Transform(CoordinateSystem cs)
{
return Wrap(CoordinateSystemEntity.Transform(cs.CoordinateSystemEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Transform(CoordinateSystem fromCoordinateSystem, CoordinateSystem contextCoordinateSystem)
{
return Wrap(CoordinateSystemEntity.TransformFromTo(fromCoordinateSystem.CoordinateSystemEntity, contextCoordinateSystem.CoordinateSystemEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Rotate(Point origin, Vector axis, double degrees = 0)
{
return Wrap(CoordinateSystemEntity.Rotate(origin.PointEntity, axis.VectorEntity, degrees) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Rotate(Plane plane, double degrees = 0)
{
return Wrap(CoordinateSystemEntity.Rotate(plane.PlaneEntity, degrees) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale(double amount = 1)
{
return Wrap(CoordinateSystemEntity.Scale(amount) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale(double xamount = 1, double yamount = 1, double zamount = 1)
{
return Wrap(CoordinateSystemEntity.Scale(xamount, yamount, zamount) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale(Plane plane, double xamount = 1, double yamount = 1, double zamount = 1)
{
return Wrap(CoordinateSystemEntity.Scale(Plane.Unwrap(plane), xamount, yamount, zamount) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale(Point basePoint, Point from, Point to)
{
return Wrap(CoordinateSystemEntity.Scale(basePoint.PointEntity, from.PointEntity, to.PointEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale1D(Point basePoint, Point from, Point to)
{
return Wrap(CoordinateSystemEntity.Scale1D(basePoint.PointEntity, from.PointEntity, to.PointEntity) as ICoordinateSystemEntity, true);
}
public CoordinateSystem Scale2D(Plane basePlane, Point from, Point to)
{
return Wrap(CoordinateSystemEntity.Scale2D(basePlane.PlaneEntity, from.PointEntity, to.PointEntity) as ICoordinateSystemEntity, true);
}
}
}