Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sbclip(3) [debian man page]

SbClip(3)							       Coin								 SbClip(3)

NAME
SbClip - The SbClip class is a generic polygon clipper class. It is used by first adding all vertices in the polygon, and then clipping against any number of planes. If you need to supply additional information per vertex (e.g. texture coordinates), you should supply a callback in the constructor, and a pointer to your vertex structure in addVertex(). For every new vertex created, the callback is called with the line being clipped, including the pointers to your vertex structures and the position of the new (clipped against some plane) vertex. You should then create a new vertex structure, calculate your data (e.g. a new texture coordinate) and return a pointer to this structure. SYNOPSIS
#include <include/Inventor/base/SbClip.h> Public Member Functions SbClip (SbClipCallback *callback=NULL, void *userdata=NULL) void addVertex (const SbVec3f &v, void *vdata=NULL) void reset (void) void clip (const SbPlane &plane) int getNumVertices (void) const void getVertex (const int idx, SbVec3f &v, void **vdata=NULL) const void * getVertexData (const int idx) const Detailed Description The SbClip class is a generic polygon clipper class. It is used by first adding all vertices in the polygon, and then clipping against any number of planes. If you need to supply additional information per vertex (e.g. texture coordinates), you should supply a callback in the constructor, and a pointer to your vertex structure in addVertex(). For every new vertex created, the callback is called with the line being clipped, including the pointers to your vertex structures and the position of the new (clipped against some plane) vertex. You should then create a new vertex structure, calculate your data (e.g. a new texture coordinate) and return a pointer to this structure. Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. Since: Coin 2.0 Constructor &; Destructor Documentation SbClip::SbClip (SbClipCallback *callback = NULL, void *userdata = NULL) A constructor. Supply a callback if you need to handle additional data per vertex. Member Function Documentation void SbClip::addVertex (const SbVec3f &v, void *vdata = NULL) Adds a polygon vertex. vdata could be a pointer to your vertex structure. void SbClip::reset (void) Resets the clipper. This should be called before adding any vertices when reusing an SbClip instance. void SbClip::clip (const SbPlane &plane) Clip polygon against plane. This might change the number of vertices in the polygon. For each time a new vertex is created, the callback supplied in the constructor (if != NULL) is called with the line being clipped and the new vertex calculated. The callback should return a new void pointer to be stored by the clipper. int SbClip::getNumVertices (void) const Returns the number of vertices in the polygon. See also: SbClip::getVertex() void SbClip::getVertex (const intidx, SbVec3f &v, void **vdata = NULL) const Returns the vertex at index idx. See also: SbClip::getNumVertices() void * SbClip::getVertexData (const intidx) const Return the vertex data at index idx. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SbClip(3)

Check Out this Related Man Page

polygon3d(3alleg4)						  Allegro manual						polygon3d(3alleg4)

NAME
polygon3d, polygon3d_f - Draws a 3d polygon onto the specified bitmap. Allegro game programming library. SYNOPSIS
#include <allegro.h> void polygon3d(BITMAP *bmp, int type, BITMAP *texture, int vc, V3D *vtx[]); void polygon3d_f(BITMAP *bmp, int type, BITMAP *texture, int vc, V3D_f *vtx[]); DESCRIPTION
Draw 3d polygons onto the specified bitmap, using the specified rendering mode. Unlike the regular polygon() function, these routines don't support concave or self-intersecting shapes, and they can't draw onto mode-X screen bitmaps (if you want to write 3d code in mode-X, draw onto a memory bitmap and then blit to the screen). The width and height of the texture bitmap must be powers of two, but can be different, eg. a 64x16 texture is fine, but a 17x3 one is not. The vertex count parameter (vc) should be followed by an array containing the appropri- ate number of pointers to vertex structures: polygon3d() uses the fixed point V3D structure, while polygon3d_f() uses the floating point V3D_f structure. These are defined as: typedef struct V3D { fixed x, y, z; - position fixed u, v; - texture map coordinates int c; - color } V3D; typedef struct V3D_f { float x, y, z; - position float u, v; - texture map coordinates int c; - color } V3D_f; How the vertex data is used depends on the rendering mode: The `x' and `y' values specify the position of the vertex in 2d screen coordinates. The `z' value is only required when doing perspective correct texture mapping, and specifies the depth of the point in 3d world coordi- nates. The `u' and `v' coordinates are only required when doing texture mapping, and specify a point on the texture plane to be mapped on to this vertex. The texture plane is an infinite plane with the texture bitmap tiled across it. Each vertex in the polygon has a corresponding vertex on the texture plane, and the image of the resulting polygon in the texture plane will be mapped on to the polygon on the screen. We refer to pixels in the texture plane as texels. Each texel is a block, not just a point, and whole numbers for u and v refer to the top- left corner of a texel. This has a few implications. If you want to draw a rectangular polygon and map a texture sized 32x32 on to it, you would use the texture coordinates (0,0), (0,32), (32,32) and (32,0), assuming the vertices are specified in anticlockwise order. The tex- ture will then be mapped perfectly on to the polygon. However, note that when we set u=32, the last column of texels seen on the screen is the one at u=31, and the same goes for v. This is because the coordinates refer to the top-left corner of the texels. In effect, texture coordinates at the right and bottom on the texture plane are exclusive. There is another interesting point here. If you have two polygons side by side sharing two vertices (like the two parts of folded piece of cardboard), and you want to map a texture across them seamlessly, the values of u and v on the vertices at the join will be the same for both polygons. For example, if they are both rectangular, one polygon may use (0,0), (0,32), (32,32) and (32,0), and the other may use (32,0), (32,32), (64,32), (64,0). This would create a seamless join. Of course you can specify fractional numbers for u and v to indicate a point part-way across a texel. In addition, since the texture plane is infinite, you can specify larger values than the size of the texture. This can be used to tile the texture several times across the polygon. The `c' value specifies the vertex color, and is interpreted differently by various rendering modes. Read the beginning of chapter "Polygon rendering" for a list of rendering types you can use with this function. SEE ALSO
triangle3d(3alleg4), quad3d(3alleg4), polygon(3alleg4), clip3d(3alleg4), cpu_capabilities(3alleg4), excamera(3alleg4) Allegro version 4.4.2 polygon3d(3alleg4)
Man Page