#include <prm.h>
See class definition in hearder file "prm.h". For specification see class notes of course CIV-2802 "Sistemas Graficos para Engenharia", period 2010.1. Revisions:
| |
| Prm () | |
| This function creates a new primitive, puts it at the beginning of the list of primitives. | |
| Prm (int back) | |
| This function creates a new primitive, puts it at the end of the list of primitives if the "back" argument is true (1). | |
| virtual | ~Prm () |
| This function removes a primitive from the current list of primitives and releases memory that is used by it. | |
| Prm * | Next (void) |
| This function returns a pointer to the next primitive in relation to the current primitive. | |
| Prm * | Previous (void) |
| This function returns a pointer to the previous primitive in relation to the given current primitive. | |
| void | MoveFront (void) |
| This function moves the current primitive to the first position in the list of primitives. | |
| void | MoveBack (void) |
| This function moves the current primitive to the last position in the list of primitives. | |
| Prm::Type | GetType (void) |
| This function returns (as its value) a code indicating the type of the current primitive. | |
| void | Select (void) |
| This function selects the current primitive, i.e. | |
| void | Unselect (void) |
| This function unselects the given current primitive, i.e. | |
| int | CheckSelected (void) |
| This function returns the selection status (false = 0; true = 1) of the current primitive. | |
| void | SetColor (long int color) |
| This function sets the color of the current primitive. | |
| long int | GetColor (void) |
| This function returns the color of the current primitive. | |
| void | SetHeight (double height) |
| This function sets the height of the current primitive. | |
| double | GetHeight (void) |
| This function returns the height of the given primitive. | |
| static void | DeleteList (void) |
| This function realeases the memory that is used by the current list of primitives and resets the list. | |
| static Prm * | First (void) |
| This function returns a pointer to the first primitive of the current list. | |
| static Prm * | Last (void) |
| This function returns a pointer to the last primitive of the current list. | |
| static void | SelectAll (void) |
| This function selects all the primitives in the current list of primitives, i.e. | |
| static void | UnselectAll (void) |
| This function unselects all the primitives in the current list of primitives, i.e. | |
| static int | GetGlobalBox (double *xmin, double *xmax, double *ymin, double *ymax) |
| This function returns the limiting rectangle that involves all the primitives in the current list. | |
| static const double | COORD_TOL = 0.001 |
| Coordinate tolerance value. | |
| void | Reset (void) |
| This function sets a null value for the next and previous pointers, sets an undefined primitive type, and sets a null color, selection flag, and height values. | |
| void | InsertFront (void) |
| This function inserts the current primitive at the beginning of the list of primitives. | |
| void | InsertBack (void) |
| This function inserts the current primitive at the end of the list of primitives. | |
| void | RemoveFromList (void) |
| This function removes the current primitive from the list. | |
| static Prm * | prm_head = 0L |
| Head of doubly-linked list of primitives. | |
Public Types | |
| enum | Type { PRM_UNDEF, PRM_QUAD, PRM_CIRC, NumPrmTypes } |
| Primitive types. More... | |
Public Member Functions | |
| virtual void | Read (FILE *fd)=0 |
| This function reads geometry data of a primitive from a file (given by its pointer) and loads the data into the primitive attributes. | |
| virtual void | Write (FILE *fd)=0 |
| This function writes the geometry attribute data of a primitive to a file (given by its pointer). | |
| virtual int | GetNPts (void)=0 |
| This function returns (as its value) the number of vertices of the current primitive. | |
| virtual void | SetCoords (int id, double x, double y)=0 |
| This function replaces the x and y coordinates of a vertex of the current primitive by the given pair of coordinates. | |
| virtual void | GetCoords (int id, double *x, double *y)=0 |
| This function returns the x and y coordinates of a vertex of the current primitive. | |
| virtual void | Set1stPt (double x, double y)=0 |
| This function is used during interactive construction of a primitive. | |
| virtual void | Set2ndPt (double x, double y)=0 |
| This function is used during interactive construction of a primitive. | |
| virtual int | PickArea (double x, double y)=0 |
| This function checks whether a given point is in the interior of a primitive. | |
| virtual int | PickVertex (double x, double y, double tol, int *id)=0 |
| This function selects a vertex on the boundary of a primitive based on the given point position. | |
| virtual int | PickSide (double x, double y, double tol, int *id)=0 |
| This function selects a side on the boundary of a primitive based on the given point position. | |
| virtual void | Translate (double dx, double dy)=0 |
| This function translates the current primitive All the vertices of the primitive are translated by the given translation factors. | |
| virtual void | TranslateVertex (int id, double dx, double dy)=0 |
| This function translates a vertex of a primitive using the given translation factors. | |
| virtual void | TranslateSide (int id, double dx, double dy)=0 |
| This function translates the two vertices of a side of a primitive using the given translation factors. | |
| virtual void | GetBox (double *xmin, double *xmax, double *ymin, double *ymax)=0 |
| This function returns the limiting rectangle that involves the current primitive. | |
| virtual void | DisplayBoundary (void)=0 |
| This function displays the boundary of the current primitive. | |
| virtual void | DisplayInterior (void)=0 |
| This function displays the interior of the current primitive The interior area is filled with the currently specified background color. | |
| virtual void | DisplaySolid (void)=0 |
| Function to display a solid version of the current primitive. | |
| virtual void | HighltSolid (void)=0 |
| Function to highlight a solid version of the current primitive. | |
| virtual void | DisplayZbuffer (void)=0 |
| Function to send a solid version of the current primitive to the zbuffer module to be projected and displayed. | |
Static Public Member Functions | |
| static double | ABS (double x) |
| This function returns the absolute value of a double. | |
Protected Attributes | |
| Type | type |
| Primitive type. | |
| int | sel |
| Flag for selected primitive. | |
| long int | color |
| Coded RGB color. | |
| double | height |
| Height of primitive (only used in 3D). | |
Private Attributes | |
| Prm * | next |
| Next primitive in linked list. | |
| Prm * | prev |
| Previous primitive in linked list. | |
Classes | |
| struct | Coord |
| Primitive vertex coordinate structure. More... | |
|
|
Primitive types.
|
|
|
This function creates a new primitive, puts it at the beginning of the list of primitives. The head pointer to the list is modified accordingly. The special case of a current empty list is also treated. Definition at line 57 of file prm.cpp. References InsertFront(), and Reset(). |
|
|
This function creates a new primitive, puts it at the end of the list of primitives if the "back" argument is true (1). If the "back" is false (0), the primitive is put at the beginning of the list of primitives. The head pointer to the list is modified accordingly. The special case of a current empty list is also treated.
Definition at line 65 of file prm.cpp. References InsertBack(), InsertFront(), and Reset(). |
|
|
This function removes a primitive from the current list of primitives and releases memory that is used by it. The head pointer to the list of primitives may be modified accordingly. The special case of a resulting empty list is also treated. Definition at line 76 of file prm.cpp. References RemoveFromList(). |
|
|
This function returns the absolute value of a double.
Definition at line 123 of file prm.h. Referenced by Quad::PickVertex(), Circ::PickVertex(), and Dsp::ShadeColor(). |
|
|
This function returns the selection status (false = 0; true = 1) of the current primitive.
Definition at line 340 of file prm.cpp. References sel. Referenced by Dsp::Model(). |
|
|
This function realeases the memory that is used by the current list of primitives and resets the list. The function sets a null value for its head pointer. Definition at line 88 of file prm.cpp. References prm_head. Referenced by Prj::OpenModel(), and Prj::Quit(). |
|
|
This function displays the boundary of the current primitive. The function only deals with the geometric attributes of the primitive. This means that other attributes such as foreground color, line style, or mark type are specified outside this function. |
|
|
This function displays the interior of the current primitive The interior area is filled with the currently specified background color. The function only deals with the geometric attributes of the primitive. This means that other attributes such as background color or interior style are specified outside this function. |
|
|
Function to display a solid version of the current primitive. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. This function fills the solid prism faces with the current color. It uses OpenGL display functions. Implemented in Circ, and Quad. Referenced by Dsp::DisplayPrm(). |
|
|
Function to send a solid version of the current primitive to the zbuffer module to be projected and displayed. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. Implemented in Circ, and Quad. Referenced by Dsp::ZbfModel(). |
|
|
This function returns a pointer to the first primitive of the current list.
Definition at line 98 of file prm.cpp. References prm_head. Referenced by Prj::BuildDisplayList(), drvRedisplay(), GetGlobalBox(), Prj::GetHeightFac(), Dsp::Model(), Prj::PckPrm(), SelectAll(), Prj::SetHeightFac(), UnselectAll(), PrmIO::WriteList(), Dsp::ZbfModel(), and Prj::ZbufferSnapShot(). |
|
||||||||||||||||||||
|
This function returns the limiting rectangle that involves the current primitive. This rectangle is the primitive bounding box, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of the primitive's vertices.
Implemented in Circ, and Quad. Referenced by GetGlobalBox(). |
|
|
This function returns the color of the current primitive. The color is returned in a long integer with a coded RGB color (adopted in the CD graphics system).
Definition at line 354 of file prm.cpp. References color. Referenced by Dsp::DisplayPrm(), and PrmIO::WriteList(). |
|
||||||||||||||||
|
This function returns the x and y coordinates of a vertex of the current primitive. The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices.
|
|
||||||||||||||||||||
|
This function returns the limiting rectangle that involves all the primitives in the current list. This rectangle is the bounding box of the current set of primitives, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of all primitive's vertices.
Definition at line 139 of file prm.cpp. References First(), GetBox(), Next(), next, and prm_head. Referenced by Prj::OpenModel(). |
|
|
This function returns the height of the given primitive. The height is used only in 3D applications.
Definition at line 368 of file prm.cpp. References height. Referenced by Prj::GetHeightFac(), and PrmIO::WriteList(). |
|
|
This function returns (as its value) the number of vertices of the current primitive.
|
|
|
This function returns (as its value) a code indicating the type of the current primitive.
Definition at line 319 of file prm.cpp. References type. Referenced by PrmIO::WriteList(). |
|
|
Function to highlight a solid version of the current primitive. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. This function displays the edges of the prism and draws marks at its vertices, all with the current color. It uses OpenGL display functions. Implemented in Circ, and Quad. Referenced by Dsp::HighltPrm(). |
|
|
This function inserts the current primitive at the end of the list of primitives. It handles the case of an empty list (this is indicated by a null head pointer). In this case, it sets the previous and next pointers of the current primitive pointing to itself. Otherwise, it sets the next pointer of the current primitive to point to the first primitive, sets the previous pointer of the current primitive to point to the last primitive, sets the previous pointer of the first primitive to point to the current primitive, and sets the next pointer of the last primitive to point to the current primitive. If the list is not empty, the list head pointer is not changed. Definition at line 207 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveBack(), and Prm(). |
|
|
This function inserts the current primitive at the beginning of the list of primitives. It handles the case of an empty list (this is indicated by a null head pointer). In this case, it sets the previous and next pointers of the current primitive pointing to itself. Otherwise, it sets the next pointer of the current primitive to point to the first primitive, sets the previous pointer of the current primitive to point to the last primitive, sets the previous pointer of the first primitive to point to the current primitive, and sets the next pointer of the last primitive to point to the current primitive. In any case, the list head pointer will point to the current primitive. Definition at line 186 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveFront(), and Prm(). |
|
|
This function returns a pointer to the last primitive of the current list.
|
|
|
This function moves the current primitive to the last position in the list of primitives. Nothing will happen if the given primitive is already the last of the list. Definition at line 298 of file prm.cpp. References InsertBack(), prev, prm_head, and RemoveFromList(). Referenced by PrmIO::Interpret(). |
|
|
This function moves the current primitive to the first position in the list of primitives. The head pointer to the list is modified accordingly. Nothing will happen if the given primitive is already the first of the list. Definition at line 277 of file prm.cpp. References InsertFront(), prm_head, and RemoveFromList(). Referenced by PrmIO::Interpret(). |
|
|
This function returns a pointer to the next primitive in relation to the current primitive.
Definition at line 257 of file prm.cpp. References next, prev, and prm_head. Referenced by GetGlobalBox(), Dsp::Model(), Prj::PckPrm(), SelectAll(), UnselectAll(), PrmIO::WriteList(), and Dsp::ZbfModel(). |
|
||||||||||||
|
This function checks whether a given point is in the interior of a primitive.
Implemented in Circ, and Quad. Referenced by Prj::PckPrm(). |
|
||||||||||||||||||||
|
This function selects a side on the boundary of a primitive based on the given point position.
|
|
||||||||||||||||||||
|
This function selects a vertex on the boundary of a primitive based on the given point position.
|
|
|
This function returns a pointer to the previous primitive in relation to the given current primitive.
|
|
|
This function reads geometry data of a primitive from a file (given by its pointer) and loads the data into the primitive attributes.
Implemented in Circ, and Quad. Referenced by PrmIO::Interpret(). |
|
|
This function removes the current primitive from the list. The primitive removal from list modifies the next pointer of the previous primitive in the list and modifies the previous pointer of the next primitive in the list. This function also treates the situation of a single primitive list, in which case the list head pointer is reset to a null value. Otherwise, the list head pointer will be affected only in the case in which the primitive being removed is at the beginning of the list: the new list head pointer will point to the primitive next to the primitive being removed. Definition at line 228 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveBack(), MoveFront(), and ~Prm(). |
|
|
This function sets a null value for the next and previous pointers, sets an undefined primitive type, and sets a null color, selection flag, and height values.
Definition at line 172 of file prm.cpp. References color, height, next, prev, PRM_UNDEF, sel, and type. Referenced by Prm(). |
|
|
This function selects the current primitive, i.e. , it sets the selection flag of the primitive. Definition at line 326 of file prm.cpp. References sel. Referenced by Prj::SelectPrm(). |
|
|
This function selects all the primitives in the current list of primitives, i.e. , it sets the selection flag of all the primitives. |
|
||||||||||||
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the first construction point of the current primitive by the given pair of coordinates.
|
|
||||||||||||
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the second construction point of the current primitive by the given pair of coordinates.
|
|
|
This function sets the color of the current primitive. The color is given by a long integer with a coded RGB color (adopted in the CD graphics system).
Definition at line 347 of file prm.cpp. Referenced by PrmIO::Interpret(). |
|
||||||||||||||||
|
This function replaces the x and y coordinates of a vertex of the current primitive by the given pair of coordinates. The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices.
|
|
|
This function sets the height of the current primitive. The height is used only in 3D applications.
Definition at line 361 of file prm.cpp. Referenced by PrmIO::Interpret(), and Prj::SetHeightFac(). |
|
||||||||||||
|
This function translates the current primitive All the vertices of the primitive are translated by the given translation factors.
Implemented in Circ, and Quad. Referenced by PrmIO::Interpret(). |
|
||||||||||||||||
|
This function translates the two vertices of a side of a primitive using the given translation factors. The target side is indicated by an index, which should have a value between 0 and the number of primitive vertices minus one. Nothing will happen if the given index is outside this range. The index of a side corresponds to the index of its first vertex.
Implemented in Circ, and Quad. Referenced by PrmIO::Interpret(). |
|
||||||||||||||||
|
This function translates a vertex of a primitive using the given translation factors. The target vertex is indicated by its index to the primitive coordinate vector, which should have a value between 0 and the number of vertices minus one. Nothing will happen if the given index is outside this range.
Implemented in Circ, and Quad. Referenced by PrmIO::Interpret(). |
|
|
This function unselects the given current primitive, i.e. , it resets (sets to null) the selection flag of the primitive. Definition at line 333 of file prm.cpp. References sel. |
|
|
This function unselects all the primitives in the current list of primitives, i.e. , it resets (sets to null) the selection flag of all the primitives. Definition at line 127 of file prm.cpp. References First(), Next(), and sel. Referenced by Prj::SelectPrm(). |
|
|
This function writes the geometry attribute data of a primitive to a file (given by its pointer).
Implemented in Circ, and Quad. Referenced by PrmIO::WriteList(). |
|
|
Coded RGB color.
Definition at line 158 of file prm.h. Referenced by Quad::DisplayZbuffer(), Circ::DisplayZbuffer(), GetColor(), and Reset(). |
|
|
Coordinate tolerance value.
Definition at line 48 of file prm.cpp. Referenced by Circ::TranslateVertex(). |
|
|
Height of primitive (only used in 3D).
Definition at line 161 of file prm.h. Referenced by Quad::BuildSolidPrm(), Quad::DisplaySolid(), Circ::DisplaySolid(), Quad::DisplayZbuffer(), Circ::DisplayZbuffer(), GetHeight(), Quad::HighltSolid(), Circ::HighltSolid(), and Reset(). |
|
|
Next primitive in linked list.
Definition at line 141 of file prm.h. Referenced by GetGlobalBox(), InsertBack(), InsertFront(), Next(), RemoveFromList(), and Reset(). |
|
|
Previous primitive in linked list.
Definition at line 144 of file prm.h. Referenced by InsertBack(), InsertFront(), Last(), MoveBack(), Next(), Previous(), RemoveFromList(), and Reset(). |
|
|
Head of doubly-linked list of primitives.
Definition at line 44 of file prm.cpp. Referenced by DeleteList(), First(), GetGlobalBox(), InsertBack(), InsertFront(), Last(), MoveBack(), MoveFront(), Next(), Previous(), and RemoveFromList(). |
|
|
Flag for selected primitive.
Definition at line 155 of file prm.h. Referenced by CheckSelected(), Reset(), Select(), SelectAll(), Unselect(), and UnselectAll(). |
|
|
Primitive type.
Definition at line 152 of file prm.h. Referenced by Circ::Circ(), GetType(), Quad::Quad(), and Reset(). |
1.4.2-20050421