Polygon Object

The polygon object is a very general user-defined object. It can be used to define an open polygon surface or a closed polygon volume with some portions reflective and others refractive or absorptive. The Polygon Object is based on a collection of 3D triangles whose vertices are placed in a file with the POB extension. See the "Defining Polygon Objects" for more details. Any Polygon Object may be used as a detector as described in " Objects as detectors " .
There are no fixed limits to the total number of vertices or polygons. The POB file name is referenced in the "comments" column of the Polygon Object row. For example, if the POB file myobject.POB is placed in the <objects>\Polygon Objects folder (see " Folders " ), then specify "myobject.POB" in the comment column of the Polygon Object type row in the NSC Editor. Polygon objects require two parameters:
Parameter # | Description | Face Name | Face # |
1 | A scale factor. All vertices in the POB file are multiplied by this parameter. | NA | NA |
2 | A flag to indicate if the POB file defines a volume or a surface. If the "Is Volume?" parameter is zero, then OpticStudio assumes the POB file defines an open surface. If the "Is Volume?" parameter is any non-zero value, then OpticStudio assumes the POB file defines a closed volume. | NA | NA |
See " Special considerations for faceted objects " for information on limitations of ray tracing through faceted objects. A tool for creating POB files for use as detectors is described in " Create Polygon Object " .
The reference coordinate is locally (0, 0, 0), and the polygons that compose the object may be placed anywhere relative to the reference point. Face Numbers: Each face has a face number as defined in the POB file, see below for details.
Defining Polygon Objects
Polygon objects are user-defined objects that are composed of a collection of triangles in 3D space. The triangles are defined in a text file ending in the extension POB (for polygon object). Each face, or a group of faces, on the polygon may be assigned a unique face number if desired. There is a limit to the total number of unique faces on any single object; for details see "Object faces" .
Polygon objects that form closed volumes must not contain any interior faces. Every face must lie on the exterior of the object, defining the boundary between the inside and the outside of the volume. To make an object that has a cemented boundary, such as a beam splitter, use two or more separate polygon objects and then place them in contact. For more information on placing objects in contact, see "Placing objects inside of, adjacent to, or overlapping other objects" .
The file format may be created and edited with any text editor. The file consists of a series of rows of data. Each row begins with a single letter or symbol, followed by data for that symbol. The supported symbols and their meanings are defined as follows.
The comment symbol: !
The symbol "!" is used to define a comment line.
Syntax:
! Any comment here
Example:
! A dove prism
The face name symbol: C
Names for the faces may be defined using the C command.
Syntax:
C facenumber "any name here"
Example:
C 0 "All faces"
The face names are used to display in the object dialog box the names for the various faces of an object. Note the name must be in quotes. This command is optional.
The invisible symbol: I
Lines which connect vertices that are not to be drawn (such as lines between two adjacent triangles that lie in the same plane) can be marked as invisible. To mark two vertices as invisible, use the symbol "I" followed by the two vertex numbers. Any line connecting the marked vertices will not be drawn.
This only affects the 3D Layout plot, and is strictly a cosmetic enhancement to the drawing of polygon objects.
Syntax:
I v1 v2
Example:
I 7 9
Note the vertex numbers must be integers. The numbers are separated by spaces. The I command must precede any triangles or rectangles that reference the invisible vertices.
The vertex symbol: V
Vertices are defined by the symbol "V" followed by the vertex number and the x, y, and z coordinates of the vertex.
Syntax:
V number x y z
Example:
V 1 -1.0 -1.0 0.0
Note the vertex number must be an integer, and the x, y, and z coordinates are floating point numbers. The numbers are separated by spaces.
The triangle symbol: T
Triangles are defined by the connection of 3 vertices.
Syntax:
T vertex1 vertex2 vertex3 isreflective face
The vertex numbers must be integer vertices previously defined in the file. The "isreflective" flag is -1 if the surface absorbs, 1 if the surface reflects, or 0 if the surface refracts. Using this flag allows some triangles to be reflective, and others to be refractive or absorptive, within the same Polygon Object or face. However, the isreflective flag is not considered in the object produced by Boolean operations with the Polygon Object.
The value for face defines which face the triangle belongs to. If the face number is omitted; face 0 is assumed.
Example:
T 1 2 3 0 2
This would define a refractive triangle connecting vertices 1, 2, and 3, belonging to face 2.
The rectangle symbol: R
Rectangles are defined by the connection of 4 vertices, otherwise, they are very similar to triangles. Internally, OpticStudio converts rectangles into 2 triangles.
Syntax:
R vertex1 vertex2 vertex3 vertex4 isreflective face
The vertex numbers must be integer vertices previously defined in the file. The order of the vertices is not arbitrary, they must be listed in a continuously clockwise or counter clockwise order, not a "bow tie" order. Not all four vertex polygons form a closed rectangle; for more complex shapes use multiple triangle commands instead. The "isreflective" flag is -1 if the surface absorbs, 1 if the surface reflects, or 0 if the surface refracts. Using this flag allows some rectangles to be reflective, and others to be refractive or absorptive, within the same Polygon Object or face. However, the isreflective flag is not considered in the object produced by Boolean operations with the Polygon Object.
The value for face defines which face the rectangle belongs to. If the face number is omitted; face 0 is assumed.
Example:
R 1 2 3 4 1 0
This would define a reflective rectangle connecting vertices 1, 2, 3, and 4, belonging to face 0.
Maximum triangles in the polygon object
There is no fixed upper limit on the number of triangles a polygon object may contain. The ultimate limit is determined by the amount of real or virtual RAM the computer has available. Each triangle takes up about 100 bytes of memory. However, OpticStudio often maintains multiple copies of the lens data simultaneously, and so a good rule of thumb is that OpticStudio will need 500 bytes of RAM for each triangle. A 2000 triangle object will require about 1 Mb of free RAM. A more practical limit is computer speed; OpticStudio will slow down noticeably if the number of triangles becomes very large.
Example POB file
Here is the complete text of a POB file defining a cube of refractive material. The file is included as the example
CUBE.POB. All 8 sides of the cube belong to face 0.
! A cube ! front face vertices V 1 -1 -1 0 V 2 1 -1 0 V 3 1 1 0 V 4 -1 1 0 ! back face vertices V 5 -1 -1 2 V 6 1 -1 2 V 7 1 1 2 V 8 -1 1 2 ! Front R 1 2 3 4 0 0 ! Back R 5 6 7 8 0 0 ! Top R 4 3 7 8 0 0 ! Bottom R 1 2 6 5 0 0 ! Left side R 1 4 8 5 0 0 ! Right side R 2 3 7 6 0 0
The 8 "V" commands define the vertex coordinates of the 8 corners of the cube. The 6 "R" commands define each of the 6 faces of the cube. Note the width of the faces is 2 units, and the z coordinates of the back face vertices is defined to be 2 units; so the shape is a perfect cube. All the coordinates are relative to the object reference point; which in this case will be the center of the front face. To place the reference point at the center of the cube, change the vertex definitions to:
V 1 -1 -1 -1
V 2 1 -1 -1
V 3 1 1 -1
V 4 -1 1 -1
V 5 -1 -1 1
V 6 1 -1 1
V 7 1 1 1
V 8 -1 1 1
For more examples see the POB files provided with OpticStudio in the <objects>\Polygon Objects folder (see " Folders ").
Next: