VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | Properties
VisiMath.Geometry.Ray Class Reference

Ray for picking and collisions. More...

Inheritance diagram for VisiMath.Geometry.Ray:

List of all members.

## Public Member Functions
| Ray (System.Xml.XmlReader reader)
| Ray ()
| Creates default ray (from zero, direction unitZ)
| Ray (Vector3 ori, Vector3 dir)
| Constructs ray from origin and normalized direction.
void | FromDirection (Vector3 ori, Vector3 dir)
| Changes origin and direction of the ray.
void | FromTwoPoints (Vector3 start, Vector3 second)
| Creates ray from first and second vector.
void | Transform (ref Matrix4 mat)
| Transforms ray by specified matrix.
Vector3 | TravelTo (float distance)
| Travels on the ray from the origin to specified distance.
void | TravelTo (float distance, out Vector3 rval)
| Travels on the ray from the origin to specified distance.
override float | Distance (ref Vector3 pos)
| Returns closest distance from the specified point to object.
float | DistanceToLineSegment (ref Vector3 l1, ref Vector3 l2, bool frontOnly=true)
| Returns closest distance to the line segment.
float | Distance (Vector3 pos, bool frontOnly=true)
| Returns closest distance to the specified point.
override float | Distance (Ray ray, bool frontOnly=false)
| Returns closest distance to the ray.
override float | Distance (IGeometry obj)
| Returns closest distance from the generic geometric object.
override bool | Intersects (Ray ray)
| Checks for intersection between object and ray.
override bool | Intersects (IGeometry obj)
| Checks for intersection with generic geo object.
override bool | ContainsPosition (Vector3 pos)
| Checks if specified position is inside the object.
override bool | GetIntersectionInfo (Ray obj, ref IIntersectionInfo inters)
| Check for intersection and fills intersection info if intersection is closer to the origin of the ray then value before.
override float | IntersectsMoving (float radius, Ray ray, float maxdistance)
| Checks for intersection between object and moving sphere.
override IGeometry | ConvertToPrimitive (Type VertexType, PrimitiveTypes primType, float quality=0, int vertexlimit=0)
| Converts object to new geometry object with specified primitive type and optionally with quality parameters. Ray can be converted either to linelist or pointlist.
override Point3DList | ToPoints (Type VertexType, float quality=0, int vertexlimit=0)
| Convert ray to list of points - series of points from center leading in direction. With max quality creates hundred of points with 1 spacing.
override LineList | ToLines (Type VertexType, float quality=0, int vertexlimit=0)
| Convert Ray to list of one line.
override TriangleList | ToTriangles (Type VertexType, float quality=0, int vertexlimit=0)
| Ray cannot be converted to triangles. Returns null.
override IndexedMesh | ToIndexedMesh (Type VertexType, float quality=0, int vertexlimit=0)
| Ray cannot be converted to triangles. Returns null.
override void | ReadXml (System.Xml.XmlReader reader)
| Deserializes object from XML.
override void | WriteXml (System.Xml.XmlWriter writer)
| Serializes object to XML.
override IGeometry | GetCopy ()
| Returns copy of the geometric data.
## Static Public Member Functions
static Ray | CreateFromPoints (Vector3 start, Vector3 second)
| Creates new ray from two points.
static Ray | CreateFromDirection (Vector3 ori, Vector3 dir)
| Createes new ray from origin and normalized direction.
## Public Attributes
Vector3 | Origin
| Origin of the ray.
Vector3 | Direction
| Normalized direction of the ray.
## Properties
override Type | PreferredVertexType`[get]`
| Preferred type of the vertex.
override bool | IsPrimitive`[get]`
| Is object geometric renderable primitive from enumaration PrimitiveTypes?
override bool | IsContainer`[get]`
| If geometry object is container, it's made of several joined objects.
override Vector3 | Center`[get]`
| Center of the object.
override PrimitiveTypes | PreferredPrimitive`[get]`
| Preferred primitive type for rendering.

## Detailed Description

Ray for picking and collisions.

## Constructor & Destructor Documentation

VisiMath.Geometry.Ray.Ray | ( | System.Xml.XmlReader | reader | ) |

VisiMath.Geometry.Ray.Ray | ( |  | ) |

Creates default ray (from zero, direction unitZ)

VisiMath.Geometry.Ray.Ray | ( | Vector3 | ori,
|  | Vector3 | dir
| ) |  |

Constructs ray from origin and normalized direction.

Parameters:

  ori | origin
  dir | direction

## Member Function Documentation

override bool VisiMath.Geometry.Ray.ContainsPosition | ( | Vector3 | pos | ) | `[virtual]`

Checks if specified position is inside the object.

Parameters:

  pos | Position to check

Returns:
  True if vector is inside the object

Implements VisiMath.Geometry.BaseGeometry.

override IGeometry VisiMath.Geometry.Ray.ConvertToPrimitive | ( | Type | VertexType,
|  | PrimitiveTypes | primType,
|  | float | quality = `0`,
|  | int | vertexlimit = `0`
| ) |  | `[virtual]`

Converts object to new geometry object with specified primitive type and optionally with quality parameters. Ray can be converted either to linelist or pointlist.

Parameters:

  primType | Specified type of the primitive
  quality | Quality for parametric objects (0-1). Zero is simples possible, 1 maximal for the current dimension of the object. If vertexlimit parameter is used, quality will be reduced to fullfill maximal vertex budget
  VertexType | Required vertex type
  vertexlimit | Maximal number of allowed vertices. If set to zero, there's no limit. Used for fully parametric objects or to reduce number of the vertices in complicated objects.

Returns:
  New object of specified type

Reimplemented from VisiMath.Geometry.BaseGeometry.

static Ray VisiMath.Geometry.Ray.CreateFromDirection | ( | Vector3 | ori,
|  | Vector3 | dir
| ) |  | `[static]`

Createes new ray from origin and normalized direction.

Parameters:

  ori | Origin
  dir | Normalized direction

Returns:
  New Ray

static Ray VisiMath.Geometry.Ray.CreateFromPoints | ( | Vector3 | start,
|  | Vector3 | second
| ) |  | `[static]`

Creates new ray from two points.

Parameters:

  start | Origin of the ray
  second | Target

Returns:
  New Ray

override float VisiMath.Geometry.Ray.Distance | ( | ref Vector3 | pos | ) | `[virtual]`

Returns closest distance from the specified point to object.

Parameters:

  pos | point to check distance

Returns:
  Closest distance to the object

Reimplemented from VisiMath.Geometry.BaseGeometry.

float VisiMath.Geometry.Ray.Distance | ( | Vector3 | pos,
|  | bool | frontOnly = `true`
| ) |  |

Returns closest distance to the specified point.

Parameters:

  pos | Position to check distance to
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

override float VisiMath.Geometry.Ray.Distance | ( | Ray | ray,
|  | bool | frontOnly = `false`
| ) |  | `[virtual]`

Returns closest distance to the ray.

Parameters:

  ray | Ray to check distance to
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Ray.Distance | ( | IGeometry | obj | ) | `[virtual]`

Returns closest distance from the generic geometric object.

Parameters:

  obj | Object to check distance with

Returns:
  Closest distance to the object

Reimplemented from VisiMath.Geometry.BaseGeometry.

float VisiMath.Geometry.Ray.DistanceToLineSegment | ( | ref Vector3 | l1,
|  | ref Vector3 | l2,
|  | bool | frontOnly = `true`
| ) |  |

Returns closest distance to the line segment.

Parameters:

  l1 | Start of the segment
  l2 | End of the segment
  frontOnly | Check only objects in front of the origin

Returns:
  Closest distance to the ray, if frontOnly and object is behind the ray, returns NaN

void VisiMath.Geometry.Ray.FromDirection | ( | Vector3 | ori,
|  | Vector3 | dir
| ) |  |

Changes origin and direction of the ray.

Parameters:

  ori |
  dir |

void VisiMath.Geometry.Ray.FromTwoPoints | ( | Vector3 | start,
|  | Vector3 | second
| ) |  |

Creates ray from first and second vector.

Parameters:

  start | Origin of the ray
  second | Target

override IGeometry VisiMath.Geometry.Ray.GetCopy | ( |  | ) | `[virtual]`

Returns copy of the geometric data.

Returns:
  Full copy of the geometry

Implements VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Ray.GetIntersectionInfo | ( | Ray | obj,
|  | ref IIntersectionInfo | inters
| ) |  | `[virtual]`

Check for intersection and fills intersection info if intersection is closer to the origin of the ray then value before.

Parameters:

  inters | Data structure with intersection info
  obj | Ray object

Returns:
  True if there was an intersection and it was closer then previous stored

Implements VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Ray.Intersects | ( | Ray | ray | ) | `[virtual]`

Checks for intersection between object and ray.

Parameters:

  ray |

Returns:
  True if ray intersects the object

Reimplemented from VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Ray.Intersects | ( | IGeometry | obj | ) | `[virtual]`

Checks for intersection with generic geo object.

Parameters:

  obj | Object to check with

Returns:
  True if intersection exists

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Ray.IntersectsMoving | ( | float | radius,
|  | Ray | ray,
|  | float | maxdistance
| ) |  | `[virtual]`

Checks for intersection between object and moving sphere.

param name="radius">Radius of the sphere

