ImplicitFunction

Introduction

vtkImplicitFunction computes the implicit function and/or gradient for a function.

Methods

evaluateFunction

Given the point x evaluate the function.

Argument Type Required Description
x Vector3 Yes The point coordinate.

extend

Method used to decorate a given object (publicAPI+model) with vtkImplicitFunction characteristics.

Argument Type Required Description
publicAPI Yes object on which methods will be bounds (public)
model Yes object on which data structure will be bounds (protected)
initialValues IImplicitFunctionInitialValues No (default: {})

functionValue

Evaluate function at position x-y-z and return value. Point x[3] is
transformed through transform (if provided).

Argument Type Required Description
x Vector3 Yes The point coordinate.

getTransform

Get the transform. undefined by default

newInstance

Method used to create a new instance of vtkImplicitFunction.

Argument Type Required Description
initialValues IImplicitFunctionInitialValues No for pre-setting some of its content

setTransform

Set the transform to apply on all points.

Argument Type Required Description
transform vtkTransform Yes The transform to apply

Source

index.d.ts
import { vtkObject } from '../../../interfaces';
import { Vector3 } from '../../../types';
import { vtkTransform } from '../../Transform/Transform';

/**
*
*/
export interface IImplicitFunctionInitialValues {
transform?: vtkTransform;
}

export interface vtkImplicitFunction extends vtkObject {
/**
* Given the point x evaluate the function.
* @see functionValue
* @param {Vector3} x The point coordinate.
*/
evaluateFunction(x: Vector3): number;

/**
* Evaluate function at position x-y-z and return value. Point x[3] is
* transformed through transform (if provided).
* @see evaluateFunction
* @param {Vector3} x The point coordinate.
*/
functionValue(x: Vector3): number;

/**
* Get the transform. undefined by default
*/
getTransform(): vtkTransform;

/**
* Set the transform to apply on all points.
* @param {vtkTransform} transform The transform to apply
*/
setTransform(transform: vtkTransform): boolean;
}

/**
* Method used to decorate a given object (publicAPI+model) with vtkImplicitFunction characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {IImplicitFunctionInitialValues} [initialValues] (default: {})
*/
export function extend(
publicAPI: object,
model: object,
initialValues?: IImplicitFunctionInitialValues
): void;

/**
* Method used to create a new instance of vtkImplicitFunction.
* @param {IImplicitFunctionInitialValues} [initialValues] for pre-setting some of its content
*/
export function newInstance(
initialValues?: IImplicitFunctionInitialValues
): vtkImplicitFunction;

/**
* vtkImplicitFunction computes the implicit function and/or gradient for a function.
*/
export declare const vtkImplicitFunction: {
newInstance: typeof newInstance;
extend: typeof extend;
};
export default vtkImplicitFunction;
index.js
import macro from 'vtk.js/Sources/macros';

// ----------------------------------------------------------------------------
// Global methods
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// Static API
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// vtkImplicitFunction methods
// ----------------------------------------------------------------------------

function vtkImplicitFunction(publicAPI, model) {
model.classHierarchy.push('vtkImplicitFunction');

publicAPI.functionValue = (xyz) => {
if (!model.transform) {
return publicAPI.evaluateFunction(xyz);
}
const transformedXYZ = [];
model.transform.transformPoint(xyz, transformedXYZ);
return publicAPI.evaluateFunction(transformedXYZ);
};

publicAPI.evaluateFunction = (_xyz) => {
macro.vtkErrorMacro('not implemented');
};
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
const DEFAULT_VALUES = {
// transform : null
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Object methods
macro.obj(publicAPI, model);

macro.setGet(publicAPI, model, ['transform']);

vtkImplicitFunction(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkImplicitFunction');

// ----------------------------------------------------------------------------

export default { newInstance, extend };