| Customize Help
| Save Settings

M3dgraPolygon



Function Map
Synopsis
Add a polygon graphic to a 3D graphics list.
Syntax
MIL_INT64 M3dgraPolygon(
MIL_ID List3dgraId, //in
MIL_INT64 ParentLabel, //in
MIL_INT64 CreationMode, //in
MIL_INT NumPoints, //in
const MIL_DOUBLE *CoordXArrayPtr, //in
const MIL_DOUBLE *CoordYArrayPtr, //in
const MIL_DOUBLE *CoordZArrayPtr, //in
const MIL_DOUBLE *TextureXArrayPtr, //in
const MIL_DOUBLE *TextureYArrayPtr, //in
MIL_ID TextureBufId, //in
MIL_INT64 ControlFlag //in
)
Description

This function adds a polygon graphic to the specified 3D graphics list, allowing you to, for example, view the polygon graphic on a 3D display.

You must specify the label of the 3D graphic, in the 3D graphics list, to use as the parent of the polygon graphic. When the polygon graphic is added to the 3D graphics list's tree structure, it is added as a child under the specified parent. If the 3D graphics list is empty, the polygon graphic's parent must be the root node.

You must specify the coordinates of the polygon's vertices using CoordXArrayPtr, CoordYArrayPtr, and CoordZArrayPtr. The coordinates of the polygon's vertices are expressed in the coordinate system of the polygon graphic's parent.

The polygon graphic has its own coordinate system that represents the polygon's position and orientation with respect to its parent's coordinate system. Initially, the polygon graphic's position and orientation is the identity matrix. This means that the polygon graphic's position and orientation is the same as the position of its parent's coordinate system. You can change the position and orientation of the polygon graphic using M3dgraCopy() with M_TRANSFORMATION_MATRIX.

To modify or inquire 3D graphics list settings, use M3dgraControl() or M3dgraInquire(), respectively.

You can optionally specify an image buffer to use as a texture on the 3D polygon graphic using the TextureBufId parameter. In this case, you can specify the texture mapping using the TextureXArrayPtr and TextureYArrayPtr parameters. These parameters define the points in the texture image buffer to map to corresponding vertices in the polygon.

Note that the position (0,0) is the center of the top-left pixel of the texture image buffer. To specify the top-left corner of the first pixel, specify (-0.5,-0.5). For more information, see the Pixel units and the pixel coordinate system subsection of the Pixel and real-world units section of Chapter 2: Building an application.

