コード例 #1
0
ファイル: C_Raud.cs プロジェクト: 15831944/habile
        public C_Raud(G.Line main, G.Line side, int nr, int d, string teras) : base(main, nr, d, teras)
        {
            G.Vector mainDir = main.getDirectionVector();
            G.Polar  mainPol = G.Converter.xy_to_la(mainDir);

            G.Vector sideDir = side.getDirectionVector();
            G.Polar  sidePol = G.Converter.xy_to_la(sideDir);

            _A = shorter(side.Length());
            _B = shorter(main.Length());
            _U = G.Converter.AngleDelta(mainPol.angle, sidePol.angle);

            _IP     = main.Start;
            _Length = _A + _B;

            //OVERRIDE
            G.Vector dir           = main.getDirectionVector();
            double   shorterLength = shorter(main.Length());

            _StartPoint = main.Start;
            _EndPoint   = _StartPoint.move(shorterLength, dir);
            //OVERRIDE

            G.Vector v1 = -1 * side.getDirectionVector();
            _SidePoint = _StartPoint.move(_A, v1);
        }
コード例 #2
0
        private void define_side_D(LineSegment seg)
        {
            G.Line ln         = seg.getLine();
            G.Line offsetLine = ln.Offset(_V_.X_CONCRETE_COVER_1);

            G.Vector d1 = ln.getDirectionVector();
            G.Vector o1 = ln.getOffsetVector();

            double absX = Math.Abs(o1.X);
            double absY = Math.Abs(o1.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            int spacing;
            int distance;
            int parand; // parand magic

            if (p.angle < Math.PI / 4)
            {
                spacing  = _V_.X_REINFORCEMENT_SIDE_D_SPACING;
                distance = _V_.X_REINFORCEMENT_SIDE_D_ANCHOR_LENGTH;
                parand   = _V_.X_REINFORCEMENT_SIDE_D_FIX;
            }
            else
            {
                spacing  = _V_.X_REINFORCEMENT_TOP_D_SPACING;
                distance = _V_.X_REINFORCEMENT_TOP_D_ANCHOR_LENGTH;
                parand   = _V_.X_REINFORCEMENT_TOP_D_FIX;
            }

            double nearEdge    = _V_.X_CONCRETE_COVER_1 * 2.5;
            double equalSpacer = ((ln.Length() - 2 * nearEdge) % spacing) / 2;

            double j   = nearEdge + equalSpacer;
            double len = ln.Length();

            if ((len - nearEdge * 2) > spacing)
            {
                R.Raud_Array rauad = new R.Raud_Array(spacing);
                knownArrayReinforcement.Add(rauad);

                while (j < len)
                {
                    G.Point start = offsetLine.Start.move(j, d1);
                    G.Point end   = start.move(distance, o1);

                    D_side_handler(start, end, parand); // parand magic
                    j = j + spacing;
                }

                D_side_garbage_collector();
            }
        }
コード例 #3
0
        //definer
        private bool D_side_handler(G.Point start, G.Point end, int parand)
        {
            G.Line side = new G.Line(start, end);

            if (denier(side))
            {
                return(false);
            }

            //reinf_geometry_debug.Add(side);

            G.Vector o1   = side.getDirectionVector();
            double   absX = Math.Abs(o1.X);
            double   absY = Math.Abs(o1.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            R.D_Raud cur;
            if (p.angle < Math.PI / 4)
            {
                if (_V_.X_REINFORCEMENT_SIDE_D_CREATE == 1)
                {
                    cur = new R.D_Raud(side, _V_.Y_ELEMENT_WIDTH_COVER + parand, 1, _V_.X_REINFORCEMENT_SIDE_D_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (_V_.X_REINFORCEMENT_TOP_D_CREATE == 1)
                {
                    cur = new R.D_Raud(side, _V_.Y_ELEMENT_WIDTH_COVER + parand, 1, _V_.X_REINFORCEMENT_TOP_D_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                }
                else
                {
                    return(false);
                }
            }

            int currentIndex = knownArrayReinforcement.Count - 1;

            knownArrayReinforcement[currentIndex].add_one(cur);
            keep_array(cur, null);

            return(true);
        }
コード例 #4
0
ファイル: E_Raud.cs プロジェクト: 15831944/habile
        public E_Raud(G.Line main, G.Line side1, G.Line side2, int nr, int d, string teras, int parand = 0) : base(main, nr, d, teras)
        {
            G.Vector mainDir = main.getDirectionVector();
            G.Polar  mainPol = G.Converter.xy_to_la(mainDir);

            G.Vector sideDir1 = side1.getDirectionVector();
            G.Polar  sidePol1 = G.Converter.xy_to_la(sideDir1);

            G.Vector sideDir2 = side2.getDirectionVector();
            G.Polar  sidePol2 = G.Converter.xy_to_la(sideDir2);

            _A  = shorter(side1.Length());
            _B  = shorter(main.Length());
            _B2 = shorter(main.Length() + parand); // parand magic
            _C  = shorter(side2.Length());

            G.Vector perpendVector = mainDir.rotate(-Math.PI / 2);
            double   maxDist       = Math.Max(_A, _C) * 2;

            G.Line mainExtended = main.extendDouble(maxDist);

            G.Point movePoint1   = side1.Start.move(maxDist, perpendVector);
            G.Line  perpendLine1 = new G.Line(side1.Start, movePoint1);
            G.Point interPoint1  = G.Line.getIntersectionPoint(mainExtended, perpendLine1);
            G.Line  XLine        = new G.Line(side1.Start, interPoint1);

            G.Point movePoint2   = side2.End.move(maxDist, perpendVector);
            G.Line  perpendLine2 = new G.Line(side2.End, movePoint2);
            G.Point interPoint2  = G.Line.getIntersectionPoint(mainExtended, perpendLine2);
            G.Line  YLine        = new G.Line(side2.End, interPoint2);

            _U = G.Converter.AngleDelta(mainPol.angle, sidePol1.angle);
            _V = G.Converter.AngleDelta(mainPol.angle, sidePol2.angle);
            _X = XLine.Length();
            _Y = YLine.Length();

            _IP     = main.getCenterPoint();
            _Length = _A + _B2 + _C; // parand magic

            G.Vector v1 = -1 * side1.getDirectionVector();
            _Side1Point = _StartPoint.move(_A, v1);

            G.Vector v2 = side2.getDirectionVector();
            _Side2Point = _EndPoint.move(_C, v2);
        }
コード例 #5
0
ファイル: Raud.cs プロジェクト: 15831944/habile
        public Raud(G.Line main, int nr, int d, string teras)
        {
            G.Vector dir = main.getDirectionVector();
            G.Polar  pol = G.Converter.xy_to_la(dir);

            _Rotation = G.Converter.Wrap(pol.angle, Math.PI * 2, 0.0);

            _Number   = nr;
            _Diameter = d;
            _Materjal = teras;

            double shorterLength  = shorter(main.Length());
            double originalLength = main.Length();
            double delta          = (originalLength - shorterLength) / 2;

            _StartPoint = main.Start.move(delta, dir);
            _EndPoint   = _StartPoint.move(shorterLength, dir);
        }
コード例 #6
0
        private bool isLineRight(G.Line ln)
        {
            G.Vector v = ln.getDirectionVector();

            double absX = Math.Abs(v.X);
            double absY = Math.Abs(v.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            double remain = p.angle % (Math.PI / 4);

            if (remain < 0.1)
            {
                return(true);
            }

            return(false);
        }
コード例 #7
0
ファイル: Geometry.cs プロジェクト: kjinks/SVGWrapper
 //constructor - overloaded
 //Polar(Polar polar)
 //Assigns paramaters to appropriate class attributes
 public Polar(Polar polar)
 {
     this.angle  = polar.angle;
     this.radius = polar.radius;
 }
コード例 #8
0
ファイル: Geometry_Test.cs プロジェクト: kjinks/SVGWrapper
        //static void TestLine()
        //Tests every method and accessor of the Line() class using the precribed
        //float testData[]; marked down below down below.
        public static void TestLine()
        {
            //TEST DATA----------------!
            float[] testData = new float[] { -2.0f, (float)Math.Sqrt(2.0), 1.0f, 0.333f, -0.0f, 22.0f, 1000.0001f, };

            Console.WriteLine("\nTesting Line class...\n");

            float  angleStep = (float)Math.PI / testData.Count();

            int     numLines = testData.Count();

            Line[] lines = new Line[numLines];

            for (int t = 0; t < testData.Count(); t++)
            {
                Console.WriteLine("\nTest {0}\n", t + 1);

                int indexA = (t * 2) % testData.Count();
                int indexB = ((t * 2) + 1) % testData.Count();
                int indexC = ((t * 2) + 2) % testData.Count();
                int indexD = ((t * 2) + 3) % testData.Count();

                float valueA = testData[indexA];
                float valueB = testData[indexB];
                float valueC = testData[indexC];
                float valueD = testData[indexD];

                //Line paraA = lines[indexA] + lines[indexD];

                Point p1 = new Point(valueA, valueB);
                Point p2 = new Point(valueC, valueD);

                Line l = new Line(p1, p2);

                lines[t] = l;

                Console.WriteLine("Testing with values {0}, {1}, {2}", valueA, valueB, valueC);
                Console.WriteLine("ToString() : " + l.ToString());
                Console.WriteLine("Length     : {0}", l.Length);
                Console.WriteLine("Midpoint   : {0}", l.Midpoint);
                Console.WriteLine("Delta      : {0}", l.Delta);

                float angle = angleStep * t;

                Polar polar = new Polar(angle, 10.0f);

                l.Polar = new Polar(angle, 10.0f);

                Console.WriteLine("SetPolar   : Angle:{0}, Radius:{1} -> Result: {2}", polar.angle, polar.radius, l);

                polar = l.Polar;

                Console.WriteLine("GetPolar   : Angle:{0}, Radius:{1}", polar.angle, polar.radius);
            }

            Console.WriteLine("\nTesting IsParallel method...\n");

            for (int l = 0; l < lines.Count(); l++)
            {
                Console.WriteLine("Is ({0}) parallel with ({1}) ?", lines[0], lines[l]);

                if (lines[0].IsParallel(lines[l]))
                {
                    Console.WriteLine("They are parallel.");
                }
                else
                {
                    Console.WriteLine("They are not parallel.");
                }
            }

            Console.WriteLine("\nTesting ToPoints method...\n");

            Point[] points = Line.ToPoints(lines);

            Console.WriteLine("Lines:");

            for (int l = 0; l < lines.Count(); l++)
            {
                Console.Write(lines[l].ToString() + " | ");
            }

            Console.WriteLine("\nPoints:");

            for (int p = 0; p < points.Count(); p++)
            {
                Console.Write(points[p].ToString() + " | ");
            }
        }
コード例 #9
0
ファイル: Geometry_Test.cs プロジェクト: kjinks/SVGWrapper
        //static void TestPoint())
        //Tests every method and accessor of the Point() class using the precribed
        //float testData[]; marked down below down below.
        public static void TestPoint()
        {
            //TEST DATA----------------!
            float[] testData = new float[] { -2.0f, (float)Math.Sqrt(2.0), 0.0f, 1.0f, 22.0f };

            Console.WriteLine("\nTesting Point class...\n");

            float angleStep = (float)Math.PI / testData.Count();

            for (int t = 0; t < testData.Count(); t++)
            {
                Console.WriteLine("\nTest {0}\n", t + 1);

                int indexA = (t * 2) % testData.Count();
                int indexB = ((t * 2) + 1) % testData.Count();
                int indexC = ((t * 2) + 2) % testData.Count();

                float valueA = testData[indexA];
                float valueB = testData[indexB];
                float valueC = testData[indexC];

                Point p1 = new Point(valueA, valueB);
                Point p2 = new Point(valueB, valueC);

                Console.WriteLine("Testing with values {0}, {1}, {2}", valueA, valueB, valueC);
                Console.WriteLine("ToString() : " + p1.ToString());
                Console.WriteLine("{0} + {1} = {2}", p1, p2, p1 + p2);
                Console.WriteLine("{0} - {1} = {2}", p1, p2, p1 - p2);
                Console.WriteLine("{0} / {1} = {2}", p1, 2.0f, p1 / 2.0f);
                Console.WriteLine("{0} * {1} = {2}", p1, 2.0f, p1 * 2.0f);

                Polar polar = new Polar(angleStep * t, 10.0f);
                p1.Polar = polar;

                Console.WriteLine("Testing SetPolar with angle = {0}, radius = {1}", polar.angle, polar.radius);
                Console.WriteLine("Result of SetPolar : " + p1.ToString());

                polar = p1.Polar;
                Console.WriteLine("Return of GetPolar : Angle:{0}, Radius:{1} ", polar.angle, polar.radius);
            }
        }