示例#1
0
        public void Difference_BoundsYieldsBoundsOfFirstChild()
        {
            var sphere = new Sphere().Translate(.25, .25, 1);
            var diff = sphere.Difference(new Cube());

            Assert.AreEqual(sphere.Bounds(), diff.Bounds());
        }
示例#2
0
        public static void makepaddleHandle()
        {
            double holeSize = Inches.One + Inches.Eigth;
            double holeHeight = Inches.One;
            double shaftSize = holeSize + Inches.Quarter;
            double totalLength = Inches.One * 8;
            double totalWidth = Inches.One * 5;

            var blade = new Sphere() { Resolution = 80 }.Resize(totalLength, totalWidth, Inches.One * 2);
            var copy = blade.Clone().Translate(0, 0, -Inches.One).Scale(1.4, 1.4, 1.1);
            blade = blade - copy;

            //var gap = new Cube(Inches.One, Inches.One * 8, Inches.One*8, true).Translate(blade.Bounds().XMin, 0, 0);
            //blade = blade - gap;

            OSCADObject shaft = new Cylinder(shaftSize, totalLength / 4, true) { Resolution = 80 }.Rotate(0, 90, 0);
            var hole = new Cylinder(holeSize, holeHeight * 2, true) { Resolution = 80 }.Rotate(0, 90, 0).Translate(shaft.Bounds().XMin, 0, 0);
            blade = blade - hole.Translate(blade.Bounds().XMin + Inches.Half, 0, +Inches.Quarter);
            shaft = shaft - hole;
            shaft = shaft.Translate(blade.Bounds().XMin + Inches.Half, 0, +Inches.Quarter);

            var top = new Cylinder(shaftSize, Inches.One * 3, true) { Resolution = 80 }.Rotate(90, 0, 0).Translate(shaft.Bounds().XMax, 0, shaft.Bounds().ZMax - shaftSize/2);
            var gapCloserLeft = new Sphere(shaftSize) { Resolution = 80 }.Translate(top.Bounds().XMax - shaftSize/2, top.Bounds().YMax, +Inches.Quarter);
            var gapCloserRight = gapCloserLeft.Mirror(0, 1, 0);

            var whole = shaft + top + gapCloserLeft + gapCloserRight;
            whole.ToFile("paddleHandle").Open();
        }
示例#3
0
        public void Sphere_BoundsAreInExpectedPositionCentered()
        {
            var obj = new Sphere(30);

            Assert.AreEqual(new Vector3(15, 15, 15), obj.Bounds().TopRight);
            Assert.AreEqual(new Vector3(-15, -15, -15), obj.Bounds().BottomLeft);
        }
示例#4
0
        public void Intersection_BoundsThrowsNotSupportedException()
        {
            var obj = new Sphere().Intersection(new Text3D("Sup"));

            var pos = obj.Bounds();
        }