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: (any MDLMeshBufferAllocator)?) -> SelfParameters
- 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
newBox(withDimensions:segments:geometryType:inwardNormals:allocator:)newEllipsoid(withRadii:radialSegments:verticalSegments:geometryType:inwardNormals:hemisphere:allocator:)newCylinder(withHeight:radii:radialSegments:verticalSegments:geometryType:inwardNormals:allocator:)newEllipticalCone(withHeight:radii:radialSegments:verticalSegments:geometryType:inwardNormals:allocator:)newPlane(withDimensions:segments:geometryType:allocator:)newCapsule(withHeight:radii:radialSegments:verticalSegments:hemisphereSegments:geometryType:inwardNormals:allocator:)newIcosahedron(withRadius:inwardNormals:geometryType:allocator:)init(boxWithExtent:segments:inwardNormals:geometryType:allocator:)init(sphereWithExtent:segments:inwardNormals:geometryType:allocator:)init(cylinderWithExtent:segments:inwardNormals:topCap:bottomCap:geometryType:allocator:)init(coneWithExtent:segments:inwardNormals:cap:geometryType:allocator:)init(planeWithExtent:segments:geometryType:allocator:)init(icosahedronWithExtent:inwardNormals:geometryType:allocator:)init(capsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:)init(hemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:)