Last updated

API / geotoolkit / seismic / analysis / util / StepPrecisionUtil / StepPrecisionUtil

Class: StepPrecisionUtil

util.StepPrecisionUtil.StepPrecisionUtil

This class is used to keep the precision of numbers when steps are used to calculate these numbers.

Table of contents

Constructors
Methods

Contents

Constructors

new StepPrecisionUtil()

new StepPrecisionUtil()

Methods

getClassName

getClassName(): string

Returns

string


convertFloatStepToDouble

Static convertFloatStepToDouble(step): number

This is needed because a float such as 0.002 gets transformed to 0.00200000123 when doing a single (double) cast.

Parameters

Name Type Description
stepnumberThe step amount.

Returns

number

result The converted number.


getClassName

Static getClassName(): string

Returns

string


getMinimumFractionDigits

Static getMinimumFractionDigits(step): number

Gets the Minimum fraction digits

Parameters

Name Type Description
stepnumberThe step amount.

Returns

number

result The minimum digits.


getNormalizedLineValue

Static getNormalizedLineValue(minValue, stepIndex, step): number

Fixes precision calculator of inline and xline numbers. Can be used for time/depth as well result is always >= min never pass floats, always pass doubles works with negative of positive steps

Parameters

Name Type Description
minValuenumberThe minimum value.
stepIndexnumberThe step index.
stepnumberThe step amount.

Returns

number

normalizedValue The normalized line value.


getNormalizedStepCount

Static getNormalizedStepCount(minValue, value, step): number

Fixed precision calculator of step count. same as getNormalizedStepIndex, with 1 added result is always >= 1 never pass floats, always pass doubles don't use arbitrary step values

Parameters

Name Type Description
minValuenumberThe minimum value.
valuenumberThe actual value.
stepnumberThe step amount.

Returns

number

index The normalized step index.


getNormalizedStepIndex

Static getNormalizedStepIndex(minValue, value, step): number

Fixed precision calculator of step count. same as getNormalizedStepIndex, with 1 added result is always >= 1 never pass floats, always pass doubles don't use arbitrary step values

Throws

Error if value < minValue

Parameters

Name Type Description
minValuenumberThe minimum value.
valuenumberThe actual value.
stepnumberThe step amount.

Returns

number

index The normalized step index.


getNormalizedStepMultiplier

Static getNormalizedStepMultiplier(step): number

Finds the number of digits after the dot never pass floats, always pass doubles

Throws

Error if step is too big

Parameters

Name Type Description
stepnumberThe step value

Returns

number

multiplier The number of digits


getRelativeLineValue

Static getRelativeLineValue(referenceValue, stepIndex, step): number

fixes precision calculator of inline and xline numbers. Can be used for time/depth as well example: StepPrecisionUtil.getNormalizedLineValue(1, 50, 0.1) => 6 example: StepPrecisionUtil.getNormalizedLineValue(1, -50, -0.1) => 6 To use when the reference value is not the minimum value never pass floats, always pass doubles you might want to pass Math(step) as step

Parameters

Name Type Description
referenceValuenumberThe reference value.
stepIndexnumberThe step index.
stepnumberThe step amount.

Returns

number

relativeValue The calculated relative value.


getRelativeStepIndex

Static getRelativeStepIndex(referenceValue, value, step): number

Fixed precision calculator of step indexes. add one to get a step count example: getNormalizedStepIndex(1, 1, 0.1) => 0 example: getNormalizedStepIndex(1, 6, 0.1) => 50 example: getNormalizedStepIndex(1, 6, -0.1) => -50 To use when the reference value is not the minimum value never pass floats, always pass doubles you might want to pass Math(step) as step don't use arbitrary step values

Parameters

Name Type Description
referenceValuenumberThe reference value.
valuenumberThe actual value.
stepnumberThe step amount.

Returns

number

index The relative index.