예제 #1
0
        public TerrainBlock(float porosity, float tl, float tr, float bl, float br, int i, int j, float scale)
        {
            type = (Math.Abs(tl - tr) < Math.Abs(tr - bl)) ? Diagonal.tlbr : Diagonal.trbl;

            this.I = i;
            this.J = j;

            if (type == Diagonal.tlbr)
            {
                top    = new TerrainTriangle(tr, tl, br, Triangle.tr, I, J, scale);
                bottom = new TerrainTriangle(tl, bl, br, Triangle.bl, I, J, scale);

                bl_helper = bottom.normal;
                br_helper = bottom.normal + top.normal;
                tl_helper = br_helper;
                tr_helper = top.normal;
            }
            else
            {
                top    = new TerrainTriangle(tr, tl, bl, Triangle.tl, I, J, scale);
                bottom = new TerrainTriangle(tr, bl, br, Triangle.br, I, J, scale);

                br_helper = bottom.normal;
                bl_helper = bottom.normal + top.normal;
                tr_helper = bl_helper;
                tl_helper = top.normal;
            }
        }
예제 #2
0
        public TerrainBlock(float porosity, float tl, float tr, float bl, float br, int i, int j, float scale)
        {
            type = (Math.Abs(tl - tr) < Math.Abs(tr - bl)) ? Diagonal.tlbr : Diagonal.trbl ;

            this.I = i;
            this.J = j;

            if (type == Diagonal.tlbr) {
                top = new TerrainTriangle(tr, tl, br, Triangle.tr, I, J, scale);
                bottom = new TerrainTriangle(tl, bl, br, Triangle.bl, I, J, scale);

                bl_helper = bottom.normal;
                br_helper = bottom.normal + top.normal;
                tl_helper = br_helper;
                tr_helper = top.normal;
            }
            else {
                top = new TerrainTriangle(tr, tl, bl, Triangle.tl , I, J, scale);
                bottom = new TerrainTriangle(tr, bl, br, Triangle.br ,I, J, scale);

                br_helper = bottom.normal;
                bl_helper = bottom.normal + top.normal;
                tr_helper = bl_helper;
                tl_helper = top.normal;
            }
        }