//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- internal void Set(Vector3F[] vertices, Aabb aabb, Vector3F innerPoint, DirectionalLookupTableUInt16F directionalLookupTable, VertexAdjacency vertexAdjacency) { _vertices = vertices; _aabbLocal = aabb; _innerPoint = innerPoint; _directionLookupTable = directionalLookupTable; _vertexAdjacency = vertexAdjacency; }
/// <inheritdoc/> protected override void CloneCore(Shape sourceShape) { var source = (ConvexPolyhedron)sourceShape; _vertices = source._vertices; _aabbLocal = source._aabbLocal; _innerPoint = source._innerPoint; _directionLookupTable = source._directionLookupTable; _vertexAdjacency = source._vertexAdjacency; }
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); } }