コード例 #1
0
        public void CalculateParallelCubeIntersectionFigureTest(double x1, double y1, double z1, double edge1,
                                                                double x2, double y2, double z2, double edge2,
                                                                double rwidth, double rlength, double rdepth)
        {
            // En los parámetros no se puede poner el sufijo m de decimal
            decimal cx1, cy1, cz1, ce1, cx2, cy2, cz2, ce2;

            FromDoubleToDecimal(x1, y1, z1, edge1, x2, y2, z2, edge2, out cx1, out cy1, out cz1, out ce1, out cx2, out cy2, out cz2, out ce2);

            var width  = (decimal)rwidth;
            var length = (decimal)rlength;
            var depth  = (decimal)rdepth;

            IIntersectionCalculator intersectionCalculator = new IntersectionCalculator();
            Cube firstCube = CubeBuilder.CreateCube()
                             .CenteredAt(cx1, cy1, cz1)
                             .WithEdgeLength(ce1)
                             .Build();

            Cube secondCube = CubeBuilder.CreateCube()
                              .CenteredAt(cx2, cy2, cz2)
                              .WithEdgeLength(ce2)
                              .Build();

            Ortoedro result = intersectionCalculator.CalculateParallelCubeIntersectionFigure(firstCube, secondCube);

            Assert.IsTrue(result.Width == width && result.Length == length && result.Depth == depth, "The resultant ortoedro dimensions are not the expected.");
        }
コード例 #2
0
 public Asiento(Point3D pst, double lar, double anc, double alt, float[] col)
 {
     this.start = pst;
     largo      = lar;
     ancho      = anc;
     alto       = alt;
     color      = col;
     abaj       = new Ortoedro(new Point3D(pst.x, pst.y - alt / 2 + alt / 3.0, pst.z + lar), anc, lar, alt / 6.0, col);
     this.Recompile();
 }
コード例 #3
0
 public Asiento(Point3D pst,double lar,double anc,double alt,float[] col)
 {
     this.start=pst;
     largo=lar;
     ancho=anc;
     alto=alt;
     color=col;
     abaj=new Ortoedro(new Point3D(pst.x,pst.y-alt/2+alt/3.0,pst.z+lar),anc,lar,alt/6.0,col);
     this.Recompile();
 }
コード例 #4
0
 public LimpParab(Point3D pst, double lar)
 {
     start = pst;
     p     = new Ortoedro[4];
     largo = lar;
     p[0]  = new Ortoedro(pst, lar, lar / 20.0, lar / 20.0, new float[] { 0.9f, 0.6f, 0.6f });
     p[1]  = new Ortoedro(new Point3D(pst.x + lar, pst.y, pst.z), lar / 6.0, lar / 30.0, lar / 30.0, new float[] { 0.9f, 0.6f, 0.6f });
     p[2]  = new Ortoedro(new Point3D(pst.x + lar, pst.y, pst.z), lar / 6.0, lar / 30.0, lar / 30.0, new float[] { 0.9f, 0.6f, 0.6f });
     p[3]  = new Ortoedro(new Point3D(pst.x + 8 * lar / 10.0, pst.y, pst.z - Math.Sqrt(lar / 60)), lar, lar / 20.0, lar / 20.0, new float[] { 0.6f, 0.6f, 0.6f });
     this.Recompile();
 }
コード例 #5
0
 public LimpParab(Point3D pst,double lar)
 {
     start=pst;
     p=new Ortoedro[4];
     largo=lar;
     p[0]=new Ortoedro(pst,lar,lar/20.0,lar/20.0,new float[]{0.9f,0.6f,0.6f});
     p[1]=new Ortoedro(new Point3D(pst.x+lar,pst.y,pst.z),lar/6.0,lar/30.0,lar/30.0,new float[]{0.9f,0.6f,0.6f});
     p[2]=new Ortoedro(new Point3D(pst.x+lar,pst.y,pst.z),lar/6.0,lar/30.0,lar/30.0,new float[]{0.9f,0.6f,0.6f});
     p[3]=new Ortoedro(new Point3D(pst.x+8*lar/10.0,pst.y,pst.z-Math.Sqrt(lar/60)),lar,lar/20.0,lar/20.0,new float[]{0.6f,0.6f,0.6f});
     this.Recompile();
 }
コード例 #6
0
        public void OrtoedroVolumeTest(double width, double length, double depth)
        {
            var decimalWidth  = (decimal)width;
            var decimalLength = (decimal)length;
            var decimalDepth  = (decimal)depth;

            IVolumeCalculator volumeCalculator = new VolumeCalculator();
            Ortoedro          ortoedro         = new Ortoedro()
            {
                Width  = decimalWidth,
                Length = decimalLength,
                Depth  = decimalDepth
            };

            decimal volume = volumeCalculator.CalculateOrtoedroVolume(ortoedro);

            Assert.IsTrue(volume == decimalWidth * decimalLength * decimalDepth, $"Expected volume 8 but received {volume}.");
        }
コード例 #7
0
    public Silla(Point3D pcom,double larmesp,double lasi,double lpat,float[] colmad,float[] coltap)
    {
        patas=new Ortoedro[4];
            double apat=lpat/30.0;

            for(int i=0;i<patas.Length;i++)
            {
                patas[i]=new Ortoedro(new Point3D(pcom.x+(lasi/8.0)+((int)(i/2))*lasi*6/8,pcom.y-larmesp,pcom.z-((int)(i%2))*lasi*6/8.0-lasi/8.0),2*apat,apat,lpat,colmad);
            }
            madesp=new Ortoedro[2];
            double anchmesp=larmesp/25.0;

            for(int i=0;i<madesp.Length;i++)
            {
            madesp[i]=new Ortoedro(new Point3D(pcom.x,pcom.y,pcom.z-((i%2)*(lasi-anchmesp))),3*anchmesp,anchmesp,larmesp,colmad);
            }

            double aasi=lasi/12.0;
            asient=new Ortoedro(new Point3D(pcom.x,pcom.y-larmesp+aasi,pcom.z),lasi,lasi,aasi,coltap);

            this.Recompile();
    }
コード例 #8
0
    public Silla(Point3D pcom, double larmesp, double lasi, double lpat, float[] colmad, float[] coltap)
    {
        patas = new Ortoedro[4];
        double apat = lpat / 30.0;

        for (int i = 0; i < patas.Length; i++)
        {
            patas[i] = new Ortoedro(new Point3D(pcom.x + (lasi / 8.0) + ((int)(i / 2)) * lasi * 6 / 8, pcom.y - larmesp, pcom.z - ((int)(i % 2)) * lasi * 6 / 8.0 - lasi / 8.0), 2 * apat, apat, lpat, colmad);
        }
        madesp = new Ortoedro[2];
        double anchmesp = larmesp / 25.0;

        for (int i = 0; i < madesp.Length; i++)
        {
            madesp[i] = new Ortoedro(new Point3D(pcom.x, pcom.y, pcom.z - ((i % 2) * (lasi - anchmesp))), 3 * anchmesp, anchmesp, larmesp, colmad);
        }

        double aasi = lasi / 12.0;

        asient = new Ortoedro(new Point3D(pcom.x, pcom.y - larmesp + aasi, pcom.z), lasi, lasi, aasi, coltap);

        this.Recompile();
    }
コード例 #9
0
 public decimal CalculateOrtoedroVolume(Ortoedro ortoedro)
 {
     return(ortoedro.Width * ortoedro.Length * ortoedro.Depth);
 }
コード例 #10
0
 public decimal NoVolume(Ortoedro ortoedro)
 {
     return(0m);
 }