PointCloudExpressionEvaluator
Input Ports
This transformer accepts only point cloud features.
Output Ports
The point cloud after evaluating the expressions.
Parameters
Specifies the component to be set by the corresponding expression.
Specifies the type of the component in the output point cloud. Valid types are Real64, Real32, UInt64, UInt32, UInt16, UInt8, Int64, Int32, Int16, Int8, Auto and Preserve. Auto means that the output type should be automatically determined based on the types used to perform the calculations. Preserve means that the component should keep the same type as in the input point cloud. If the component did not exist in the input point cloud, Preserve is equivalent to Auto.
An expression describing how to calculate values for the corresponding component. See the Expression Syntax section below for a description of the structure of an expression.
Expression Syntax
An expression consists of a combination of operands, operators, and parentheses. For example, a simple expression might be:
(@Component(x) + @Component(y) + @Component(z)) / 3.0
This expression calculates the average of the x, y, and z components.
White space may be used between the operands, operators, and parentheses as it is ignored by the expression processor.
Operands may be any of the following:
- A component from an input point cloud, e.g. @Component(z). Note that if a component has a scale/offset, the "applied" value of the component will be used in the expression.
- A numeric constant, either integer or floating-point. Where possible, numeric constants are interpreted as integer values; otherwise, operands will be treated as floating-point numbers. Floating-point numbers may be specified in any of the ways accepted by an ANSI-compliant C compiler, except that "f", "F", "l", and "L" suffixes are not permitted in most installations. For example, all of the following are valid floating-point numbers: 2.1, 3., 6e4, 7.91e+16.
- The value of an attribute, using @Value() notation.
- A function whose arguments have any of the above forms for operands, such as @sin(@Component(z)). See the Functions section for a list of defined functions.
The valid operators listed below are grouped in decreasing order of precedence:
Function |
Description |
---|---|
- + ~ ! |
Unary minus, unary plus, bit-wise NOT, logical NOT. Bit-wise NOT is valid for integer operands only. |
* / % |
Multiply, divide, remainder. Remainder is valid for integer operands only. The remainder always has the same sign as the divisor and an absolute value smaller than the divisor. |
+ - |
Add and subtract. |
<< >> |
Left and right shift. Valid for integer operands only. |
< > <= >= |
Boolean less, greater, less than or equal, and greater than or equal. Each operator produces 1 if the condition is true, 0 otherwise. |
== != |
Boolean equal and not equal. Each operator produces 1 if the condition is true, 0 otherwise. |
& |
Bit-wise AND. Valid for integer operands only. |
^ |
Bit-wise exclusive OR. Valid for integer operands only. |
| |
Bit-wise OR. Valid for integer operands only. |
&& |
Logical AND. Produces a 1 result if both operands are non-zero, 0 otherwise. |
|| |
Logical OR. Produces a 0 result if both operands are zero, 1 otherwise. |
The following functions are available for use in expressions. Note that the math functions invoke the C math library function of the same name. Refer to the C Manual entries for the library functions for more details on what these functions do and what arguments are valid.
Function |
Description |
---|---|
abs(arg) |
Returns the absolute value of arg. |
acos(arg) |
Returns the arc cosine of arg, in the range [0,pi] radians. Arg should be in the range [-1,1]. |
asin(arg) |
Returns the arc sine of arg, in the range [-pi/2,pi/2] radians. Arg should be in the range [-1,1]. |
atan(arg) |
Returns the arc tangent of arg, in the range [-pi/2,pi/2] radians. |
atan2(y,x) |
Returns the arc tangent of y/x, in the range [-pi,pi] radians. x and y cannot both be 0. |
ceil(arg) |
Returns the smallest integer value not less than arg. |
cos(arg) |
Returns the cosine of arg, measured in radians. |
cosh(arg) |
Returns the hyperbolic cosine of arg. If the result would cause an overflow, an error is returned. |
exp(arg) |
Returns the exponential of arg, defined as e**arg. If the result would cause an overflow, an error is returned. |
floor(arg) |
Returns the largest integer value not greater than arg. |
fmod(x,y) |
Returns the floating-point remainder of the division of x by y. If y is 0, an error is returned. |
if(c,x,y) |
Returns x if c is 0, and y otherwise. |
index() |
Returns the point index. The first point in the point cloud is index 0, the second is index 1, etc. |
log(arg) |
Returns the natural logarithm of arg. Arg must be a positive value. |
log10(arg) |
Returns the base 10 logarithm of arg. Arg must be a positive value. |
pow(x,y) |
Computes the value of x raised to the power y. If x is negative, y must be an integer value. |
rand() |
Returns a random value between 0 and 1. |
sin(arg) |
Returns the sine of arg, measured in radians. |
sinh(arg) |
Returns the hyperbolic sine of arg. If the result would cause an overflow, an error is returned. |
sqrt(arg) |
Returns the square root of arg. Arg must be non-negative. |
tan(arg) |
Returns the tangent of arg, measured in radians. |
tanh(arg) |
Returns the hyperbolic tangent of arg. |
Types and Overflows
This transformer attempts to avoid overflows by changing data types through the course of evaluating an expression. For example, if two UInt8 values are added together, the internal computations will be performed with a UInt16 type; this ensures that no overflow will occur.
In general, performing an arithmetic operation on integer types will produce an integer type. The exception to this is division: it will always produce a floating-point result. Performing an arithmetic operation on floating-point types will always produce a floating-point type.
Note that when converting between different data types, a Bounded Cast is used. As a result, when a calculated value does not fit in the destination data type, the corresponding destination value will either be set to the minimum or maximum value possible in the destination data type.
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Transformer Categories
FME Licensing Level
FME Professional edition and above
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.