コード例 #1
0
    /// <summary>
    /// Gets the positions represented by the DestinationGeometry.
    /// If the destinationGeometry is a Renderer, it will calculate the center of the model.
    /// </summary>
    /// <returns>Array of points that represent the object geometry</returns>
    public Vector3[] GetDestinationVertices()
    {
        // check if object has a geometry component
        VLGeometry vlDestinationGeometry = this.destinationGeometry.GetComponent <VLGeometry>();

        if (vlDestinationGeometry != null)
        {
            if (vlDestinationGeometry.currentMesh == null)
            {
                vlDestinationGeometry.UpdateMesh();
            }

            return(vlDestinationGeometry.currentMesh);
        }

        // check children for renderer
        List <Renderer> renderers =
            this.destinationGeometry.transform.GetComponentsInChildren <Renderer>().ToList();

        // check target object for renderer
        if (this.destinationGeometry.GetComponent <Renderer>())
        {
            renderers.Add(this.destinationGeometry.GetComponent <Renderer>());
        }

        if (renderers.Count > 0)
        {
            return(new[] { GetCenterOfRenderer(renderers) });
        }
        return(new[] { this.destinationGeometry.transform.position });
    }
コード例 #2
0
    private VIS.WorkSpace.Geometry GetDestinationGeometry(
        VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness)
    {
        VLGeometry creator = this.destinationGeometry.GetComponent <VLGeometry>();

        // check if object has a geometry component
        if (creator != null)
        {
            return(CreateVLGeometry(creator, fcsHandedness));
        }
        else
        {
            // if target object has no geometry component -> use center point which is stored in
            // destinationPoints[0]
            VIS.WorkSpace.Transform trans = VLUnityCameraHelper.CreateLocalVLTransform(
                this.destinationGeometry,
                fcsHandedness);
            Vector3[] destination = GetDestinationVertices();
            trans.t = new float[3] {
                destination[0].x, destination[0].y, destination[0].z
            };

            return(new VIS.WorkSpace.Plane(
                       0,
                       0,
                       1,
                       trans));
        }
    }
コード例 #3
0
 private static VIS.WorkSpace.Geometry CreateVLGeometry(VLGeometry creator,
                                                        VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness)
 {
     return(creator.CreateVLGeometry(VLUnityCameraHelper.CreateLocalVLTransform(
                                         creator.gameObject,
                                         fcsHandedness)));
 }
コード例 #4
0
            public Sphere(VLGeometry usedGeometry, WorkSpace.Transform trans) : base(defaultTypeName)
            {
                this.parameters = new Parameters();
                this.parameters.sphereRadius      = usedGeometry.sphereRadius;
                this.parameters.sphereThetaStart  = usedGeometry.thetaStart;
                this.parameters.sphereThetaLength = usedGeometry.thetaLength;
                this.parameters.sphereSamples     =
                    Mathf.FloorToInt(Remap(usedGeometry.detailLevel, 0f, 1f, 42f, 1281f));
                this.parameters.spherePhiStart  = usedGeometry.phiStart;
                this.parameters.spherePhiLength = usedGeometry.phiLength;

                this.parameters.transformation = trans;
            }
コード例 #5
0
 public static void DrawSingleSelectedGeometryGizmos(
     VLGeometry geometry,
     GizmoType gizmoType)
 {
     if (Selection.activeObject.name == "Origin")
     {
         PaintVertices(geometry.currentMesh, Color.white, geometry.transform);
     }
     else if (Selection.activeObject.name == "Destination")
     {
         PaintVertices(geometry.currentMesh, Color.cyan, geometry.transform);
     }
 }
コード例 #6
0
 private void Reset()
 {
     this.geometry = this.target as VLGeometry;
     UpdateGeometryMesh();
 }