// ╔════════════════════════════════════════════════════════════════╗
// ║ Copyright © 2025 NWH Coding d.o.o. All rights reserved. ║
// ║ Licensed under Unity Asset Store Terms of Service: ║
// ║ https://unity.com/legal/as-terms ║
// ║ Use permitted only in compliance with the License. ║
// ║ Distributed "AS IS", without warranty of any kind. ║
// ╚════════════════════════════════════════════════════════════════╝
#region
using UnityEngine;
#endregion
namespace NWH.DWP2.MiConvexHull
{
///
/// Unity-specific vertex implementation for convex hull calculations.
///
public class Vertex : IVertex
{
///
/// Initializes a new vertex with specified coordinates.
///
/// X coordinate.
/// Y coordinate.
/// Z coordinate.
public Vertex(double x, double y, double z)
{
Position = new double[3] { x, y, z, };
}
///
/// Initializes a new vertex from a Unity Vector3.
///
/// Unity Vector3 position.
public Vertex(Vector3 ver)
{
Position = new double[3] { ver.x, ver.y, ver.z, };
}
///
/// Position of the vertex in 3D space.
///
public double[] Position { get; set; }
///
/// Converts the vertex position to a Unity Vector3.
///
/// Unity Vector3 representation of the vertex position.
public Vector3 ToVec()
{
return new Vector3((float)Position[0], (float)Position[1], (float)Position[2]);
}
}
}