Cytosim PI Cytoskeleton Simulator

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

- Namespace List
- Namespace Members

Classes | Functions
Rasterizer Namespace Reference

2D and 3D rasterizer More...

## Classes
struct | Vertex
| a point in 3D, with information for connectivity More...

## Functions
void | paintFatLine1D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[])
| Rasterizer function in 1D: More...
unsigned int | convexHull2D (unsigned int nbpts, real xy[])
| Calculate the convex hull from a set of 2D-points. More...
void | paintPolygon2D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, unsigned int nbpts, const real xy[], const int zz=0)
| Paint a polygon in 2D. More...
void | paintFatLine2D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius)
| Paint the inside of a rectangle with edges parallel to the segment [pq]. More...
void | paintFatLine2D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real width, const real offset[], const real delta[], real lengthPQ=0)
| Paint the inside of a rectangle with edges parallel to the segment [pq]. More...
void | paintBox2D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[])
| Paint a 2D rectangular volume with edges parallel to the main axes. More...
unsigned int | convexHull2D_4 (unsigned int nbpts, real xy[])
| Find convex hull from a set of 2D-points given in an array with leading-dimension 4. More...
void | paintPolygon2D_4 (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, unsigned int nbpts, const real xy[], const int zz=0)
| Polygon rasterizer function in 2D, when leading-dimension of xy[] is 4. More...
void | paintPolygon3D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, unsigned int nbpts, real xyz[])
| Paint a polygon in 3D. More...
void | paintFatLine3D_old (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[])
| old Rasterizer function in 3D (slower) More...
void | paintPolygon3D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, unsigned int nbpts, Vertex pts[])
| Paint a 3D polygon for which the edges of the convex hull are known. More...
void | paintFatLine3D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[], real lengthPQ=0)
| Paint a 3D cylinder with square section, aligned with the segment [P,Q]. More...
void | paintHexLine3D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[], real lengthPQ=0)
| Paint a 3D cylinder with hexagonal section, aligned with the segment [P,Q]. More...
void | paintBox3D (void(*paint)(int, int, int, int, void *, void *), void *arg1, void *arg2, const real p[], const real q[], const real radius, const real offset[], const real delta[])
| Paint a 3D rectangular volume with edges parallel to the main axes. More...

## Detailed Description

The different functions in the rasterizer call a given method func() for every point of INTEGER coordinates inside a certain volume.

The volume can be specified in two ways:

- as a polygon described by a list of points, using paintPolygon?D(polygon)
- as a cylinder specified by two points P,Q and a scalar 'radius'. In 3D, the functions do not rasterize a cylinder, but rather a rectangular volume that contains all the points located at distance radius or less from [PQ].

Important note: The points defining the polygon do not need to be integers.

F.Nedelec, EMBL 2002-2012, nedel.nosp@m.ec@e.nosp@m.mbl.d.nosp@m.e

/

Todo:
  implement a rasterizer in variable precision, keeping arguments as 'real'

## Function Documentation

unsigned int convexHull2D | ( | unsigned int | nbpts,
|  | real | xy[]
| ) |  |

- input: xy[] contains the coordinates of 'nbpts' points: x,y,x,y...
- output: xy[] is the anti-clockwise convex hull, starting from the bottom most point

Returns
  The number of points in the convex hull.

Parameters

  nbpts | number of points
  xy | coordinates of the points

unsigned int convexHull2D_4 | ( | unsigned int | nbpts,
|  | real | xy[]
| ) |  |

- input: xy[] contains the coordinates of 'nbpts' points: x,y,a,b,x,y...
  - For each point xy[] has 4 slots (X, Y, A, B)
  - A, B are not used, but are moved together with X,Y as the array is reordered.
- output: xy[] is the anti-clockwise convex hull, starting from the bottom most point.

Returns
  The number of points in the convex hull.

Parameters

  nbpts | number of points
  xy | coordinates of the points

void paintBox2D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[]
| ) |  |

The painted volume is square and aligned with the principal axes (X, Y, Z) It contains all the points at a distance 'radius' or less from the segment [p,q]. This is the fastest rasterizer, but the volume can be much greater than that of the cylinder. However, the volume is nearly optimal if PQ is aligned with one of the main axis, and paintBox3D is then the best choice.

Parameters

  p | first end of the segment [dim=3]
  q | second end of the segment [dim=3]
  radius | radius of cylinder contained in the volume
  offset | phase of the grid [dim=3]
  delta | period for the grid [dim=3]

void paintBox3D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[]
| ) |  |