Once the polygon is added, you can specify that a particular value in the texture indicates transparency (using M3dgraControl() with M_KEYING_COLOR. This can be used to cut out parts of the polygon graphic.

Note that when using a C compiler (not a C++ or other compiler) in 64-bit mode, M3dgraPolygon() internally calls the MIL_DOUBLE version of this function (M3dgraPolygonDouble()). If you need to pass type-specific values, call the MIL_FLOAT version of this function (M3dgraPolygonFloat()).
Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
List3dgraId

Specifies the identifier of the 3D graphics list in which to add the polygon graphic.

ParentLabel

Specifies the label of the parent of the polygon graphic in the 3D graphics list.

function map For specifying the parent label
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_ROOT_NODE.

Click to summarize M_ROOT_NODE

Specifies the top-most node of the 3D graphics list.

Click to summarize Value >= 0

Specifies the label of the parent of the polygon graphic in the 3D graphics list. Label 0 is the 3D graphics list's root node.

(summarize)
CreationMode

Reserved for future expansion. This parameter must be set to M_DEFAULT.

NumPoints

Specifies the number of vertices in the polygon.

When using a standard vector (std::vector) overload function in C++, you can pass M_DEFAULT to this parameter and MIL will automatically determine the size based on the number of items in the vector passed to the CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, TextureXArrayPtr, or TextureYArrayPtr parameter.

function map For specifying the number of vertices in the polygon
Click to summarizeValue Description
Click to summarize Value >= 3

Specifies the number of vertices in the polygon.

CoordXArrayPtr
Accepts the address of one of the following:
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a constant std::vector<MIL_DOUBLE> ] (and a maximum array rank for C# of 1)
    Required array size:(NumPoints)

Specifies the list of X-coordinates of the vertices.

CoordYArrayPtr
Accepts the address of one of the following:
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a constant std::vector<MIL_DOUBLE> ] (and a maximum array rank for C# of 1)
    Required array size:(NumPoints)

Specifies the list of Y-coordinates of the vertices.

CoordZArrayPtr
Accepts the address of one of the following:
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a constant std::vector<MIL_DOUBLE> ] (and a maximum array rank for C# of 1)
    Required array size:(NumPoints)

Specifies the list of Z-coordinates of the vertices.

TextureXArrayPtr
Accepts the address of one of the following:
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a constant std::vector<MIL_DOUBLE> ] (and a maximum array rank for C# of 1)
    Required array size:(NumPoints)

Specifies the list of X-coordinates of the points in the texture image that map to the specified vertices for the texture mapping.

TextureXArrayPtr and TextureYArrayPtr must either be pointers to arrays with the same number of values as NumPoints, or M_NULL.

If TextureXArrayPtr and TextureYArrayPtr are set to M_NULL, and TextureBufId is not set to M_NULL, MIL sets the texture mapping automatically. Each vertex is mapped to a corner of the image buffer, starting from the top left and moving counter-clockwise. If there are more than 4 vertices, this will result in multiple vertices mapped to the same position in the image buffer.

Typically, you should only rely on automatic texture mapping when creating a polygon 3D graphic that is a rectangle or triangle with the same aspect ratio as the texture image buffer. Otherwise, automatic texture mapping will result in the texture being displayed with distortion.

TextureYArrayPtr
Accepts the address of one of the following:
  • array of type MIL_DOUBLE [optionally, in C++: a reference to a constant std::vector<MIL_DOUBLE> ] (and a maximum array rank for C# of 1)
    Required array size:(NumPoints)

Specifies the list of Y-coordinates of the points in the texture image that map to the specified vertices for the texture mapping.

TextureXArrayPtr and TextureYArrayPtr must either be pointers to arrays with the same number of values as NumPoints, or M_NULL.

If TextureXArrayPtr and TextureYArrayPtr are set to M_NULL, and TextureBufId is not set to M_NULL, MIL sets the texture mapping automatically. Each vertex is mapped to a corner of the texture image buffer, starting from the top left and moving counter-clockwise. If there are more than 4 vertices, this will result in multiple vertices mapped to the same position in the image buffer.

Typically, you should only rely on automatic texture mapping when creating a polygon 3D graphic that is a rectangle or triangle with the same aspect ratio as the texture image buffer. Otherwise, automatic texture mapping will result in the texture being displayed with distortion.

TextureBufId

Specifies the identifier of the image buffer to be used as a texture. The image buffer must be an 8-bit, unsigned, 1- or 3-band buffer.

To create a polygon graphic with no texture, set this parameter, as well as TextureXArrayPtr and TextureYArrayPtr, to M_NULL.

Note that setting TextureXArrayPtr and TextureYArrayPtr to M_NULL without setting TextureBufId to M_NULL will cause an error.

ControlFlag

Reserved for future expansion. This parameter must be set to M_DEFAULT.

Return value
Returns the label of the polygon graphic added to the 3D graphics list.
Type-specific versions of the function when using a C compiler under 64-bit
MIL_INT64 M3dgraPolygonDouble (MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_INT64 CreationMode, MIL_INT NumPoints, const MIL_DOUBLE *CoordXArrayPtr, const MIL_DOUBLE *CoordYArrayPtr, const MIL_DOUBLE *CoordZArrayPtr, const MIL_DOUBLE *TextureXArrayPtr, const MIL_DOUBLE *TextureYArrayPtr, MIL_ID TextureBufId, MIL_INT64 ControlFlag)
Parameters

List3dgraId

See List3dgraId of the main function for a description.

ParentLabel

See ParentLabel of the main function for a description.

CreationMode

See CreationMode of the main function for a description.

NumPoints

See NumPoints of the main function for a description.

CoordXArrayPtr

See CoordXArrayPtr of the main function for a description.

CoordYArrayPtr

See CoordYArrayPtr of the main function for a description.

CoordZArrayPtr

See CoordZArrayPtr of the main function for a description.

TextureXArrayPtr

See TextureXArrayPtr of the main function for a description.

TextureYArrayPtr

See TextureYArrayPtr of the main function for a description.

TextureBufId

See TextureBufId of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

MIL_INT64 M3dgraPolygonFloat (MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_INT64 CreationMode, MIL_INT NumPoints, const MIL_FLOAT *CoordXArrayPtr, const MIL_FLOAT *CoordYArrayPtr, const MIL_FLOAT *CoordZArrayPtr, const MIL_FLOAT *TextureXArrayPtr, const MIL_FLOAT *TextureYArrayPtr, MIL_ID TextureBufId, MIL_INT64 ControlFlag)
Parameters

List3dgraId

See List3dgraId of the main function for a description.

ParentLabel

See ParentLabel of the main function for a description.

CreationMode

See CreationMode of the main function for a description.

NumPoints

See NumPoints of the main function for a description.

CoordXArrayPtr

See CoordXArrayPtr of the main function for a description.

CoordYArrayPtr

See CoordYArrayPtr of the main function for a description.

CoordZArrayPtr

See CoordZArrayPtr of the main function for a description.

TextureXArrayPtr

See TextureXArrayPtr of the main function for a description.

TextureYArrayPtr

See TextureYArrayPtr of the main function for a description.

TextureBufId

See TextureBufId of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

Compilation information
Header Include mil.h.
Library Use mil.lib; mil3d.lib.
DLL Requires mil.dll; mil3d.dll.
DEFAULT ROOT NODE UNSIGNED