using ClipperLib;
using UnityEngine;
using System.Collections.Generic;


using NetPoly = TriangleNet.Geometry.Polygon;
using NetVertex = TriangleNet.Geometry.Vertex;
using NetContour = TriangleNet.Geometry.Contour;
using NetTriangle = TriangleNet.Geometry.ITriangle;
using NetMesh = TriangleNet.Meshing.IMesh;

/*
 * This abstract class offers multiple methods to convert objects
*/
public abstract class Converter {

    private static float coeff = 100.0f;

    //Points
	public static Vector2 intPointToVector(IntPoint point) {
        return new Vector2(point.X / coeff, point.Y / coeff);
    }

    public static Vector2 netVertexToVector(NetVertex point) {
        return new Vector2((float)point.X / coeff, (float)point.Y / coeff);
    }

    public static IntPoint vectorToIntPoint(Vector2 point) {
        return new IntPoint(point.x * coeff, point.y * coeff);
    }

	//Map
	public static GameVertex metersToGameCoo(Vertex v) {
		return new GameVertex(v.x() / 1000, v.y() / 1000);
	}

	public static float metersToGameCoo(float v) {
		return v / 1000.0f;
	}

	public static Vertex gameCooToMeters(GameVertex v, float z) {
		return new Vertex(v.x() * 1000, v.y() * 1000, z);
	}

	public static float gameCooToMeters(float value) {
		return value * 1000;
	}
}
