UV Object

Overview

The UV object (new in Version 2.8) encapsulates numerous parameters used by the DrawImageUV method to render images mapped to 3D surfaces. This functionality is covered in Chapter 11.

Member List

Properties


AmbientLight As Single (Read/Write)

Specifies the ambient light component. Only used if Shading is True, ignored otherwise. 0.4 by default.

See also: Section 11.5 - Shading.


BrightnessMax As Integer (Read/Write)
BrightnessMin As Integer (Read/Write)

Specify the mapping between shading values and the change in brightness for the corresponding pixels of the image being rendered.

See also: Section 11.5 - Shading.


CameraAngle As Single (Read/Write)

Specifies the virtual camera's view angle (in degrees) which affects the degree of perspective. 30° by default.

See also: Section 11.4 - Surface Visualization.


CameraX As Single (Read/Write)
CameraY As Single (Read/Write)
CameraZ As Single (Read/Write)

Specify the location of the virtual camera. (5, 0, 0) by default.

See also: Section 11.4 - Surface Visualization.


DiffuseLight As Single (Read/Write)

Specifies the diffuse light component. Only used if Shading is True, ignored otherwise. 0.6 by default.

See also: Section 11.5 - Shading.


DisplayImage As Boolean (Read/Write)

Specifies whether the pixels of the image being rendered should be displayed on the 3D surface. True by default. Can be set to False for debugging purposes so that the wireframe and/or shading can be viewed by themselves. This property and DisplayShading cannot both be True.

See also: Section 11.5 - Shading.


DisplayShading As Boolean (Read/Write)

Specifies whether the shading pattern should be displayed on the 3D surface instead of the image. False by default. Useful for debugging purposes. This property and DisplayImage cannot both be True.

See also: Section 11.5 - Shading.


DisplayWireframe As Boolean (Read/Write)

Specifies whether the wireframe should be displayed on the 3D surface in addition to, or instead of the image/shading. False by default. Useful for debugging purposes. This property cannot be False if DisplayImage and DisplayShading are both False. The color and thickness of the wireframe are specified via the WireframeColor and WireframeThickness properties.

See also: Section 11.3 - Specifying Parametric Equations via UV Object, Section 11.6 - Putting It All Together.


FlipNormals As Boolean (Read/Write)

Specifies whether the direction of the normal vectors of all surface faces should be reversed. False by default. Depending on the way the surface is defined, the normals may be pointing towards, or away from, the camera by default. If they point in the "wrong" direction, the faces may not receive proper shading, and may also be wrongly hidden by the HideBackFace property. Set this property to True to fix those problems.

See also: Section 11.5 - Shading.


HideBackFace As Boolean (Read/Write)

If set to True, hides the faces pointing away from the camera. False by default. This property is useful for displaying a surface that should appear wrapped around an object depicted on the background canvas, such as a pen, mug or baseball cap.

See also: Section 11.4 - Surface Visualization.


ScaleX As Single (Read/Write)
ScaleY As Single (Read/Write)

Specify horizontal and vertical scaling factors affecting the mapping of the image being rendered to the 3D surface on which it is rendered. (1, 1) by default. These properties cannot be 0 but can be negative. A number with the absolute value greater than 1 shrinks the image along the corresponding axis into a tiling pattern, and a number with the absolute value between 0 and 1 stretches it. A negative number for ScaleX flips the image horizontally, and for ScaleY vertically.

See also: Section 11.3 - Specifying Parametric Equations via UV Object.


Shading As Boolean (Read-only)

Enables shading for the image being rendered. False by default. Shading greatly improves the visual perception of depth. Without it, the image may look flat.

See also: Section 11.5 - Shading.


ShiftX As Single (Read-only)
ShiftY As Single (Read-only)

Specify the horizontal and vertical displacement of the rendered image relative to the canvas. By default, the 3D view is transferred onto the canvas in such a way that its center is positioned right over the center of the canvas. For fine-tuning purposes, the image may need to be shifted slightly up, down or sideways to match the content of the canvas. These properties help with this task.

See also: Section 11.4 - Surface Visualization, Section 11.6 - Putting It All Together.


SpecularAlpha As Single (Read-only)

Specifies the "alpha" value in the Phong reflection model for the specular light component. This value affects the size of a specular highlight. Only used if Shading is True, ignored otherwise. 100 by default.

See also: Section 11.5 - Shading.


SpecularLight As Single (Read-only)

Specifies the specular light component. Only used if Shading is True, ignored otherwise. 0.3 by default.

See also: Section 11.5 - Shading.


UMax As Single (Read/Write)
UMin As Single (Read/Write)

Specify the inclusive range for the U parameter in the parametric equations defining the 3D surface. UMax must be greater than UMin. These properties are required.

See also: Section 11.2 - Parametric Representation of 3D Surfaces.


UStep As Integer (Read/Write)

Specifies the number of steps for the U parameter. This property is required, and must be 1 or greater.

See also: Section 11.2 - Parametric Representation of 3D Surfaces.


VMax As Single (Read/Write)
VMin As Single (Read/Write)

Specify the inclusive range for the V parameter in the parametric equations defining the 3D surface. VMax must be greater than VMin. These properties are required.

See also: Section 11.2 - Parametric Representation of 3D Surfaces.


VStep As Integer (Read/Write)

Specifies the number of steps for the V parameter. This property is required, and must be 1 or greater.

See also: Section 11.2 - Parametric Representation of 3D Surfaces.


WireframeColor As Long (Read/Write)

Specifies the wireframe color. Only used if DisplayWireframe is True, ignored otherwise. White (&HFFFFFFFF) by default.

See also: Section 11.3 - Specifying Parametric Equations via UV Object, Section 11.6 - Putting It All Together.


WireframeThickness As Long (Read/Write)

Specifies the wireframe thickness. Only used if DisplayWireframe is True, ignored otherwise. 1 by default.

See also: Section 11.3 - Specifying Parametric Equations via UV Object, Section 11.6 - Putting It All Together.


XFunc As String (Read/Write)
YFunc As String (Read/Write)
ZFunc As String (Read/Write)

Specify the X, Y and Z mathematical equations for the 3D surface being defined. The strings may contain numbers, arithmetic operations, parentheses, parameter names, special names, and function names. These properties are required.

See also: Section 11.3 - Specifying Parametric Equations via UV Object .

Methods


Sub ResetCamera()

Resets the camera to its default location, orientation and view angle: the coordinates are reset to (5, 0, 0), lens vector to (-1, 0, 0) and view angle to 30°.

See also: Section 11.4 - Surface Visualization.


Sub RotateCamera(Pitch As Single, Bank As Single, Yaw As Single)

Rotates the camera around its center. Pitch is rotation around the lateral (left-to-right) axis. Bank is rotation around the longitudinal (front-to-back) axis. Yaw is rotation around the vertical axis. The method performs the rotations in the order Pitch-Bank-Yaw. The angles are specified in degrees.

See also: Section 11.4 - Surface Visualization.


Sub RotateCameraAroundAxes(X As Single, Y As Single, Z As Single)

Rotates the camera around the three coordinate axes X, Y and Z. The method performs the rotations in the order X-Y-Z. The angles are specified in degrees.

See also: Section 11.4 - Surface Visualization.


Sub SetLightVector(X As Single, Y As Single, Z As Single)

Specifies the direction of the light vector. By default the light vector is parallel to the X-axis and points in the opposite direction to it. The default vector values are (-1, 0, 0). The X, Y and Z values cannot all be 0. The light vector affects the way the surface is shaded.

See also: Section 11.5 - Shading.