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 | Protected Member Functions | Protected Attributes | Properties
VisiMath.Geometry.Cylinder Class Reference

Basic cylinder. More...

Inheritance diagram for VisiMath.Geometry.Cylinder:

List of all members.

## Public Member Functions
| Cylinder (Vector3 start, Vector3 end, float rad)
| Standard constructor.
| Cylinder (System.Xml.XmlReader reader)
| XML reader constructor.
| Cylinder ()
| Default constructor.
override float | Distance (ref Vector3 pos)
| Returns closest distance from the specified point to object.
override float | Distance (Ray ray, bool frontOnly=false)
| Returns closest distance to the ray.
override float | DistanceLineSegment (ref Vector3 pos1, ref Vector3 pos2)
| Returns closest distance to the line segment. Generic, from center, OVERRIDE!
override float | DistanceTriangle (ref Vector3 pos1, ref Vector3 pos2, ref Vector3 pos3)
| Returns closest distance to the triangle. GENERIC with center, override!!!
override float | DistanceQuad (ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4)
| Returns closest distance to the quad - calls distance from triangle.
override float | DistanceSphere (ref Vector3 center, float radius)
| Returns closest distance to the sphere.
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 Point3DList | ToPoints (Type vertextype, float quality=0, int vertexlimit=0)
| Convert object to list of points.
override LineList | ToLines (Type vertextype, float quality=0, int vertexlimit=0)
| Convert object to list of lines.
override TriangleList | ToTriangles (Type vertextype, float quality=0, int vertexlimit=0)
| Convert object to list of triangles. Valid only for surface based objects, otherwise returns null.
override IndexedMesh | ToIndexedMesh (Type vertextype, float quality=0, int vertexlimit=0)
| Convert object to indexed triangle mesh. Valid only for surface based objects, otherwise 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.
void | GetVertex (int index, out Vector3 vertex)
| Returns vertex with specified index, valid for explicit object types.
void | GetLocalSupportingVertex (ref Vector3 direction, out Vector3 vertex)
| Gets supporting vertex in local coordinates.
## Protected Member Functions
void | Recalc ()
| Recalculates data for cylinder.
## Protected Attributes
Vector3 | _Bottom = new Vector3(0,0,-0.5f)
Vector3 | _Top = new Vector3(0,0,0.5f)
Vector3 | _Center = new Vector3(0)
Vector3 | Direction
Vector3 | Normal
float | _Length
float | _Radius = 1
## Properties
Vector3 | Bottom`[get, set]`
| Bottom end of the cylinder.
Vector3 | Top`[get, set]`
| Top end of the cylinder.
float | Length`[get]`
| Length of the cyliner.
float | Radius`[get, set]`
| Radius of the cylinder.
override bool | IsPrimitive`[get]`
| Is object geometric renderable primitive from enumaration PrimitiveTypes?
override Vector3 | Center`[get]`
| Center of the object.
override bool | IsContainer`[get]`
| Cylinder is not container.
override PrimitiveTypes | PreferredPrimitive`[get]`
| Preferred type of the primitive.
override Type | PreferredVertexType`[get]`
| Preferred type of the vertex.
float | Volume`[get]`
| Volume of the object.
ConvexObjectType | BaseType`[get]`
| Returns implicit (math expression) or explicit (vertex based) type of convex object.
int | VertexCount`[get]`
| Returns number of vertices, valid for explicit object types.

## Detailed Description

Basic cylinder.

## Constructor & Destructor Documentation

VisiMath.Geometry.Cylinder.Cylinder | ( | Vector3 | start,
|  | Vector3 | end,
|  | float | rad
| ) |  |

Standard constructor.

Parameters:

  start | Start of the cylinder
  end | End point of the cylinder
  rad | Radius of the cylinder

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

XML reader constructor.

Parameters:

  reader | XML reader

VisiMath.Geometry.Cylinder.Cylinder | ( |  | ) |

Default constructor.

## Member Function Documentation

override bool VisiMath.Geometry.Cylinder.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 float VisiMath.Geometry.Cylinder.Distance | ( | ref Vector3 | pos | ) | `[virtual]`

Returns closest distance from the specified point to object.

Parameters:

  pos | position

Returns:
  Closest distance to the object

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Cylinder.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.Cylinder.DistanceLineSegment | ( | ref Vector3 | pos1,
|  | ref Vector3 | pos2
| ) |  | `[virtual]`

Returns closest distance to the line segment. Generic, from center, OVERRIDE!

param name="pos1">Start of the line

param name="pos2">end of the line

Returns:
  Closest distance

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Cylinder.DistanceQuad | ( | ref Vector3 | p1,
|  | ref Vector3 | p2,
|  | ref Vector3 | p3,
|  | ref Vector3 | p4
| ) |  | `[virtual]`

Returns closest distance to the quad - calls distance from triangle.

Parameters:

  p1 | quad corner
  p2 | quad corner
  p3 | quad corner
  p4 | quad corner>

