Ejemplo n.º 1
0
        public ActionResult UpdatePoint(PointTO point)
        {
            //Get Cube
            IGCube cube = GeometryFactory.GetCube();

            return(Json(new { success = cube.Update(point) }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult Create(int dimensions)
        {
            //Get Cube
            IGCube cube = GeometryFactory.GetCube();

            return(Json(new { success = cube.Create(dimensions) }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult GetDimensions()
        {
            //Get Cube
            IGCube cube = GeometryFactory.GetCube();

            return(Json(cube.GetDimensions(), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public ActionResult SumRegion(int x1, int y1, int z1, int x2, int y2, int z2)
        {
            //Get Cube
            IGCube cube = GeometryFactory.GetCube();

            PointTO point1 = new PointTO()
            {
                X = x1, Y = y1, Z = z1
            };
            PointTO point2 = new PointTO()
            {
                X = x2, Y = y2, Z = z2
            };

            return(Json(new { sum = cube.SumRegion(point1, point2) }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public void Cube_CreateUpdateAndSumException()
        {
            IGCube cube = Geometry.GeometryFactory.GetCube();

            cube.Create(2);
            cube.Update(new RappiChallenge.TO.PointTO()
            {
                X = 1, Y = 5, Z = 1, Value = 15
            });

            Assert.AreEqual(
                cube.SumRegion(
                    new RappiChallenge.TO.PointTO()
            {
                X = 1, Y = 1, Z = 1
            },
                    new RappiChallenge.TO.PointTO()
            {
                X = 2, Y = 2, Z = 2
            })
                , Convert.ToDouble(10));
        }