Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Icosahedron

Helper class to generate a sphere geometry based on a refinable icosahedron

Hierarchy

  • Icosahedron

Index

Constructors

constructor

Properties

Protected _faces

_faces: Array<ivec3>
see

faces

Protected _texcoords

_texcoords: Array<vec2>
see

texcoords

Protected _vertices

_vertices: Array<vec3>
see

vertices

Accessors

faces

  • get faces(): Array<ivec3>

texcoords

  • get texcoords(): Array<vec2>
  • Read-only access to the texture coordinates of the icosahedron.

    Returns Array<vec2>

vertices

  • get vertices(): Array<vec3>

Methods

Protected baseFaces

  • baseFaces(): Array<ivec3>

Protected baseVertices

  • baseVertices(): Array<vec3>

generateGeometry

  • generateGeometry(levels: number): void
  • Generates the geometry of the icosahedron.

    Parameters

    • levels: number

      Number of levels of refinement.

    Returns void

generateTextureCoordinates

  • generateTextureCoordinates(): void

Protected refine

  • refine(vertices: Array<vec3>, faces: Array<ivec3>, levels: number): void
  • Refines the icosahedron. For each step, every triangle is split into 4.

    Parameters

    • vertices: Array<vec3>

      List of vertices that is modified.

    • faces: Array<ivec3>

      List of faces that is modified.

    • levels: number

      Number of levels of refinement.

    Returns void

Protected split

  • split(a: number, b: number, vertices: Array<vec3>, cache: Map<number, number>): number
  • Splits an edge and returns the new vertex that is the center of the edge.

    Parameters

    • a: number

      Index of first vertex.

    • b: number

      Index of second vertex.

    • vertices: Array<vec3>

      List of vertices that is modified.

    • cache: Map<number, number>

      Cache to identify newly created vertices.

    Returns number