Returns:
  Closest distance

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Cylinder.DistanceSphere | ( | ref Vector3 | center,
|  | float | radius
| ) |  | `[virtual]`

Returns closest distance to the sphere.

Parameters:

  center | center of the sphere
  radius | radius of the sphere

Returns:
  Closest distance

Reimplemented from VisiMath.Geometry.BaseGeometry.

override float VisiMath.Geometry.Cylinder.DistanceTriangle | ( | ref Vector3 | pos1,
|  | ref Vector3 | pos2,
|  | ref Vector3 | pos3
| ) |  | `[virtual]`

Returns closest distance to the triangle. GENERIC with center, override!!!

Parameters:

  pos1 | First corner
  pos2 | Second corner
  pos3 | Third corner

Returns:
  Distance

!! this is for capsule! need closestpoint linesegmenttriangle for correct check!

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Returns copy of the geometric data.

Returns:
  Full copy of the geometry

Implements VisiMath.Geometry.BaseGeometry.

override bool VisiMath.Geometry.Cylinder.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.

void VisiMath.Geometry.Cylinder.GetLocalSupportingVertex | ( | ref Vector3 | direction,
|  | out Vector3 | vertex
| ) |  |

Gets supporting vertex in local coordinates.

Parameters:

  vertex | Save vertex
  direction | Direction vector

Implements VisiMath.Geometry.IConvexObject.

void VisiMath.Geometry.Cylinder.GetVertex | ( | int | index,
|  | out Vector3 | vertex
| ) |  |

Returns vertex with specified index, valid for explicit object types.

Parameters:

  index | index of vertex
  vertex | Vector to save vertex

Implements VisiMath.Geometry.IConvexObject.

override float VisiMath.Geometry.Cylinder.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.Cylinder.ReadXml | ( | System.Xml.XmlReader | reader | ) | `[virtual]`

Deserializes object from XML.

Parameters:

  reader | XML reader

Implements VisiMath.Geometry.BaseGeometry.

void VisiMath.Geometry.Cylinder.Recalc | ( |  | ) | `[protected]`

Recalculates data for cylinder.

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

Convert object to indexed triangle mesh. Valid only for surface based objects, otherwise returns null.

Returns:
  New geometry object containing triangle faces of the object surface

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
  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.
  vertextype | Required type of the vertex

Implements VisiMath.Geometry.BaseGeometry.

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

Convert object to list of lines.

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
  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.
  vertextype | Required type of the vertex

Implements VisiMath.Geometry.BaseGeometry.

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

Convert object to list of points.

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
  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.
  vertextype | Required type of the vertex

Implements VisiMath.Geometry.BaseGeometry.

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

Convert object to list of triangles. Valid only for surface based objects, otherwise returns null.

Returns:
  New geometry object containing triangle faces of the object surface.

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
  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.
  vertextype | Required type of the vertex

Implements VisiMath.Geometry.BaseGeometry.

override void VisiMath.Geometry.Cylinder.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.Cylinder._Bottom = new Vector3(0,0,-0.5f)`[protected]`

Vector3 VisiMath.Geometry.Cylinder._Center = new Vector3(0)`[protected]`

float VisiMath.Geometry.Cylinder._Length`[protected]`

float VisiMath.Geometry.Cylinder._Radius = 1`[protected]`

Vector3 VisiMath.Geometry.Cylinder._Top = new Vector3(0,0,0.5f)`[protected]`

Vector3 VisiMath.Geometry.Cylinder.Direction`[protected]`

Vector3 VisiMath.Geometry.Cylinder.Normal`[protected]`

## Property Documentation

ConvexObjectType VisiMath.Geometry.Cylinder.BaseType`[get]`

Returns implicit (math expression) or explicit (vertex based) type of convex object.

Implements VisiMath.Geometry.IConvexObject.

Vector3 VisiMath.Geometry.Cylinder.Bottom`[get, set]`

Bottom end of the cylinder.

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

Center of the object.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Cylinder is not container.

Returns:
  Return false

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Is object geometric renderable primitive from enumaration PrimitiveTypes?

Reimplemented from VisiMath.Geometry.BaseGeometry.

float VisiMath.Geometry.Cylinder.Length`[get]`

Length of the cyliner.

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

Preferred type of the primitive.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Preferred type of the vertex.

Reimplemented from VisiMath.Geometry.BaseGeometry.

float VisiMath.Geometry.Cylinder.Radius`[get, set]`

Radius of the cylinder.

Vector3 VisiMath.Geometry.Cylinder.Top`[get, set]`

Top end of the cylinder.

int VisiMath.Geometry.Cylinder.VertexCount`[get]`

Returns number of vertices, valid for explicit object types.

Implements VisiMath.Geometry.IConvexObject.

float VisiMath.Geometry.Cylinder.Volume`[get]`

Volume of the object.

Implements VisiMath.Geometry.IVolumetric.

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

- Cylinder.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events