Type Method

newIcosahedron(withRadius:inwardNormals:allocator:)

Generates a mesh in the shape of a regular 20-sided polyhedron with triangular faces.

Declaration

class func newIcosahedron(withRadius radius: Float, inwardNormals: Bool, allocator: MDLMeshBufferAllocator?) -> Self

Parameters

radius

The distance from the icosahedron’s center to any one of its vertices.

inwardNormals

true to generate normal vectors pointing toward the center of the icosahedron; false to generate normal vectors pointing outward.

allocator

An object responsible for allocating mesh vertex data. If nil, Model I/O uses an internal allocator object.

Return Value

A new mesh object.

Discussion

This method generates vertex data for an icosahedron centered at the origin of its local coordinate system. An icosahedron is a rough approximation of a sphere—to generate a more precise approximation, create an icosahedron and use the newSubdividedMesh(_:submeshIndex:subdivisionLevels:) method to turn it into a geodesic sphere.

The inwardNormals parameter determines the direction of generated vertex normal vectors for the mesh. Specify true if the mesh will be viewed from inside (for example, for use in a sky effect), or false if the mesh will be viewed from outside.

See Also

Creating Parametric Meshes

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software