Parameters:

  maxdistance | Maximal distance to travel
  ray | Ray describing movement of the sphere

Returns:
  Distance to the intersection or -1 if no intersection exists

Implements VisiMath.Geometry.BaseGeometry.

override void VisiMath.Geometry.Ray.ReadXml | ( | System.Xml.XmlReader | reader | ) | `[virtual]`

Deserializes object from XML.

Parameters:

  reader | XML reader

Implements VisiMath.Geometry.BaseGeometry.

override IndexedMesh VisiMath.Geometry.Ray.ToIndexedMesh | ( | Type | VertexType,
|  | float | quality = `0`,
|  | int | vertexlimit = `0`
| ) |  | `[virtual]`

Ray cannot be converted to triangles. Returns null.

Returns:
  Null.

Parameters:

  VertexType | unused
  quality | unused
  vertexlimit | unused

Implements VisiMath.Geometry.BaseGeometry.

override LineList VisiMath.Geometry.Ray.ToLines | ( | Type | VertexType,
|  | float | quality = `0`,
|  | int | vertexlimit = `0`
| ) |  | `[virtual]`

Convert Ray to list of one line.

Returns:
  New geometry object containing edges of the object

Parameters:

  quality | Quality for parametric objects (0-1). Zero is simples possible, 1 maximal for the current dimension of the object. If vertexlimit parameter is used, quality will be reduced to fullfill maximal vertex budget
  VertexType | Required vertex type
  vertexlimit | Maximal number of allowed vertices. If set to zero, there's no limit. Used for fully parametric objects or to reduce number of the vertices in complicated objects.

Implements VisiMath.Geometry.BaseGeometry.

override Point3DList VisiMath.Geometry.Ray.ToPoints | ( | Type | VertexType,
|  | float | quality = `0`,
|  | int | vertexlimit = `0`
| ) |  | `[virtual]`

Convert ray to list of points - series of points from center leading in direction. With max quality creates hundred of points with 1 spacing.

Returns:
  New geometry object containing point based definition of the object

Parameters:

  quality | Quality for parametric objects (0-1). Zero is simples possible, 1 maximal for the current dimension of the object. If vertexlimit parameter is used, quality will be reduced to fullfill maximal vertex budget
  VertexType | Required vertex type
  vertexlimit | Maximal number of allowed vertices. If set to zero, there's no limit. Used for fully parametric objects or to reduce number of the vertices in complicated objects.

Implements VisiMath.Geometry.BaseGeometry.

override TriangleList VisiMath.Geometry.Ray.ToTriangles | ( | Type | VertexType,
|  | float | quality = `0`,
|  | int | vertexlimit = `0`
| ) |  | `[virtual]`

Ray cannot be converted to triangles. Returns null.

Returns:
  Null.

Parameters:

  VertexType | unused
  quality | unused
  vertexlimit | unused

Implements VisiMath.Geometry.BaseGeometry.

void VisiMath.Geometry.Ray.Transform | ( | ref Matrix4 | mat | ) |

Transforms ray by specified matrix.

Parameters:

  mat | Tranformation matrix

void VisiMath.Geometry.Ray.TravelTo | ( | float | distance,
|  | out Vector3 | rval
| ) |  |

Travels on the ray from the origin to specified distance.

Parameters:

  distance | Required distance
  rval | Vector to be filled with new position

Vector3 VisiMath.Geometry.Ray.TravelTo | ( | float | distance | ) |

Travels on the ray from the origin to specified distance.

Parameters:

  distance | Required distance

Returns:
  New position on the ray

override void VisiMath.Geometry.Ray.WriteXml | ( | System.Xml.XmlWriter | writer | ) | `[virtual]`

Serializes object to XML.

Parameters:

  writer | XML writer to save values

Implements VisiMath.Geometry.BaseGeometry.

## Member Data Documentation

Vector3 VisiMath.Geometry.Ray.Direction

Normalized direction of the ray.

Vector3 VisiMath.Geometry.Ray.Origin

Origin of the ray.

## Property Documentation

override Vector3 VisiMath.Geometry.Ray.Center`[get]`

Center of the object.

Reimplemented from VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Ray.IsContainer`[get]`

If geometry object is container, it's made of several joined objects.

Returns:
  false

Reimplemented from VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Ray.IsPrimitive`[get]`

Is object geometric renderable primitive from enumaration PrimitiveTypes?

Reimplemented from VisiMath.Geometry.BaseGeometry.

override PrimitiveTypes VisiMath.Geometry.Ray.PreferredPrimitive`[get]`

Preferred primitive type for rendering.

Reimplemented from VisiMath.Geometry.BaseGeometry.

override Type VisiMath.Geometry.Ray.PreferredVertexType`[get]`

Preferred type of the vertex.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

- Ray.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events