## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csEngineTools Class Reference

This is a class with static helper functions for working on engine data. More...

`#include <cstool/enginetools.h>`

List of all members.

## Static Public Member Functions

static float | FindShortestDistance (const csVector3 &source, iSector *sourceSector, const csVector3 &dest, iSector *destSector, float maxradius)
| Given two positions in the world, try to find the shortest distance (using portals if needed) between them and return the final squared distance.

## Detailed Description

This is a class with static helper functions for working on engine data.

Definition at line 37 of file enginetools.h.

## Member Function Documentation

static float csEngineTools::FindShortestDistance | ( | const csVector3 & | source,
|  | iSector * | sourceSector,
|  | const csVector3 & | dest,
|  | iSector * | destSector,
|  | float | maxradius
| ) | `[static]`

Given two positions in the world, try to find the shortest distance (using portals if needed) between them and return the final squared distance.

Note! This function will ignore all portals if the source and destination sectors are the same. Even if there might be a possible shorter path between the two positions using some space warping portal. An exception to this is if the distance is greater then the max distance. In that case this function will attempt to try out portals in the current sector to see if there is a shorter path anyway.

Note that this routine will ignore visibility. It will simply calculate the distance between the two points through some portal path. However, this function will check if the portal is oriented towards the source point (i.e it doesn't ignore visibility with regards to backface culling).

Note that this function only considers the center point of a portal for calculating the distance. This might skew results with very big portals.

This function will correctly account for space warping portals.

Parameters:

  | source | is the source position to start from.
  | sourceSector | is the sector for that position.
  | dest | is the destination position to start from.
  | destSector | is the destination for that position.
  | maxradius | is the maximum radius before we stop recursion.

Returns:
  the squared distance between the two points or a negative number if the distance goes beyond the maximum radius.

The documentation for this class was generated from the following file:

- cstool/enginetools.h