FC_PointDistanceQuery - General Information

Overview

Type:

Function

Available as of:

V1.0.0.0

Versions:

Current version

This chapter provides information on:

Description

This function requires a Cartesian point and one query interface implementation chosen between a collision object, a collision group or a collision entity as inputs.

As a result, it returns:

  • The minimum distance between the point and the query interface object

  • If i_xEvaluateClosestPoint is set to TRUE, the function evaluates the closest point on the query interface object

Interface

Input

Data type

Description

i_stPoint

SE_MATH.ST_Vector3D

A Cartesian point.

i_ifQueryInterface

IF_CollisionQueryInterface

An object implementing IF_CollisionQueryInterface. This can be a collision object, a collision group or a collision entity.

i_xEvaluateClosestPoints

BOOL

If TRUE, the closest point on i_ifQueryInterface is evaluated

Output

Data type

Description

q_xError

BOOL

The output is set to TRUE if an error has been detected during the execution.

q_etResult

ET_Result

POU-specific output on the diagnostic; q_xError = FALSE -> Status message; q_xError = TRUE -> Diagnostic message.

q_sResultMsg

String

Event-triggered message that gives additional information on the diagnostic state.

q_xIsPointInside

BOOL

TRUE if the point is inside i_ifQueryInterface.

q_lrDistance

LREAL

The minimum distance between the two inputs. This is zero if q_xCollision = TRUE.

q_udiCollisionGroupIndex

UDINT

Index of the closest group for the input i_ifQueryInterface.

NOTE: This has a zero value if i_ifQueryInterface is referring to a collision object or a collision group.

q_udiCollisionObjectIndex

UDINT

Index of the closest object in the group with index q_udiCollisionGroupIndex of the input i_ifQueryInterface.

NOTE: This has a zero value, if i_ifQueryInterface is referring to a collision object.

q_stClosestPoint

SE_Math.ST_Vector3D

Closest point for the input i_ifQueryInterface.

This is only evaluated if i_xEvaluateClosestPoint = TRUE; otherwise, it will return a null vector.

Diagnostic Messages

q_xError

q_etResult

Enumeration value

Description

FALSE

OkOk

0

Success

TRUE

NoCollisionGroupsEnabled

36

No collision groups enabled.

TRUE

InterfaceInvalid

11

The provided interface is invalid (null).

TRUE

CollisionEntityNotUpdated

34

The collision entity has not been updated.

TRUE

CollisionGroupNotUpdated

21

A collision group is not updated.

TRUE

CollisionObjectTypeInvalid

16

The provided collision object type is invalid.

TRUE

CollisionObjectNotConfigured

12

The object is not configured.

TRUE

CollisionQueryInterfaceTypeInvalid

52

The provided collision query interface is referring to an invalid type.

OK

Enumeration name:

Ok

Enumeration value:

0

Description:

Success

NoCollisionGroupsEnabled

Enumeration name:

NoCollisionGroupsEnabled

Enumeration value:

36

Description:

No collision groups enabled.

Issue

Cause

Solution

Not possible to make a collision query

i_ifQueryInterface refers to a collision entity. All the configured collision groups of that entity are disabled, meaning that all the relative elements of raxEnableCollisionGroups are set to FALSE.

Make sure to enable the groups of the entity that you want to query for collision.

InterfaceInvalid

Enumeration name:

InterfaceInvalid

Enumeration value:

11

Description:

The provided interface is invalid (null).

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface contains an invalid interface.

Make sure that i_ifQueryInterface is not null.

CollisionEntityNotUpdated

Enumeration name:

CollisionEntityNotUpdated

Enumeration value:

34

Description:

The collision entity has not been updated.

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface refers to a collision entity that is not updated, meaning that its property xUpdated = FALSE.

Make sure that an entity is updated before providing it as input of this function.

CollisionGroupNotUpdated

Enumeration name:

CollisionGroupNotUpdated

Enumeration value:

21

Description:

A collision group is not updated.

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface refers to a collision group that is not updated, meaning that its property xUpdated = FALSE.

Make sure that a group is updated before providing it as input of this function.

CollisionObjectTypeInvalid

Enumeration name:

CollisionObjectTypeInvalid

Enumeration value:

16

Description:

The provided collision object type is invalid.

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface refers to a collision object with an invalid collision object type.

Make sure that i_ifQueryInterface refers to a collision object with a valid collision object type.

The valid types are:

  • ET_CollisionObjectType.AABB

  • ET_CollisionObjectType.OBB

  • ET_CollisionObjectType.Sphere

  • ET_CollisionObjectType.Capsule

CollisionObjectNotConfigured

Enumeration name:

CollisionObjectNotConfigured

Enumeration value:

12

Description:

The object is not configured.

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface refers to a collision object that is not configured, meaning that its property xConfigured = FALSE.

Make sure that an object is configured before providing it as input of this function.

CollisionQueryInterfaceTypeInvalid

Enumeration name:

CollisionQueryInterfaceTypeInvalid

Enumeration value:

52

Description:

The provided collision query interface is referring to an invalid type.

Issue

Cause

Solution

Not possible to make a collision query.

i_ifQueryInterface is referring to an invalid object type.

Make sure that i_ifQueryInterface is referring to a collision object, group or entity.

Examples

Example of distance query between a point and i_ifQueryInterface (group). In this case, q_udiCollisionObjectIndex = 4 that is the index of the closest object within the group.

Example of distance query between a point and i_ifQueryInterface (object); in this case, q_udiCollisionGroupIndex and q_udiCollisionObjectIndex are both null since i_ifQueryInterface refers to a collision object.