Line
using Autodesk.DesignScript.Interfaces;
using System.Collections.Generic;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Line : Curve
{
internal ILineEntity LineEntity => HostImpl as ILineEntity;
public Vector Direction => Vector.Wrap(LineEntity.get_Direction(), true);
internal Line(ILineEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "Line(StartPoint = " + base.StartPoint + ", EndPoint = " + base.EndPoint + ", Direction = " + Direction + ")";
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(ILineEntity), (IGeometryEntity host, bool persist) => new Line(host as ILineEntity, persist));
}
internal static Line Wrap(ILineEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Line;
}
internal static Line[] Wrap(ILineEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Line[][] Wrap(ILineEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static ILineEntity[][] Unwrap(Line[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ILineEntity[] Unwrap(Line[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ILineEntity[] Unwrap(IEnumerable<Line> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ILineEntity Unwrap(Line o)
{
return o.LineEntity;
}
public static Line ByStartPointEndPoint(Point startPoint, Point endPoint)
{
return Wrap(HostFactory.Factory.LineByStartPointEndPoint(Point.Unwrap(startPoint), Point.Unwrap(endPoint)), true);
}
public static Line ByBestFitThroughPoints(IEnumerable<Point> bestFitPoints)
{
return Wrap(HostFactory.Factory.LineByBestFitThroughPoints(Point.Unwrap(bestFitPoints)), true);
}
public static Line ByTangency(Curve curve, double parameter = 0)
{
return Wrap(HostFactory.Factory.LineByTangency(Curve.Unwrap(curve), parameter), true);
}
public static Line ByStartPointDirectionLength(Point startPoint, Vector direction, double length = 1)
{
return Wrap(HostFactory.Factory.LineByStartPointDirectionLength(Point.Unwrap(startPoint), Vector.Unwrap(direction), length), true);
}
}
}