Ejemplo n.º 1
0
        private static double functionF(BezieCurve boundaryShape, double s, double s1, double denominator2, int collPointIndex)
        {
            var    n = boundaryShape.CalculateNormalVector(s);
            double L = (boundaryShape.a1.x + (s1 + s) * boundaryShape.a2.x + (s1 * s1 + s * s1 + s * s) * boundaryShape.a3.x) * n.X +
                       (boundaryShape.a1.y + (s1 + s) * boundaryShape.a2.y + (s1 * s1 + s * s1 + s * s) * boundaryShape.a3.y) * n.Y;
            double M = Math.Pow((boundaryShape.a1.x + (s1 + s) * boundaryShape.a2.x + (s1 * s1 + s * s1 + s * s) * boundaryShape.a3.x), 2) +
                       Math.Pow((boundaryShape.a1.y + (s1 + s) * boundaryShape.a2.y + (s1 * s1 + s * s1 + s * s) * boundaryShape.a3.y), 2);
            double r2 = Math.Pow(s1 * boundaryShape.lenght - s * boundaryShape.lenght, 2) * M;
            double f  = L / M
                        * Math.Exp(-r2 / denominator2)
                        * CzebyshewSeries.calculate(s * boundaryShape.lenght, collPointIndex);

            return(f);
        }
        private static IBoundaryShape MapBoundaryShape(XElement Xsegment)
        {
            var            XboundaryShapeCurve = Xsegment.Element(boundaryShapeCurveElementName);
            IBoundaryShape boundaryshape       = null;
            var            boundaryShapeType   = int.Parse(XboundaryShapeCurve.Attribute(boundaryShapeTypeAttributeName).Value);

            if (boundaryShapeType == 1)
            {
                boundaryshape = new LinearCurve(
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P0").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P0").Attribute("y").Value.Replace(".", ","))),
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P1").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P1").Attribute("y").Value.Replace(".", ",")))
                    );
            }
            else if (boundaryShapeType == 3)
            {
                boundaryshape = new BezieCurve(
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P0").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P0").Attribute("y").Value.Replace(".", ","))),
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P3").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P3").Attribute("y").Value.Replace(".", ","))),
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P1").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P1").Attribute("y").Value.Replace(".", ","))),
                    new RealPoint(double.Parse(XboundaryShapeCurve.Element("P2").Attribute("x").Value.Replace(".", ",")), double.Parse(XboundaryShapeCurve.Element("P2").Attribute("y").Value.Replace(".", ","))));
            }
            return(boundaryshape);
        }