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: ivec3[]
see

faces

Protected _texcoords

_texcoords: vec2[]
see

texcoords

Protected _vertices

_vertices: vec3[]
see

vertices

Accessors

faces

  • get faces(): ivec3[]

texcoords

  • get texcoords(): vec2[]

vertices

  • get vertices(): vec3[]

Methods

Protected baseFaces

  • baseFaces(): ivec3[]

Protected baseVertices

  • baseVertices(): 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: vec3[], faces: ivec3[], levels: number): void
  • Refines the icosahedron. For each step, every triangle is split into 4.

    Parameters

    • vertices: vec3[]

      List of vertices that is modified.

    • faces: ivec3[]

      List of faces that is modified.

    • levels: number

      Number of levels of refinement.

    Returns void

Protected split

  • split(a: number, b: number, vertices: 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: vec3[]

      List of vertices that is modified.

    • cache: Map<number, number>

      Cache to identify newly created vertices.

    Returns number