Skip to content
Snippets Groups Projects
Select Git revision
  • 40aa847d1f9c5d2a1a5161ecedb879c2657f9416
  • master default protected
  • rednatco-v2
  • base-pairs-ladder
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

helpers.ts

Blame
  • functions.ts 2.65 KiB
    /**
     * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com>
     *
     * Adapted from MolQL project
     */
    
    import { MolScriptBuilder } from '../../../mol-script/language/builder';
    const B = MolScriptBuilder;
    import { FunctionDict } from '../types';
    
    export const functions: FunctionDict = {
        'sqr': {
            '@desc': 'square of x',
            '@examples': ['sqr(2)'],
            map: x => B.core.math.pow([x, 2]),
        },
        'sqrt': {
            '@desc': 'square root of x',
            '@examples': ['sqrt(2)'],
            map: x => B.core.math.sqrt([x]),
        },
        'abs': {
            '@desc': 'absolute value of x',
            '@examples': ['abs(2)'],
            map: x => B.core.math.abs([x]),
        },
        'floor': {
            '@desc': 'largest integer not greater than x',
            '@examples': ['floor(2)'],
            map: x => B.core.math.floor([x]),
        },
        'ceil': {
            '@desc': 'smallest integer not less than x',
            '@examples': ['ceil(2)'],
            map: x => B.core.math.ceil([x]),
        },
        'sin': {
            '@desc': 'sine of x',
            '@examples': ['sin(2)'],
            map: x => B.core.math.sin([x]),
        },
        'cos': {
            '@desc': 'cosine of x',
            '@examples': ['cos(2)'],
            map: x => B.core.math.cos([x]),
        },
        'tan': {
            '@desc': 'tangent of x',
            '@examples': ['tan(2)'],
            map: x => B.core.math.tan([x]),
        },
        'atan': {
            '@desc': 'arctangent of x',
            '@examples': ['atan(2)'],
            map: x => B.core.math.atan([x]),
        },
        'asin': {
            '@desc': 'arcsin of x',
            '@examples': ['asin(2)'],
            map: x => B.core.math.asin([x]),
        },
        'acos': {
            '@desc': 'arccos of x',
            '@examples': ['acos(2)'],
            map: x => B.core.math.acos([x]),
        },
        'sinh': {
            '@desc': 'hyperbolic sine of x',
            '@examples': ['sinh(2)'],
            map: x => B.core.math.sinh([x]),
        },
        'cosh': {
            '@desc': 'hyperbolic cosine of x',
            '@examples': ['cosh(2)'],
            map: x => B.core.math.cosh([x]),
        },
        'tanh': {
            '@desc': 'hyperbolic tangent of x',
            '@examples': ['tanh(2)'],
            map: x => B.core.math.tanh([x]),
        },
        'exp': {
            '@desc': 'e to the power x',
            '@examples': ['exp(2)'],
            map: x => B.core.math.exp([x]),
        },
        'log': {
            '@desc': 'natural log of x',
            '@examples': ['log(2)'],
            map: x => B.core.math.log([x]),
        },
        'log10': {
            '@desc': 'log base 10 of x',
            '@examples': ['log10(2)'],
            map: x => B.core.math.log10([x]),
        }
    };