using System.Windows.Media.Media3D;
namespace HelixToolkit
{
public static class Vector3DExtensions
{
///
/// Find a that is perpendicular to the given .
///
///
///
public static Vector3D FindAnyPerpendicular(this Vector3D n)
{
Vector3D u = Vector3D.CrossProduct(new Vector3D(0, 1, 0), n);
if (u.LengthSquared < 1e-3)
u = Vector3D.CrossProduct(new Vector3D(1, 0, 0), n);
return u;
}
///
/// Convert a to a .
///
///
///
public static Vector3D ToVector3D(this Point3D n)
{
return new Vector3D(n.X, n.Y, n.Z);
}
///
/// Convert a to a .
///
///
///
public static Point3D ToPoint3D(this Vector3D n)
{
return new Point3D(n.X, n.Y, n.Z);
}
}
}