1 / 24

Irit Solid Modeler

Irit is a powerful set of tools for generating polylines, polygons, bezier curves, bspline curves, surfaces, and volumes of hyper surfaces in computer graphics. Each object structure in Irit includes various attributes and data types. Important facts to note include handling object normals and polygon vertices. Irit allows describing polygonal and free-form objects using specific syntax. It supports Bezier and Bspline surfaces modeling, with examples included. Additionally, managing file orientation and data parsing are crucial steps in the Irit modeling process.

marvindale
Download Presentation

Irit Solid Modeler

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Irit Solid Modeler Computer Graphics

  2. Introduction • Irit is a set of tools to model geometrical objects. • It can generate: • Polylines, polygons, bezier and bspline curves • Polygonal, bezier and bspline surfaces • Volumes of hyper surfaces Computer Graphics

  3. Computer Graphics

  4. Irit Parser IPObjectStruct • Object Structure: Pnext Pnext Pnext ... IPobj IPobj IPobj IPobj ... ... ... U IPPolygonStruct ... IPPoly IPPoly IPPoly ... IPVertexStruct ... ... IPVertex IPVertex IPVertex NULL Computer Graphics

  5. IPObjectStruct (Defined in iritprsr.h) typedef struct IPObjectStruct { struct IPObjectStruct *Pnext; /* To next in chain. */ struct IPAttributeStruct *Attrs; char Name[OBJ_NAME_LEN]; /* Name of object. */ IPObjStructType ObjType /* Object Type: Numeric, Geometric, etc. */ ByteType Count; /* Count Number of references to this object. */ unsigned int Tags; /* Some attributes. */ union { IPPolygonStruct *Pl; /* Polygon/line list. */ CagdCrvStruct *Crvs; /* Free form curve(s). */ CagdSrfStruct *Srfs; /* Free form surface(s). */ TrimSrfStruct *TrimSrfs; /* Free form trimmed surface(s). */ TrivTVStruct *Trivars; /* Free form trivariate(s). */ Computer Graphics

  6. IPObjectStruct - Cont. RealType R; /* Numeric real data. */ PointType Pt; /* Numeric real point data. */ VectorType Vec; /* Numeric real vector data. */ PlaneType Plane; /* Numeric real plane data. */ CagdCtlPtStruct CtlPt; /* Control point data. */ MatrixType *Mat; /* Numeric 4 by 4 transformation matrix. */ struct { struct IPObjectStruct **PObjList; /* List of objects. */ int ListMaxLen; /* Maximum number of elements in list. */ } Lst; char *Str; /* General string for text object. */ VoidPtr *VPtr; } U; } IPObjectStruct; Computer Graphics

  7. IPPolygonStruct (Defined in iritprsr.h) typedef struct IPPolygonStruct { struct IPPolygonStruct *Pnext; /* To next in chain. */ struct IPAttributeStruct *Attrs; VoidPtr PAux; int IAux, IAux2; PlaneType Plane; /* Holds Plane as Ax + By + Cz + D. */ BBoxType BBox; /* BBox of polygons. */ IPVertexStruct *PVertex; /* To vertices list. */ ByteType Count, Tags; /* Some attributes. */ } IPPolygonStruct; Computer Graphics

  8. Important facts • Every polygon has a field named plane (coefficients a,b,c,d). You can use the vector (a b c) as the unit normal vector of the polygon. • Be careful: for many models the normals seem to be inverted ... • Normals point into the object, in general. • You can’t rely on having the normal for every polygon. you can verify this by using the macro: • IP_HAS_PLANE_POLY(Poly) • If TRUE then the normal is provided. Otherwise, you should compute the normal using cross product. Computer Graphics

  9. IPVertexStruct (Defined in iritprsr.h) typedef struct IPVertexStruct { struct IPVertexStruct *Pnext; /* To next in chain. */ struct IPAttributeStruct *Attrs; struct IPPolygonStruct *PAdj; /* To adjacent polygon. */ PointType Coord; /* Holds X, Y, Z coordinates. */ NormalType Normal; /* Hold Vertex normal into the solid. */ ByteType Count, Tags; /* Some attributes. */ } IPVertexStruct; • To verify the existence of the normal, you can use: • IP_HAS_NORMAL_VRTX(Vrtx) • You can also use IritPrsrSetPolyListCirc(int) to choose whether vertex list in polygons will be circular. Default is non circular. Computer Graphics

  10. Irit Data Files • A Polygonal object in Irit is described as follows: [OBJECT [Attr] Object_name [POLYGON [Attr] nb_of_edges [ [Optional Normal] Points_coordinates] [ [Optional Normal] Points_coordinates] [ [Optional Normal] Points_coordinates] ] ] Computer Graphics

  11. Irit Data Files - Cont. • Example: [OBJECT [COLOR 4] SQUARE [POLYGON [PLANE 0 0 1 0] 4 [ 2 2 0 ] [ 2 -2 0 ] [-2 -2 0 ] [-2 2 0 ] ] ] Computer Graphics

  12. Bezier/Bspline Surfaces • An object in Irit can also be described as a Bezier or Bspline surface: [OBJECT [Options] ObjectName [SURFACE BEZIER order_u order_v tp] [CtrPoint] [CtrPoint] ... [CtrPoint] ] ] Computer Graphics

  13. Example [Object NONAME [SURFACE BEZIER 3 3 E3 [0 0 0] [0.05 0.2 0.1] [0.1 0.05 0.2] [0.1 -0.2 0] [0.15 0.05 0.1] [0.2 -0.1 0.2] [0.2 0 0] [0.25 0.2 0.1] [0.3 0.05 0.2] ] ] Computer Graphics

  14. Output Computer Graphics

  15. Irit Data Files - Cont. • Each file may have it’s own orientation. In order to do this, one uses a matrix: [OBJECT VIEW_MAT [MATRIX matrix_4X4 ] ] Computer Graphics

  16. Irit Data Files - Cont. • Example: • [OBJECT VIEW_MAT • [MATRIX • 2 0 0 0 • 0 2 0 0 • 0 0 2 0 • 0 0 0 1 • ] • ] Computer Graphics

  17. Irit Data Files - Cont. • After loading a data file, the parser updates the following global variables: • extern MatrixType IritPrsrViewMat, IritPrsrPrspMat; • extern int IritPrsrWasViewMat, IritPrsrWasPrspMat; Computer Graphics

  18. Irit Data Parser IPObjectStruct *IritPrsrGetDataFiles (char **DataFileNames, int NumOfDataFiles, int Messages, int MoreMessages); • Reads data from a set of files specified by file names. Messages and MoreMessages control the level of printouts to stderr. • Freeform geometry read in is handed out to a call back function named IritPrsrProcessFreeForm before it is returned from this routine. Computer Graphics

  19. Irit Data Parser - Cont. • This is done so applications that do not want to deal with freeform shapes will be able to provide a call back that processes the freeform shapes into other geometry such as polygons. • Parameter: • DataFileNames: Array of strings (file names) to process. • NumOfDataFiles: Number of elements in DataFileNames. • Messages: Do we want error messages? • MoreMessages: Do we want informative messages? • Returned value: • IPObjectStruct *: Objects read from all files. Computer Graphics

  20. Irit Data Parser - Cont. typedef struct IritPrsrFreeFormStruct { IPObjectStruct *CrvObjs; IPObjectStruct *SrfObjs; IPObjectStruct *TrimSrfObjs; IPObjectStruct *TrivarObjs; IPObjectStruct *TriSrfObjs; IPObjectStruct *ModelObjs; IPObjectStruct *MultiVarObjs; } IritPrsrFreeFormStruct; IPObjectStruct *IritPrsrProcessFreeForm(IritPrsrFreeFormStruct *FreeForms); Computer Graphics

  21. Irit Data Parser - Cont. IPPolygonStruct *IritSurface2Polygons(CagdSrfStruct *Srf, int FourPerFlat, RealType FineNess, int ComputeUV, int ComputeNrml, int Optimal); • Routine to approximate a single surface by polygons • parameters: • Srf: To approximate using polygons. • FourPerFlat: If TRUE, four triangle per flat surface patch are created, otherwise only two. Computer Graphics

  22. Irit Data Parser - Cont. • FineNess: Fineness control on polygonal approximation. The larger this number is the finer the approximation becomes. 10 is a good compromise when Optimal is FALSE. • ComputeUV: Do we want UV parameter values with the vertices of the triangles? • ComputeNrml: Do we want normals to vertices!? • Optimal: If non zero then parametric space of Srf is sampled, optimally, otherwise uniformely. • Returned value: • IPPolygonStruct *: Resulting polygons that approximates Srf. Computer Graphics

  23. Using Irit at home • First you should get the Irit source files from the web. You can find it in: • The home page of the course (2 downloadable files) • The NT systems • If you wish to recompile Irit: • Start a shell window (dos window) • Execute a file called vcvars32.bat (located in the bin directory of the developer studio installation). • Update makeflag.wnt (located in the root directory of irit’s sources). You should update “SRC_DIR = ….” to what you have. • Execute ‘nmake -f makefile.wnt’ • You can also obtain Irit (compiled) from the Faculty CD. Computer Graphics

  24. Creating a project • For the home exercises, you will be provided a makefile. If you wish to compile from the Visual’s interface, then update the project according to the makefile. Computer Graphics

More Related