The painted volume is square and its edges are parallel to the principal axes (X, Y, Z) It contains all the points at a distance 'radius' or less from the segment [p,q]. This is the fastest rasterizer, but the volume can be much greater than that of the cylinder, in particular in the case where PQ >> radius, and PQ is oriented along a diagonal. However, the volume is nearly optimal if PQ is almost aligned with one of the main axis, and paintBox3D is then a better choice than the rasterizers that paint a cylinder, because it is much faster.

Parameters

  p | first end of the segment [dim=3]
  q | second end of the segment [dim=3]
  radius | radius of cylinder contained in the volume
  offset | phase of the grid [dim=3]
  delta | period for the grid [dim=3]

void paintFatLine1D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[]
| ) |  |

Parameters

  p | first end of the segment [dim=1]
  q | second end of the segment [dim=1]
  radius | width by which the segment [pq] is inflated
  offset | phase of the grid [dim=1]
  delta | period for the grid [dim=1]

void paintFatLine2D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius
| ) |  |

Parameters

  p | first end of the segment [dim=2]
  q | second end of the segment [dim=2]
  radius | width by which [pq] is inflated

void paintFatLine2D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | width,
|  | const real | offset[],
|  | const real | delta[],
|  | real | lengthPQ = `0`
| ) |  |

Parameters

  p | first end of the segment [dim=2]
  q | second end of the segment [dim=2]
  width | width by which the line [pq] is extended, to make a round cylinder
  offset | phase of the grid [dim=2]
  delta | period for the grid [dim=2]
  lengthPQ | length of segment PQ, or zero if unknown

void paintFatLine3D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[],
|  | real | lengthPQ = `0`
| ) |  |

A volume is painted around the segment [p,q], containing the cylinder of all the points located at a distance 'radius' or less from [p,q]. The volume is a right cylinder with a square section.

Parameters

  p | first end of the segment [dim=3]
  q | second end of the segment [dim=3]
  radius | radius of cylinder contained in the volume
  offset | phase of the grid [dim=3]
  delta | period for the grid [dim=3]
  lengthPQ | length of segment PQ if known

void paintFatLine3D_old | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[]
| ) |  |

Parameters

  p | first end of the segment [dim=3]
  q | second end of the segment [dim=3]
  radius | radius of cylinder contained in the volume
  offset | phase of the grid [dim=3]
  delta | period for the grid [dim=3]

void paintHexLine3D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | const real | p[],
|  | const real | q[],
|  | const real | radius,
|  | const real | offset[],
|  | const real | delta[],
|  | real | lengthPQ = `0`
| ) |  |

A volume is painted around points [p,q], which contains the cylinder of all the points at a distance 'radius' or less from the segment [p,q]. The volume is a right cylinder with hexagonal section. This is a tighter approximation of the cylinder than the square cylinder of paintFatLine3D.

Parameters

  p | first end of the segment [dim=3]
  q | second end of the segment [dim=3]
  radius | radius of cylinder contained in the volume
  offset | phase of the grid [dim=3]
  delta | period for the grid [dim=3]
  lengthPQ | length of segment PQ if known

void paintPolygon2D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | unsigned int | nbpts,
|  | const real | xy[],
|  | const int | zz = `0`
| ) |  |

paintPolygon2D() calls paintPoint(x,y,zz) for every point (x,y) of integral coordinates, which are inside the polygon given in xy[]. The polygon should be convex, and ordered anti-clockwise.

Parameters

  nbpts | number of points
  xy | coordinates of the points ( x y, x y...)
  zz | third coordinate, passed as argument to paint()

void paintPolygon2D_4 | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | unsigned int | nbpts,
|  | const real | xy[],
|  | const int | zz = `0`
| ) |  |

Parameters

  nbpts | number of points
  xy | coordinates of the points ( x y, *, *, x y...)
  zz | third coordinate, passed as argument to paint()

void paintPolygon3D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | unsigned int | nbpts,
|  | real | xyz[]
| ) |  |

Rasterize the convex hull of the 'nbpts' points given in xyz[]. Simplistic algorithm: for each section at integral Z, the intersection of all possible lines connecting any two points are calculated, and the convex-hull of all this points is given to paintPolygon2D.

Parameters

  nbpts | number of points
  xyz | coordinates

void paintPolygon3D | ( | void(*)(int, int, int, int, void *, void *) | paint,
|  | void * | arg1,
|  | void * | arg2,
|  | unsigned int | nbpts,
|  | Vertex | pts[]
| ) |  |

The polygon is the convex hull of the 'nbpts' vertices given in pts[]. Each Vertex contains coordinates and information on the connectivity to other points. The connections between Vertices are the edge of the 3D polygon.

Parameters

  nbpts | number of points
  pts | coordinates + connectivity