示例#1
0
        /// <summary>
        /// refreshes the <see cref="Edge.ParamCurve"/> of the <see cref="EdgeList"/>.
        /// <see cref="ParamCurves"/>-liste. Diese doppelte Verwaltung der ParamCurves wird lediglich aus Performancegründen gemacht.
        /// </summary>
        public virtual void RefreshParamCurves()
        {
            Solid P = Parent;

            DrawPoints       = new Loxyz();
            DrawPoints.Count = Bounds.Count;

            if (ParamCurves == null)
            {
                Surface.BoundedCurves = new Loca();
            }
            ParamCurves.Clear();
            for (int i = 0; i < Bounds.Count; i++)
            {
                EdgeLoop   EL = Bounds[i];
                CurveArray CA = new CurveArray();
                ParamCurves.Add(CA);
                for (int j = 0; j < EL.Count; j++)
                {
                    Edge E = EL[j];
                    if (!DrawRelativToSurfaceBase)
                    {
                        DrawPoints[i].Add(E.EdgeStart.Value);
                    }
                    Curve c = Surface.To2dCurve(EL[j].EdgeCurve);
                    if (!EL[j].SameSense)
                    {
                        c.Invert();
                    }
                    EL[j].ParamCurve = c;

                    CA.Add(c);
                }
                xyArray A = CA.getxyArrayClosed(false);

                DrawPoints[i] = A.ToxyzArray();
            }
        }
示例#2
0
        void RefreshNormals()
        {
            Normals          = new Loxyz();
            Normals.Count    = Bounds.Count;
            DrawPoints       = new Loxyz();
            DrawPoints.Count = ParamCurves.Count;
            if (!DrawRelativToSurfaceBase)
            {
                for (int i = 0; i < Bounds.Count; i++)
                {
                    EdgeLoop EL = Bounds[i];
                    for (int k = 0; k < EL.Count; k++)
                    {
                        Edge E = EL[k];
                        DrawPoints[i].Add(E.EdgeStart.Value);
                    }
                }
            }

            for (int i = 0; i < ParamCurves.Count; i++)
            {
                xyArray A = ParamCurves[i].getxyArrayClosed(false);
                if (DrawRelativToSurfaceBase)
                {
                    DrawPoints[i] = A.ToxyzArray();
                }

                int ct = 0;
                for (int t = 0; t < ParamCurves[i].Count; t++)
                {
                    ct = ct + ParamCurves[i][t].Resolution;
                }
                xyzArray NormalsLoop = new xyzArray(ct);
                Normals[i] = NormalsLoop;
                int id = 0;

                for (int j = 0; j < ParamCurves[i].Count; j++)
                {
                    List <Face> L = GetFaces(this, i, j);
                    Edge        E = Bounds[i][j];

                    if (L == null)
                    {
                        Normals = null;

                        DrawPoints = null;
                        return;
                    }
                    double SmoothAngle = Parent.SmoothAngle;
                    xyz    N           = Surface.Normal(0, 0).normalized();
                    xyz    N1          = Surface.Normal(0, 0).normalized();
                    for (int k = 0; k < L.Count; k++)
                    {
                        if (System.Math.Abs((N1 * L[k].Surface.Normal(0, 0).normalized())) > System.Math.Cos(SmoothAngle))
                        {
                            N = N + L[k].Surface.Normal(0, 0).normalized();
                        }
                    }
                    N = N.normalized();
                    if (DrawRelativToSurfaceBase)
                    {
                        Matrix M = Surface.Base.ToMatrix().invert();
                        N = M * N - M * new xyz(0, 0, 0);
                    }

                    NormalsLoop[id] = N;
                    id++;
                }
            }
        }