Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Library

Contains various methods to load and save files, particularly those to load the polytope library.

Index

Variables

Let fileName

fileName: string

A filename, used as a temporary variable in some functions.

Functions

Const checkCommonElements

  • checkCommonElements(a: number[], b: number[]): boolean
  • Helper function for openFile and more specifically for onloadOFF. Checks whether two arrays have a common element using a dictionary.

    Parameters

    • a: number[]

      The first array to check.

    • b: number[]

      The second array to check.

    Returns boolean

    Whether the arrays have a common element or not.

Const onloadGGB

  • onloadGGB(contents: string): void
  • A GGB file is really just a ZIP file in disguise. This ZIP file contains an XML called geogebra.xml. This function will be called with this XML's data as a string. It will store the 3D polyhedron into the global variable P.

    todo

    Load the polyhedron into a scene, instead of loading it into a global variable.

    Parameters

    • contents: string

      The contents of the file.

    Returns void

Const onloadOFF

  • onloadOFF(contents: string): void

Const openFile

  • openFile(e: Event | string): void
  • Opens a file and stores it into the global variable P.

    todo

    Replace P by scene.polytope or something similar.

    todo

    Add support for more file formats (like STL or OBJ).

    todo

    Rewrite the code with npm's fs.

    Parameters

    • e: Event | string

      Either the event triggered by the import button, or a local filepath.

    Returns void

Const saveBlob

  • saveBlob(blob: Blob): void

Const setFileName

  • setFileName(newFileName: string): void

Generated using TypeDoc, the 1/31/2021 at 6:18:55 AM