Ejemplo n.º 1
0
        // misura di quanto si sovrappongono i volumi
        public override float[] GetOverlaps(VolumeSubdivision that)
        {
            int i;
            float[] delta_over = new float[3];

            for(i = 0; i < 3; i++) {
                //differenza tra il massimo dei minimi - il minimo dei massimi
                delta_over[i] = (this.bounds[i] > that.bounds[i] ? this.bounds[i] : that.bounds[i]) -
                                (this.bounds[i + 3] < that.bounds[i + 3] ? this.bounds[i + 3] : that.bounds[i + 3]);
            }
            return delta_over;
        }
Ejemplo n.º 2
0
        public override bool OverlapTo(VolumeSubdivision that)
        {
            // sempre per l'AABB
            //Console.WriteLine("Debug\nX min di questo ogg: " + this.bounds[0] + "\nX max dell'altro ogg: " + that.bounds[3]);
            if(this.bounds[2] > that.bounds[5]) return false;
            if(that.bounds[2] > this.bounds[5]) return false;

            if(this.bounds[1] > that.bounds[4]) return false;
            if(that.bounds[1] > this.bounds[4]) return false;

            if(this.bounds[0] > that.bounds[3]) return false;
            if(that.bounds[0] > this.bounds[3]) return false;

            return true;
        }
Ejemplo n.º 3
0
 public virtual float[] GetOverlaps(VolumeSubdivision that)
 {
     return null;
 }
Ejemplo n.º 4
0
 public virtual bool OverlapTo(VolumeSubdivision that)
 {
     return false;
 }
Ejemplo n.º 5
0
 public override bool OverlapTo(VolumeSubdivision that)
 {
     if(distance(this.center, that.center) > (2.0f * this.radius)) return false;
     return true;
 }
Ejemplo n.º 6
0
        // misura di quanto si sovrappongono i volumi
        public override float[] GetOverlaps(VolumeSubdivision that)
        {
            int i;
            float[] delta_over = new float[3];
            for(i = 0; i < 3; i++) {
                delta_over[i] = this.center[i] - that.center[i];
                if(Math.Abs(delta_over[i])>2*radius) {
                    delta_over[i] = 0.0f;
                } else {
                    delta_over[i] -= radius * 2.0f;
                    delta_over[i] *= Math.Abs(delta_over[i]);
                }
            }

            return delta_over;
        }
Ejemplo n.º 7
0
 public void Add(VolumeSubdivision vs)
 {
     v.Add(vs);
 }
Ejemplo n.º 8
0
 public virtual void RefreshDop(VolumeSubdivision vs)
 {
 }
Ejemplo n.º 9
0
        public override void RefreshDop(VolumeSubdivision dop)
        {
            float[] center = new float[3];
            int[] indexesInThisDop = (int[])dop.vertIndex.ToArray(typeof(int));
            float[] coords;
            int i, ix, iy;
            int n = dop.vertIndex.Count;
            /*
            // per la sfera
            // ridefinizione del centro del dop;
            for(i = 0; i < n; i++) {
                ix = (int)dop.vertIndex[i] % nodesx;
                iy = (int)dop.vertIndex[i] / nodesx;
                coords = pw.GetVertexCoords(ix, iy);
                center[0] += coords[0];
                center[1] += coords[1];
                center[2] += coords[2];
            }
            //
            center[0] /= n;
            center[1] /= n;
            center[2] /= n;
            dop.RefreshCenter(center);
            */
            // per il box

            dop.RestartBounds();
            for(i = 0; i < n; i++) {
                ix = (int)dop.vertIndex[i] % nodesx;
                iy = (int)dop.vertIndex[i] / nodesx;
                coords = pw.GetVertexCoords(ix, iy);
                dop.RefreshVertex(coords);
            }
        }