Exemple #1
0
        public Torus(float a_arg, float b_arg)
        {
            _a = a_arg;
            _b = b_arg;

            _boundingBox = new BoundingBox(-_a - _b, _a + _b, -_b, _b, -_a - _b, _a + _b);
        }
Exemple #2
0
        public Torus()
        {
            _a = 2.0f;
            _b = 1.0f;

            _boundingBox = new BoundingBox(-_a - _b, _a + _b, -_b, _b, -_a - _b, _a + _b);
        }
 public ImplicitHeart()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-1.5f);
     highBound = new Vector3(1.5f);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 4.0f;
     distanceMultiplier = 0.1f;
 }
 public ImplicitWineGlass()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-3.0f);
     highBound = new Vector3(3.0f);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 9.0f;
     distanceMultiplier = 0.3f;
     triggerDistance = 0.1f;
 }
 public ImplicitBarthSextic()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-3.5f);
     highBound = new Vector3(3.5f);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 10.0f;
     distanceMultiplier = 0.4f;
     triggerDistance = 0.01f;
 }
        protected float triggerDistance; //Distance at which a hit is registered

        #endregion Fields

        #region Constructors

        public RayMarchedImplicit()
        {
            boundingBox = new BoundingBox();
            lowBound = new Vector3(-4);
            highBound = new Vector3(4);
            minimumRaymarchStep = 1.0e-5f;
            maximumRaymarchStep = 4.0f;
            distanceMultiplier = 0.1f;
            triggerDistance = 0.1f;
        }
 public ImplicitDecocube()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-1.5f);
     highBound = new Vector3(1.5f);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 3.0f;
     distanceMultiplier = 0.1f;
     triggerDistance = 0.01f;
     r = 0.01f;
 }
 public ImplicitCloth()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-30,-8,-30);
     highBound = new Vector3(30, 8, 30);
     minimumRaymarchStep = 1.0e-4f;
     maximumRaymarchStep = 10.0f;
     distanceMultiplier = 0.1f;
     triggerDistance = 0.1f;
     w = (float)Math.PI;
     RECURSIONDEPTH = 15;
 }
 public ImplicitSphere()
 {
     r = 1.0f;
     disp = new Vector3(0, 0, 0);
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-2*r);
     highBound = new Vector3(2*r);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 5.0f;
     distanceMultiplier = 0.3f;
     triggerDistance = 0.1f;
 }
 public WeightedAverageImplicit()
 {
     boundingBox = new BoundingBox();
     lowBound = new Vector3(-2.5f);
     highBound = new Vector3(2.5f);
     minimumRaymarchStep = 1.0e-5f;
     maximumRaymarchStep = 4.0f;
     distanceMultiplier = 0.1f;
     triggerDistance = 0.1f;
     parameter0 = 1.0f;
     parameter1 = 0.0f;
     _implicit0 = new ImplicitSphere();
     _implicit1 = new ImplicitDecocube();
 }
Exemple #11
0
        /*
        public override Material getMaterial()
        {
            if (_material == null)
            {
                return payload.getMaterial();
            }
            else
            {
                return _material;
            }
        }

        public override BoundingBox get_bounding_box()
        {
            compute_bounding_box();
            return bbox;
        }
        */
        public void ComputeBoundingBox()
        {
            //Get the bounding box of the payload prior to transformation.
            BoundingBox preTransform = payload.BoundingBox;
            float x0 = preTransform.corner0.X;
            float x1 = preTransform.corner1.X;
            float y0 = preTransform.corner0.Y;
            float y1 = preTransform.corner1.Y;
            float z0 = preTransform.corner0.Z;
            float z1 = preTransform.corner1.Z;

            //Get points representing all 8 corners of the bounding box
            Point3D[] points = new Point3D[8];
            points[0] = new Point3D(x0, y0, z0);
            points[1] = new Point3D(x0, y1, z0);
            points[2] = new Point3D(x0, y0, z1);
            points[3] = new Point3D(x0, y1, z1);
            points[4] = new Point3D(x1, y0, z0);
            points[5] = new Point3D(x1, y1, z0);
            points[6] = new Point3D(x1, y0, z1);
            points[7] = new Point3D(x1, y1, z1);

            //Transform all corner points
            for(int i = 0; i < 8; i++)
            {
                points[i] = netTransformationMatrix * points[i];
            }

            float xmin = GlobalVars.K_HUGE_VALUE;
            float xmax = -GlobalVars.K_HUGE_VALUE;
            float ymin = GlobalVars.K_HUGE_VALUE;
            float ymax = -GlobalVars.K_HUGE_VALUE;
            float zmin = GlobalVars.K_HUGE_VALUE;
            float zmax = -GlobalVars.K_HUGE_VALUE;

            //Find xmin, xmax, ymin, ymax, and zmin, zmax
            for(int i = 0; i < 8; i++)
            {
                if (points[i].X < xmin) xmin = points[i].X;
                if (points[i].X > xmax) xmax = points[i].X;
                if (points[i].Y < ymin) ymin = points[i].Y;
                if (points[i].Y > ymax) ymax = points[i].Y;
                if (points[i].Z < zmin) zmin = points[i].Z;
                if (points[i].Z > zmax) zmax = points[i].Z;
            }

            //Create bounding box based on transformed payload bounding box
            boundingBox = new BoundingBox(xmin, xmax, ymin, ymax, zmin, zmax);
        }
Exemple #12
0
 //Constructors
 public UniformGrid()
     : base()
 {
     //cells = new List<RenderableObject>();
     _boundingBox = new BoundingBox();
 }