コード例 #1
0
        private void BuildLookupTable()
        {
            // Compute center and radius of the sphere where points are sampled.
            float    polyhedronRadius;
            Vector3F center;

            GeometryHelper.ComputeBoundingSphere(_vertices, out polyhedronRadius, out center);
            float radius = polyhedronRadius * RadiusFactor;

            // Create directional lookup table. (The poles are excluded.)
            _directionLookupTable = new DirectionalLookupTableUInt16F(LookupTableWidth);

            // Sample points on the sphere and determine the indices of the closest vertices on the
            // convex polyhedron. The indices of the closest vertices are the entries in the lookup
            // table.
            foreach (Vector3F direction in _directionLookupTable.GetSampleDirections())
            {
                direction.Normalize();
                Vector3F samplePoint = direction * radius;
                _directionLookupTable[direction] = GetClosestVertex(samplePoint);
            }
        }
コード例 #2
0
    private void BuildLookupTable()
    {
      // Compute center and radius of the sphere where points are sampled.
      float polyhedronRadius;
      Vector3F center;
      GeometryHelper.ComputeBoundingSphere(_vertices, out polyhedronRadius, out center);
      float radius = polyhedronRadius * RadiusFactor;

      // Create directional lookup table. (The poles are excluded.)
      _directionLookupTable = new DirectionalLookupTableUInt16F(LookupTableWidth);

      // Sample points on the sphere and determine the indices of the closest vertices on the 
      // convex polyhedron. The indices of the closest vertices are the entries in the lookup
      // table.
      foreach (Vector3F direction in _directionLookupTable.GetSampleDirections())
      {
        direction.Normalize();
        Vector3F samplePoint = direction * radius;
        _directionLookupTable[direction] = GetClosestVertex(samplePoint);
      }
    }