Beispiel #1
0
        /// <summary>
        /// Initializes a box that contains a generic piece of geometry.
        /// This box will be aligned with an arbitrary plane.
        /// </summary>
        /// <param name="basePlane">Base plane for aligned bounding box.</param>
        /// <param name="geometry">Geometry to box.</param>
        public Box(Plane basePlane, GeometryBase geometry)
        {
            // David: this code is untested.
            m_dx = new Interval(+1, -1);
            m_dy = new Interval(0, 0);
            m_dz = new Interval(0, 0);

            m_plane = basePlane;
            if (!m_plane.IsValid)
            {
                return;
            }

            Transform   mapping = Geometry.Transform.ChangeBasis(Plane.WorldXY, m_plane);
            BoundingBox bbox    = geometry.GetBoundingBox(mapping);

            m_dx = new Interval(bbox.Min.m_x, bbox.Max.m_x);
            m_dy = new Interval(bbox.Min.m_y, bbox.Max.m_y);
            m_dz = new Interval(bbox.Min.m_z, bbox.Max.m_z);

            MakeValid();
        }
Beispiel #2
0
    /// <summary>
    /// Initializes a box that contains a generic piece of geometry.
    /// This box will be aligned with an arbitrary plane.
    /// </summary>
    /// <param name="basePlane">Base plane for aligned bounding box.</param>
    /// <param name="geometry">Geometry to box.</param>
    public Box(Plane basePlane, GeometryBase geometry)
    {
      // David: this code is untested.
      m_dx = new Interval(+1, -1);
      m_dy = new Interval(0, 0);
      m_dz = new Interval(0, 0);

      m_plane = basePlane;
      if (!m_plane.IsValid) { return; }

      Transform mapping = Geometry.Transform.ChangeBasis(Plane.WorldXY, m_plane);
      BoundingBox bbox = geometry.GetBoundingBox(mapping);

      m_dx = new Interval(bbox.Min.m_x, bbox.Max.m_x);
      m_dy = new Interval(bbox.Min.m_y, bbox.Max.m_y);
      m_dz = new Interval(bbox.Min.m_z, bbox.Max.m_z);

      MakeValid();
    }
Beispiel #3
0
		/// <summary>
		/// Unions the entire ObjectTable BBox with the geo BBox and, if layerIndex is less than the count of layerBBox, 
		/// unions the LayerBBoxes list at the layerIndex provided with the geo BBox.
		/// </summary>
		protected virtual void AddObjectBoundingBox (GeometryBase geo, int layerIndex) 
		{
			ModelFile.Objects.GetBoundingBox().Union (geo.GetBoundingBox (false));

			if ((layerIndex >= 0) && (layerIndex < LayerBBoxes.Count ()))
				LayerBBoxes [layerIndex].Union (geo.GetBoundingBox (false));	                                          
		}