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 | Public Attributes | Protected Attributes | Properties
VisiMath.Geometry.Sphere Class Reference

Sphere with specified center and radius. More...

Inheritance diagram for VisiMath.Geometry.Sphere:

List of all members.

## Public Member Functions
| Sphere (Vector3 cen, float rad)
| Standard constructor.
| Sphere (System.Xml.XmlReader reader)
| XML reader 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 | Distance (IGeometry obj)
| Returns closest distance from the generic geometric object.
override float | DistanceLineSegment (ref Vector3 pos1, ref Vector3 pos2)
| Returns closest distance to the line segment. Generic, from center, OVERRIDE!
override float | DistanceSphere (ref Vector3 center, float radius)
| Returns closest distance to the sphere.
override float | DistanceTriangle (ref Vector3 pos1, ref Vector3 pos2, ref Vector3 pos3)
| Returns closest distance to the triangle.
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.
void | GetLocalSupportingVertex (ref Vector3 direction, out Vector3 vertex)
| Gets supporting vertex in local coordinates.
void | GetVertex (int index, out Vector3 vertex)
| Returns vertex with specified index, valid for explicit object types.
bool | Contains (ref ISpatialIndex index)
| return true if index contains (intersects) another index
bool | Contains (Vector3 index)
| Return true if index contains position.
bool | Contains (ref Vector3 index)
| Return true if index contains position.
bool | Contains (Point3D index)
| Return true if index contains position.
bool | ContainsLine (Vector3 line1, Vector3 line2)
| Return true if index contains line.
bool | ContainsLine (ref Vector3 line1, ref Vector3 line2)
| Return true if index contains line.
bool | Contains (LineSegment3D line)
| Return true if index contains line.
bool | Contains (Vector3 center, float radius)
| Return true if index contains sphere.
bool | Contains (ref Vector3 center, float radius)
| Return true if index contains sphere.
bool | Contains (Sphere sphere)
| Return true if index contains sphere.
bool | ContainsBox (Vector3 min, Vector3 max)
| Return true if index contains axis alligned box.
bool | ContainsBox (ref Vector3 min, ref Vector3 max)
| Return true if index contains axis alligned box.
bool | Contains (AABox box)
| Return true if index contains axis alligned box.
bool | Contains (IConvexObject convex)
| Return true if index contains generic convex object.
bool | ContainsFully (ref ISpatialIndex index)
| return true if index fully contains another index
bool | ContainsFullyLine (Vector3 line1, Vector3 line2)
| Return true if index fully contains line.
bool | ContainsFullyLine (ref Vector3 line1, ref Vector3 line2)
| Return true if index fully contains line.
bool | ContainsFully (LineSegment3D line)
| Return true if index fully contains line.
bool | ContainsFully (Vector3 center, float radius)
| Return true if index fully contains sphere.
bool | ContainsFully (ref Vector3 center, float radius)
| Return true if index fully contains sphere.
bool | ContainsFully (Sphere sphere)
| Return true if index fully contains sphere.
bool | ContainsFullyBox (Vector3 min, Vector3 max)
| Return true if index fully contains axis alligned box.
bool | ContainsFullyBox (ref Vector3 min, ref Vector3 max)
| Return true if index fully contains axis alligned box.
bool | ContainsFully (AABox box)
| Return true if index fully contains axis alligned box.
bool | ContainsFully (IConvexObject convex)
| Return true if index FULLY contains generic convex object.
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.
## Public Attributes
Vector3 | _Center
| Center of the sphere.
float | Radius
| Radius of the sphere.
## Protected Attributes
float | _volume
| Volume of the sphere.
## Properties
override Type | PreferredVertexType`[get]`
| Preferred type of the vertex.
override bool | IsPrimitive`[get]`
| Sphere can't be directly rendered.
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 - prefers indexed triangles.
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.
AABox | AsBox`[get]`
| Returns spatial index as box.
Sphere | AsSphere`[get]`
| Returns spatial index as sphere.
Vector3 | AsPoint`[get]`
| returns spatial index as point (center)

## Detailed Description

Sphere with specified center and radius.

## Constructor & Destructor Documentation

VisiMath.Geometry.Sphere.Sphere | ( | Vector3 | cen,
|  | float | rad
| ) |  |

Standard constructor.

Parameters:

  cen | Center of the sphere
  rad | Radius

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

XML reader constructor.

Parameters:

  reader | XML reader

## Member Function Documentation

bool VisiMath.Geometry.Sphere.Contains | ( | ref ISpatialIndex | index | ) |

return true if index contains (intersects) another index

Parameters:

  index | Second spatial index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | Vector3 | index | ) |

Return true if index contains position.

Parameters:

  index | Position index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | ref Vector3 | index | ) |

Return true if index contains position.

Parameters:

  index | Position index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | Point3D | index | ) |

Return true if index contains position.

Parameters:

  index | Position index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | LineSegment3D | line | ) |

Return true if index contains line.

Parameters:

  index | line index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | Vector3 | center,
|  | float | radius
| ) |  |

Return true if index contains sphere.

Parameters:

  center | sphere center
  radius | sphere radius

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | ref Vector3 | center,
|  | float | radius
| ) |  |

