UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

71 lines 2.54 kB
/** * @internal * Returns if mesh1 is a descendant of mesh2 * @param mesh1 * @param mesh2 * @returns */ export function _isADescendantOf(mesh1, mesh2) { return !!(mesh1.parent && (mesh1.parent === mesh2 || _isADescendantOf(mesh1.parent, mesh2))); } /** * @internal */ export function _getClassNameOf(v) { if (v.getClassName) { return v.getClassName(); } return; } /** * @internal * Check if two classname are the same and are vector classes. * @param className the first class name * @param className2 the second class name * @returns whether the two class names are the same and are vector classes. */ export function _areSameVectorClass(className, className2) { return className === className2 && (className === "Vector2" /* FlowGraphTypes.Vector2 */ || className === "Vector3" /* FlowGraphTypes.Vector3 */ || className === "Vector4" /* FlowGraphTypes.Vector4 */); } /** * @internal * Check if two classname are the same and are matrix classes. * @param className the first class name * @param className2 the second class name * @returns whether the two class names are the same and are matrix classes. */ export function _areSameMatrixClass(className, className2) { return className === className2 && (className === "Matrix" /* FlowGraphTypes.Matrix */ || className === "Matrix2D" /* FlowGraphTypes.Matrix2D */ || className === "Matrix3D" /* FlowGraphTypes.Matrix3D */); } /** * @internal * Check if two classname are the same and are integer classes. * @param className the first class name * @param className2 the second class name * @returns whether the two class names are the same and are integer classes. */ export function _areSameIntegerClass(className, className2) { return className === "FlowGraphInteger" && className2 === "FlowGraphInteger"; } /** * Check if an object has a numeric value. * @param a the object to check if it is a number. * @param validIfNaN whether to consider NaN as a valid number. * @returns whether a is a FlowGraphNumber (Integer or number). */ export function isNumeric(a, validIfNaN) { const isNumeric = typeof a === "number" || typeof a?.value === "number"; if (isNumeric && !validIfNaN) { return !isNaN(getNumericValue(a)); } return isNumeric; } /** * Get the numeric value of a FlowGraphNumber. * @param a the object to get the numeric value from. * @returns the numeric value. */ export function getNumericValue(a) { return typeof a === "number" ? a : a.value; } //# sourceMappingURL=utils.js.map