Esempio n. 1
0
    public override void InitWithGeometry(Geometry geometry)
    {
        units = new VertexUnit[] { };
        if (geometry is ResolvedBody)
        {
            resolvedBody = (ResolvedBody)geometry;
        }
        GeoVertex[] geoVertices = geometry.GeoVertices();
        int[]       ids         = new int[geoVertices.Length];
        for (int i = 0; i < geoVertices.Length; i++)
        {
            ids[i] = geoVertices[i].VertexUnit().id;
        }
        face = new FaceRefer(ids);

        elements = new GeoElement[] { };

        dependencies.AddRange(units);

        GeoCircular[] geoCirculars = geometry.GeoCirculars();
        if (geoCirculars.Length != 0)
        {
            GeoCircular geoCircular = geoCirculars[0];
            circular = geoCircular.Circular();
        }
    }
Esempio n. 2
0
    public override Measure GenerateMeasure(Geometry geometry, FormInput formInput)
    {
        bool valid = ValidateInput(geometry, formInput);

        if (!valid)
        {
            return(null);
        }

        if (!(geometry is ResolvedBody))
        {
            return(null);
        }
        else
        {
            ResolvedBody resolvedBody = (ResolvedBody)geometry;
            if (!resolvedBody.isSpinned)
            {
                return(null);
            }
            GeoCircular[] geoCirculars = geometry.GeoCirculars();
            if (geoCirculars.Length != 0)
            {
                GeoCircular geoCircular = geoCirculars[0];
                Circular    circular    = geoCircular.Circular();
                if (!circular.IsNormalCircular())
                {
                    return(null);
                }
            }
        }

        GeoVertex[] geoVertices = geometry.GeoVertices();
        int[]       ids         = new int[geoVertices.Length];
        int         index       = 0;

        foreach (GeoVertex vertice in geoVertices)
        {
            ids[index++] = vertice.Id;
        }
        SurfaceAreaMeasure measure = new SurfaceAreaMeasure(ids);

        return(measure);
    }
Esempio n. 3
0
    public void GenerateResolvedBody(Geometry geometry)
    {
        SpinAuxiliary auxiliary = new SpinAuxiliary();

        auxiliary.InitWithGeometry(geometry);
        geometryBehaviour = GameObject.Find("/3D/Geometry").GetComponent <GeometryBehaviour>();
        VertexUnit[] vertexUnits = auxiliary.vertices;
        // Cylinder
        if (vertexUnits.Length == 4)
        {
            VertexUnit vertex1 = vertexUnits[0];
            VertexUnit vertex2 = vertexUnits[1];
            VertexUnit vertex3 = vertexUnits[2];
            VertexUnit vertex4 = vertexUnits[3];
            float      radius1 = vertexUnits[3].Position().z;
            float      radius2 = vertexUnits[2].Position().z;

            GeoCircular circular = new GeoCircular(new VertexUnit[] { vertex1, vertex2, vertex3, vertex4 }, radius1, radius2, CircularType.Cylinder);
            bool        showFace = false;
            if (circular.Circular().IsNormalCircular())
            {
                showFace = true;
            }
            geometry.AddGeoCircular(circular);

            for (int i = 0; i < vertexUnits.Length; i++)
            {
                if (vertexUnits[i].Position().z > 0)
                {
                    VertexSpace circle = new VertexSpace(0, vertexUnits[i].Position().y, 0);
                    geometry.AddGeoCircle(new GeoCircle(circle, vertexUnits[i].Position().z, CircleDirection.Y, showFace, FaceType.SpreadCylinderCircle));
                }
            }
        }
        // Cone
        else if (vertexUnits.Length == 3)
        {
            VertexUnit vertex1 = vertexUnits[0];
            VertexUnit vertex2 = vertexUnits[1];
            VertexUnit vertex3 = vertexUnits[2];
            float      radius  = vertexUnits[2].Position().z;

            GeoCircular circular = new GeoCircular(new VertexUnit[] { vertex1, vertex2, vertex3 }, radius, radius, CircularType.Cone);
            bool        showFace = false;
            if (circular.Circular().IsNormalCircular())
            {
                showFace = true;
            }
            geometry.AddGeoCircular(circular);
            for (int i = 0; i < vertexUnits.Length; i++)
            {
                if (vertexUnits[i].Position().z > 0)
                {
                    VertexSpace circle = new VertexSpace(0, vertexUnits[i].Position().y, 0);
                    geometry.AddGeoCircle(new GeoCircle(circle, vertexUnits[i].Position().z, CircleDirection.Y, showFace, FaceType.SpreadCylinderCircle));
                }
            }
        }
        geometryBehaviour.InitGeometry(geometry);

        StatusButton lockButton = GameObject.Find("LockButton").GetComponent <StatusButton>();

        lockButton.SetStatus(0);
    }
Esempio n. 4
0
 public Circular Circular(GeoCircular circular)
 {
     return(circular.Circular());
 }