Esempio n. 1
0
 public Box(Vector3 min, Vector3 max, string name)
     : base(name)
 {
     Min = min;
     Max = max;
     bbox = GetBoundingBox();
 }
Esempio n. 2
0
 public Torus(float _a, float _b, string name)
     : base(name)
 {
     aa = _a;
     bb = _b;
     bbox = new BBox(-_a - _b, _a + _b, -_b, _b, -_a - _b, _a + _b);
 }
Esempio n. 3
0
 public override void SetBoundingBox()
 {
     float delta = 0.000001f;
     bbox = (new BBox(MathHelper.Min(MathHelper.Min(v0.X, v1.X), v2.X) - delta, MathHelper.Max(MathHelper.Max(v0.X, v1.X), v2.X) + delta,
                  MathHelper.Min(MathHelper.Min(v0.Y, v1.Y), v2.Y) - delta, MathHelper.Max(MathHelper.Max(v0.Y, v1.Y), v2.Y) + delta,
                  MathHelper.Min(MathHelper.Min(v0.Z, v1.Z), v2.Z) - delta, MathHelper.Max(MathHelper.Max(v0.Z, v1.Z), v2.Z) + delta));
 }
Esempio n. 4
0
 public Annulus(Vector3 cen, Vector3 norm, float i, float w, string name)
     : base(name)
 {
     center = cen;
     normal = norm;
     inner_radius = i;
     wall_thickness = w;
     bbox = new BBox(center.X - i - w, center.X + i + w, center.Y - MathHelper.Epsilon, center.Y + MathHelper.Epsilon, center.Z - i - w, center.Z + i + w);
     i_squared = i * i;
     w_squared = (i + w) * (i + w);
 }
Esempio n. 5
0
 public SolidCone(float r, float h, string name)
     : base(name)
 {
     Objects.Add(new OpenCone(r, h, name + "OpenCone"));
     Objects.Add(new Disk(new Vector3(0, 0, 0), Vector3.Down, r, name + "Disk"));
     bbox = new BBox();
     bbox.Min.X = -r;
     bbox.Min.Y = 0;
     bbox.Min.Z = -r;
     bbox.Max.X = r;
     bbox.Max.Y = h;
     bbox.Max.Z = r;
 }
Esempio n. 6
0
 public PartAnnulus(Vector3 pos, Vector3 nor, float i_radius, float w_thickness, float m_azimuth, float mx_azimuth, string name)
     : base(name)
 {
     center = pos;
     normal = nor;
     inner_radius = i_radius;
     wall_thickness = w_thickness;
     min_azimuth = MathHelper.ToDegrees(m_azimuth);
     max_azimuth = MathHelper.ToDegrees(mx_azimuth);
     bbox = new BBox(center.X - inner_radius - wall_thickness, center.X + inner_radius + wall_thickness, center.Y - MathHelper.Epsilon, center.Y + MathHelper.Epsilon, center.Z - inner_radius - wall_thickness, center.Z + inner_radius + wall_thickness);
     i_squared = inner_radius * inner_radius;
     w_squared = (inner_radius + wall_thickness) * (inner_radius + wall_thickness);
 }
Esempio n. 7
0
 void createIndices()
 {
     for (int x = 0; x < w - 1; x++)
         for (int z = 0; z < h - 1; z++)
         {
             int upperLeft = (z * w + x);
             int upperRight = (upperLeft + 1);
             int lowerLeft = (upperLeft + w);
             int lowerRight = (lowerLeft + 1);
             FlatMeshTriangle fmt = new FlatMeshTriangle(upperLeft, upperRight, lowerLeft, m, Name + x + "" + z);
             box = BBox.Join(box, fmt.GetBoundingBox());
             m.AddObject(fmt);
             FlatMeshTriangle fmt2 = new FlatMeshTriangle(lowerLeft, upperRight, lowerRight, m, Name + x + "" + z + "2");
             box = BBox.Join(box, fmt2.GetBoundingBox());
             m.AddObject(fmt2);
         }
 }
Esempio n. 8
0
 public virtual void AddObject(GeometricObject o)
 {
     bbox = BBox.Join(bbox, o.GetBoundingBox());
     Objects.Add(o);
 }
Esempio n. 9
0
 public override void SetBoundingBox()
 {
     bbox = new BBox(Center + new Vector3(-Radius), Center + new Vector3(Radius));
 }
Esempio n. 10
0
 public Group(string name)
     : base(name)
 {
     bbox = new BBox();
 }
Esempio n. 11
0
 public void Union(BBox b2)
 {
     Vector3 min = Vector3.Zero;
     min.X = MathHelper.Min(Min.X, b2.Min.X);
     min.Y = MathHelper.Min(Min.Y, b2.Min.Y);
     min.Z = MathHelper.Min(Min.Z, b2.Min.Z);
     Min = min;
     Vector3 max = Vector3.Zero;
     max.X = MathHelper.Max(Max.X, b2.Max.X);
     max.Y = MathHelper.Max(Max.Y, b2.Max.Y);
     max.Z = MathHelper.Max(Max.Z, b2.Max.Z);
     Max = max;
 }
Esempio n. 12
0
 public static BBox Join(BBox b1, BBox b2)
 {
     BBox b3 = b1;
     b3.Union(b2);
     return b3;
 }
Esempio n. 13
0
 public bool Overlaps(BBox b)
 {
     bool x = (Max.X >= b.Min.X) && (Min.X <= b.Max.X);
     bool y = (Max.Y >= b.Min.Y) && (Min.Y <= b.Max.Y);
     bool z = (Max.Z >= b.Min.Z) && (Min.Z <= b.Max.Z);
     return (x && y && z);
 }
Esempio n. 14
0
 public Instance(GeometricObject obj, string name)
     : base(name)
 {
     Object = obj;
     bbox = obj.GetBoundingBox();
 }
Esempio n. 15
0
 public override void SetBoundingBox()
 {
     Vector3 v0 = Mesh.Vertices[index0], v1 = Mesh.Vertices[index1], v2 = Mesh.Vertices[index2];
     float delta = 0.000001f;
     bbox = (new BBox(MathHelper.Min(MathHelper.Min(v0.X, v1.X), v2.X) - delta, MathHelper.Max(MathHelper.Max(v0.X, v1.X), v2.X) + delta,
                  MathHelper.Min(MathHelper.Min(v0.Y, v1.Y), v2.Y) - delta, MathHelper.Max(MathHelper.Max(v0.Y, v1.Y), v2.Y) + delta,
                  MathHelper.Min(MathHelper.Min(v0.Z, v1.Z), v2.Z) - delta, MathHelper.Max(MathHelper.Max(v0.Z, v1.Z), v2.Z) + delta));
 }