Exemple #1
0
        internal sMesh TosMesh(List <double> triVerticeInfo, sColor scol)
        {
            //nine conseq
            sMesh sm        = new sMesh();
            int   faceCount = (int)(triVerticeInfo.Count / 9);

            int verID  = 0;
            int infoID = 0;

            for (int i = 0; i < faceCount; ++i)
            {
                sm.SetVertex(verID + 0, new sXYZ(triVerticeInfo[infoID + 0], triVerticeInfo[infoID + 1], triVerticeInfo[infoID + 2]), scol);
                sm.SetVertex(verID + 1, new sXYZ(triVerticeInfo[infoID + 3], triVerticeInfo[infoID + 4], triVerticeInfo[infoID + 5]), scol);
                sm.SetVertex(verID + 2, new sXYZ(triVerticeInfo[infoID + 6], triVerticeInfo[infoID + 7], triVerticeInfo[infoID + 8]), scol);

                sm.SetFace(i, verID + 0, verID + 1, verID + 2);

                verID  += 3;
                infoID += 9;
            }
            sm.ComputeNormals();

            return(sm);
        }
Exemple #2
0
        public sMesh ConstructBeamColorMesh(sRange dataRange, eColorMode colorMode, sRange threshold, double du)
        {
            sMesh sm = new sMesh();

            int vertexID = 0;

            for (int i = 0; i < this.results.Count; ++i)
            {
                sFrameResult br = this.results[i];

                for (int j = 0; j < br.sectionResults.Count; ++j)
                {
                    sFrameSectionResult sr = br.sectionResults[j];
                    sColor vcol            = this.GetBeamResultColor(dataRange, colorMode, i, j, 255, threshold);
                    sXYZ   deflectionVec   = du * (sr.deflection_mm * 0.001);
                    sXYZ   deflectedPt     = sr.location + deflectionVec;
                    sm.SetVertex(vertexID, deflectedPt, vcol);
                    //or
                    //sm.SetVertex(vertexID, sr.point, vcol);

                    sr.ID = vertexID;

                    vertexID++;
                }
            }

            int vertexCountPerFace = this.results[0].sectionResults.Count;
            int faceIndex          = 0;

            for (int i = 0; i < this.results.Count - 1; ++i)
            {
                sFrameResult br_this = this.results[i];
                sFrameResult br_next = this.results[i + 1];

                for (int j = 0; j < br_this.sectionResults.Count; ++j)
                {
                    int id0 = 0;
                    int id1 = 0;
                    int id2 = 0;
                    int id3 = 0;
                    if (j < br_this.sectionResults.Count - 1)
                    {
                        id0 = br_this.sectionResults[j].ID;
                        id1 = br_next.sectionResults[j].ID;
                        id2 = br_next.sectionResults[j + 1].ID;
                        id3 = br_this.sectionResults[j + 1].ID;
                    }
                    else
                    {
                        id0 = br_this.sectionResults[j].ID;
                        id1 = br_next.sectionResults[j].ID;
                        id2 = br_next.sectionResults[0].ID;
                        id3 = br_this.sectionResults[0].ID;
                    }

                    sm.SetFace(faceIndex, faceIndex + 1, id0, id1, id2, id3);
                    faceIndex += 2;
                }
            }

            sm.ComputeNormals();
            return(sm);
        }