Return true if index contains sphere.

Parameters:

  center | sphere center
  radius | sphere radius

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | Sphere | sphere | ) |

Return true if index contains sphere.

Parameters:

  sphere | sphere index

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | AABox | box | ) |

Return true if index contains axis alligned box.

Parameters:

  box | AABox

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.Contains | ( | IConvexObject | convex | ) |

Return true if index contains generic convex object.

Parameters:

  convex | Convex object

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsBox | ( | Vector3 | min,
|  | Vector3 | max
| ) |  |

Return true if index contains axis alligned box.

Parameters:

  max | Maximal corner
  min | Minimal corner

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsBox | ( | ref Vector3 | min,
|  | ref Vector3 | max
| ) |  |

Return true if index contains axis alligned box.

Parameters:

  max | Maximal corner
  min | Minimal corner

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | LineSegment3D | line | ) |

Return true if index fully contains line.

Parameters:

  line | Line segment

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | Vector3 | center,
|  | float | radius
| ) |  |

Return true if index fully contains sphere.

Parameters:

  center | sphere center
  radius | sphere radius

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | ref Vector3 | center,
|  | float | radius
| ) |  |

Return true if index fully contains sphere.

Parameters:

  center | sphere center
  radius | sphere radius

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | Sphere | sphere | ) |

Return true if index fully contains sphere.

Parameters:

  sphere | sphere index

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | AABox | box | ) |

Return true if index fully contains axis alligned box.

Parameters:

  box | AABox

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | IConvexObject | convex | ) |

Return true if index FULLY contains generic convex object.

Parameters:

  convex | Convex object

Returns:
  True if object is fully contained in index

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFully | ( | ref ISpatialIndex | index | ) |

return true if index fully contains another index

Parameters:

  index | Second spatial index

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFullyBox | ( | ref Vector3 | min,
|  | ref Vector3 | max
| ) |  |

Return true if index fully contains axis alligned box.

Parameters:

  max | Maximal corner
  min | Minimal corner

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFullyBox | ( | Vector3 | min,
|  | Vector3 | max
| ) |  |

Return true if index fully contains axis alligned box.

Parameters:

  max | Maximal corner
  min | Minimal corner

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFullyLine | ( | ref Vector3 | line1,
|  | ref Vector3 | line2
| ) |  |

Return true if index fully contains line.

Parameters:

  line1 | Start of the line
  line2 | End of the line

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsFullyLine | ( | Vector3 | line1,
|  | Vector3 | line2
| ) |  |

Return true if index fully contains line.

Parameters:

  line1 | Start of the line
  line2 | End of the line

Returns:
  True if index fully contains other object

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsLine | ( | ref Vector3 | line1,
|  | ref Vector3 | line2
| ) |  |

Return true if index contains line.

Parameters:

  line1 | Start of the line
  line2 | End of the line

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

bool VisiMath.Geometry.Sphere.ContainsLine | ( | Vector3 | line1,
|  | Vector3 | line2
| ) |  |

Return true if index contains line.

Parameters:

  line1 | Start of the line
  line2 | End of the line

Returns:
  True if intersection exists

Implements VisiMath.Collisions.ISpatialIndex.

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

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

Returns closest distance to the triangle.

Parameters:

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

Returns:
  Distance

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Returns copy of the geometric data.

Returns:
  Full copy of the geometry

Implements VisiMath.Geometry.BaseGeometry.

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

Deserializes object from XML.

Parameters:

  reader | XML reader

Implements VisiMath.Geometry.BaseGeometry.

override IndexedMesh VisiMath.Geometry.Sphere.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.Sphere.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
  VertexType | Required type of the vertex
  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.Sphere.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
  VertexType | Required type of the vertex
  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.Sphere.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
  VertexType | Required type of the vertex
  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 void VisiMath.Geometry.Sphere.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.Sphere._Center

Center of the sphere.

float VisiMath.Geometry.Sphere._volume`[protected]`

Volume of the sphere.

float VisiMath.Geometry.Sphere.Radius

Radius of the sphere.

## Property Documentation

AABox VisiMath.Geometry.Sphere.AsBox`[get]`

Returns spatial index as box.

Implements VisiMath.Collisions.ISpatialIndex.

Vector3 VisiMath.Geometry.Sphere.AsPoint`[get]`

returns spatial index as point (center)

Implements VisiMath.Collisions.ISpatialIndex.

Sphere VisiMath.Geometry.Sphere.AsSphere`[get]`

Returns spatial index as sphere.

Implements VisiMath.Collisions.ISpatialIndex.

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

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

Implements VisiMath.Geometry.IConvexObject.

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

Center of the object.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

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

Returns:
  True if container

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Sphere can't be directly rendered.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Preferred primitive type for rendering - prefers indexed triangles.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Preferred type of the vertex.

Reimplemented from VisiMath.Geometry.BaseGeometry.

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

Returns number of vertices, valid for explicit object types.

Implements VisiMath.Geometry.IConvexObject.

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

Volume of the object.

Implements VisiMath.Geometry.IVolumetric.

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

- Sphere.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events