# LavishNav:Triangle (Region Type)

Jump to navigation Jump to search

## Introduction

### What is a Triangle?

If you don't know what a triangle is, but you know how to read, well... I'm not sure what to tell you. Here's a link to an official definition. http://dictionary.reference.com/search?q=triangle

A LavishNav triangle performs as a 2-dimensional triangle for containment algorithms (e.g. Z is ignored), but retains the Z coordinate to determine the center point and for retrieval of each point.

## Triangle Behaviors

### Containment

A triangle contains a given point if the given point falls within the 3 triangle points in 2 dimensions. Z coordinate is ignored.

### Nearest Point

Not yet implemented: The nearest point to a given point will presently be the center point.

### Center Point

The center point within this region is the average location of its 3 points (A + B + C / 3), in 3 dimensions.

## Triangle Characteristics

Triangles are descendants of the base region type. Any characteristics of the base region type may be applied in addition to the triangle-specific characteristics described below.

### Triangle-Specific Properties

• Point
Container element for each individual point for the triangle. Three points define a triangle. If less than three points are given, the remaining points default to 0,0,0.

#### Point properties

• X
X-coordinate. Defaults to 0.
• Y
Y-coordinate. Defaults to 0.
• Z
Z-coordinate. Defaults to 0.

## Programming with triangles

LavishScript
lnavtriangle Object Type
.NET
Triangle class

## Examples

### Example XML code

```<Triangle Name="Trifecta">
<Point>
<X>1</X>
<Y>1</Y>
<Z>1</Z>
</Point>
<Point>
<X>2</X>
<Y>2</Y>
<Z>2</Z>
</Point>
<Point>
<X>3</X>
<Y>3</Y>
<Z>3</Z>
</Point>
</Triangle>
```