public void SetArcInternalAngleBothPositiveTest()
        {
            var sketchCreator = new SketchCreator(_document, false);
            var sketchNode = sketchCreator.BuildSketchNode();
            _document.Transact();

            // s >0, e > 0, s > e
            var arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(0.535898, 2, 0),
                                           new Point3D(7.464101, 2, 0));
            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 240) < 0.00001, "Incorrect internal angle");
            var endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 300);

            Assert.IsTrue(Math.Abs(endPoint.X - 4) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y - 4) < 0.00001);

            arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(0.535898, 2, 0),
                                           new Point3D(7.464101, 2, 0));
            
            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 240) < 0.00001, "Incorrect internal angle");
            endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 180);

            Assert.IsTrue(Math.Abs(endPoint.X - 7.464101) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y + 2) < 0.00001);

            arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(4, 4, 0),
                                          new Point3D(7.464101, 2, 0));

            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 300) < 0.00001, "Incorrect internal angle");
            endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 60);

            Assert.IsTrue(Math.Abs(endPoint.X - 0.535898) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y - 2) < 0.00001);

            // s >0, e > 0, s < e

            arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(7.464101, 2, 0), new Point3D(0.535898, 2, 0));

            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 120) < 0.00001, "Incorrect internal angle");
            endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 60);

            Assert.IsTrue(Math.Abs(endPoint.X - 4) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y - 4) < 0.00001);

            arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(7.464101, 2, 0), new Point3D(0.535898, 2, 0));

            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 120) < 0.00001, "Incorrect internal angle");
            endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 180);

            Assert.IsTrue(Math.Abs(endPoint.X - 0.535898) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y + 2) < 0.00001);

            arcBuilder = TestUtils.Arc(_document, sketchNode, new Point3D(4, 0, 0), new Point3D(4, 4, 0), new Point3D(0.535898, 2, 0));

            Assert.IsTrue(Math.Abs(NodeBuilderUtils.GetInternalAngle(arcBuilder) - 60) < 0.00001, "Incorrect internal angle");
            endPoint = NodeBuilderUtils.SetInternalAngle(arcBuilder, 300);

            Assert.IsTrue(Math.Abs(endPoint.X - 7.464101) < 0.00001);
            Assert.IsTrue(Math.Abs(endPoint.Y - 2) < 0.00001);
        }
Ejemplo n.º 2
0
        private void SetInternalAngleValue(object data)
        {
            if (Builder.Node.Children.Count == 0)
                return;
            BeginUpdate();
            var angle = (double)data;

            Builder[2].RefTransformedPoint3D = NodeBuilderUtils.SetInternalAngle(Builder, angle);
            EndVisualUpdate("");
        }