UV
using Autodesk.DesignScript.Interfaces;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class UV
{
internal IUVEntity UVEntity { get; set; }
public double U => UVEntity.U;
public double V => UVEntity.V;
internal UV(IUVEntity host, bool persist)
{
UVEntity = host;
}
public override string ToString()
{
return "UV(U = " + U.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ", V = " + V.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ")";
}
public override bool Equals(object other)
{
if (base.Equals(other))
return true;
UV uV = other as UV;
if (uV == null)
return false;
if (uV.U.Equals(U))
return uV.V.Equals(V);
return false;
}
public override int GetHashCode()
{
int num = 17;
num = num * 23 + U.GetHashCode();
return num * 23 + V.GetHashCode();
}
internal static UV Wrap(IUVEntity host, bool persist = true)
{
if (host == null)
return null;
return new UV(host, persist);
}
internal static UV[] Wrap(IUVEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static UV[][] Wrap(IUVEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IUVEntity[][] Unwrap(UV[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IUVEntity[] Unwrap(UV[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IUVEntity[] Unwrap(IEnumerable<UV> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IUVEntity Unwrap(UV o)
{
return o.UVEntity;
}
public static UV ByCoordinates(double u = 0, double v = 0)
{
return Wrap(HostFactory.Factory.UVByCoordinates(u, v), true);
}
}
}