Example #1
0
    public void AddGizmoArea(Gizmo gizmo)
    {
        if (!(gizmo is GizmoArea))
        {
            return;
        }
        GizmoArea gizmoArea = (GizmoArea)gizmo;

        GameObject gizmoObject = new GameObject("area");

        gizmoObject.transform.SetParent(gizmoWrapper.transform);

        AreaBehaviour areaBehaviour = gizmoObject.AddComponent <AreaBehaviour>();

        areaBehaviour.Init(geoCamera);

        FaceRefer face   = gizmoArea.face;
        Vector3   center = geometry.Center();

        Vector3[] vectors = new Vector3[face.ids.Length];
        for (int i = 0; i < face.ids.Length; i++)
        {
            vectors[i] = geometry.UnitVector(face.ids[i]);
        }
        float area = geometry.FaceArea(face.ids);

        areaBehaviour.SetData(center, vectors, area);

        gizmoMap.Add(gizmoArea, areaBehaviour);
    }
Example #2
0
    public void UpdateGizmoArea(Gizmo gizmo)
    {
        if (!(gizmo is GizmoArea))
        {
            return;
        }
        GizmoArea gizmoArea = (GizmoArea)gizmo;

        AreaBehaviour areaBehaviour = (AreaBehaviour)gizmoMap[gizmoArea];

        FaceRefer face   = gizmoArea.face;
        Vector3   center = geometry.Center();

        Vector3[] vectors = new Vector3[face.ids.Length];
        for (int i = 0; i < face.ids.Length; i++)
        {
            vectors[i] = geometry.UnitVector(face.ids[i]);
        }
        float area = geometry.FaceArea(face.ids);

        areaBehaviour.SetData(center, vectors, area);
    }