S3d Function Reference

S3d - Simple 3D Graphic Library


- v1.2.3 (16/AUG/2013)
- Tested on: Windows XP SP3
              AutoIt v3.3.8.1, v3.3.9.17
- Requires GDIPlus.au3

Below is a complete list of the user defined functions available in S3d.

When using them you need to add a #include <S3d.au3>.

* This reference has yet to be completed.

 

Function Reference

  1. _S3d_Arrow
  2. _S3d_Box
  3. _S3d_Circle
  4. _S3d_Clear
  5. _S3d_Dist
  6. _S3d_DistFromCamera
  7. _S3d_GetLocalMatrix
  8. _S3d_GetPos
  9. _S3d_Line
  10. _S3d_LineTo
  11. _S3d_LocalRotateX
  12. _S3d_LocalRotateY
  13. _S3d_LocalRotateZ
  14. _S3d_LocalScale
  15. _S3d_LocalTranslate
  16. _S3d_MoveTo
  17. _S3d_MoveTo2
  18. _S3d_MultiplyLocalMatrix
  19. _S3d_Polygon
  20. _S3d_RegPolygon
  21. _S3d_RibbonTo
  22. _S3d_SelectBrush
  23. _S3d_SelectFont
  24. _S3d_SelectFormat
  25. _S3d_SelectGraphic
  26. _S3d_SelectPen
  27. _S3d_SetCamera
  28. _S3d_SetCameraEx
  29. _S3d_SetLocalMatrix
  30. _S3d_SetLocalMatrixEx
  31. _S3d_Square
  32. _S3d_Star
  33. _S3d_String

 

_S3d_Arrow

Draws an arrow
_S3d_Arrow($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2 [, $nLen = 30 [, $nAngle = 0.6 ]])

Parameters

$nX1, $nY1, $nZ1 The coordinates of the starting point of the arrow
$nX2, $nY2, $nZ2 The coordinates of the ending point of the arrow
$nLen (Optional) The length of the arrow cap
$nAngle (Optional) The width of the arrow cap in radians

Return Value

Success: 1

Failure: 0, @error = 1

Remarks

This function failes if both of the two points are behind the camera.

 

_S3d_Box

Draws a box
_S3d_Box($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2)

Parameters

$nX1, $nY1, $nZ1 The coordinates of the starting point
$nX2, $nY2, $nZ2 The coordinates of the ending point

Return Value

None.

 

_S3d_Circle

Draws or fills the circle
_S3d_Circle($nX, $nY, $nZ, $nRad [, $fFill = False])

Parameters

$nX, $nY, $nZ The coordinates of the center point of the circle
$nRad Radius
$fFill (Optional) If true, the circle is filled

Return Value

Success: 1

Failure: 0

@error = 0 : _GDIPlus_GraphicsFillEllipse or _GDIPlus_GraphicsDrawEllipse failed

@error = 1 : $nRad is negative or zero

@error = 2 : The center point of the circle is behind the camera

 

_S3d_Clear

Clears a Graphics object to a specified color
_S3d_Clear($nColor = 0xFF000000)

Parameters

$nColor (Optional) Alpha, Red, Green and Blue components of color

Return Value

Success: True

Failure: False

 

_S3d_Dist

Calculates the distance between two points
_S3d_Dist([$nPos1X = 0 [, $nPos1Y = 0 [, $nPos1Z = 0 [, $nPos2X = 0 [, $nPos2Y = 0 [, $nPos2Z = 0 ]]]]]])

Parameters

$nPos1X (Optional) The X coordinate of the point 1
$nPos1Y (Optional) The Y coordinate of the point 1
$nPos1Z (Optional) The Z coordinate of the point 2
$nPos2X (Optional) The X coordinate of the point 2
$nPos2Y (Optional) The Y coordinate of the point 2
$nPos2Z (Optional) The Z coordinate of the point 2

Return Value

Calculated distance betwenn two points

 

_S3d_DistFromCamera

Calculates the distance between the camera and a specified point
_S3d_DistFromCamera([$nPosX = 0 [, $nPosY = 0 [, $nPosZ = 0 ]]])

Parameters

$nPosX (Optional) The X coordinate of a specified point
$nPosY (Optional) The Y coordinate of a specified point
$nPosZ (Optional) The Z coordinate of a specified point

Return Value

Calculated distance betwenn the camera and a specified point

 

_S3d_GetLocalMatrix

Gets the current local matrix
_S3d_GetLocalMatrix()

Parameters

None.

Return Value

Local matrix (2 dimensional array)

See also

 

_S3d_GetPos

Converts 3D coordinates of a point into 2D coordinates
_S3d_GetPos($nX, $nY, $nZ)

Parameters

$nX, $nY, $nZ 3D coordinates of a point

Return Value

Success: Returns a two-element array containing the 2D coordinates ([0] = X, [1] = Y)

Failure: 0, @error = 1

Remarks

This function fails if the specified point is behind the camera.

 

_S3d_Line

Draws a line
_S3d_Line($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2)

Parameters

$nX1, $nY1, $nZ1 The coordinates of the starting point of the line
$nX2, $nY2, $nZ2 The coordinates of the ending point of the line

Return Value

Success: True

Failure: 0, @error = 0 when _GDIPlus_GraphicsDrawLine failed; 1 when the line is behind the camera.

Remarks

This function failes if both of the two points are behind the camera.

See also

 

_S3d_LineTo

Draws a line from the current position to the specified point
_S3d_LineTo($nX, $nY, $nZ)

Parameters

$nX, $nY, $nZ The coordinates of the ending point of the line

Return Value

Success: 1

Failure: 0, @error = 1

Remarks

If this function succeeds, the current position is set to the specified ending point. This function failes if the specified point is behind the camera.

See also

 

_S3d_LocalRotateX

Rotates the local coordinates along the X axis
_S3d_LocalRotateX($nAngle [, $fDeg = False])

Parameters

$nAngle The angle of rotation along the X axis
$fDeg (Optional) Degree flag, see remarks

Return Value

None.

Remarks

$nAngle is radians if $fDeg is false, degrees if true.

See also

 

_S3d_LocalRotateY

Rotates the local coordinates along the Y axis
_S3d_LocalRotateY($nAngle [, $fDeg = False])

Parameters

$nAngle The angle of rotation along the Y axis
$fDeg (Optional) Degree flag, see remarks

Return Value

None.

Remarks

$nAngle is radians if $fDeg is false, degrees if true.

See also

 

_S3d_LocalRotateZ

Rotates the local coordinates along the Z axis
_S3d_LocalRotateZ($nAngle [, $fDeg = False])

Parameters

$nAngle The angle of rotation along the Z axis
$fDeg (Optional) Degree flag, see remarks

Return Value

None.

Remarks

$nAngle is radians if $fDeg is false, degrees if true.

See also

 

_S3d_LocalScale

Scales the local coordinates
_S3d_LocalScale($nX, $nY, $nZ)

Parameters

$nX, $nY, $nZ Scale values

Return Value

None.

See also

 

_S3d_LocalTranslate

Translates the local coordinates
_S3d_LocalTranslate($nX, $nY, $nZ)

Parameters

$nX, $nY, $nZ The amount of a translation

Return Value

None.

See also

 

_S3d_MoveTo

Sets the current position
_S3d_MoveTo($nX, $nY [, $nZ = Default])

Parameters

$nX, $nY, $nZ New current position. see remarks

Return Value

Success: 1

Failure: 0, @error = 1

Remarks

If $nZ is omitted, $nX and $nY the current position is ($nX, $nY). If $nZ is specified, this function converts ($nX, $nY, $nZ) into 2D and sets the current position.

This function fails if the specified point is behind the camera.

See also

 

_S3d_MoveTo2

Sets the two current positions
_S3d_MoveTo2($nXL, $nYL, $nZL, $nXR, $nYR, $nZR)

Parameters

$nXL, $nYL, $nZL, $nXR, $nYR, $nZR The coordinates of the new current positions

Return Value

Success: 1

Failure: 0, @error = 1 if ($nXL, $nYL, $nZL) is behind the camera; 2 if ($nXR, $nYR, $nZR) is.

Remarks

This function is a plane version of _S3d_MoveTo. This function failes if either of the specified point is behind the camera.

See also

 

_S3d_MultiplyLocalMatrix

Modifies local coordinates
_S3d_MultiplyLocalMatrix([$n00 = 1 [, $n01 = 0 [, $n02 = 0 [, $n03 = 0 [, $n10 = 0 [, $n11 = 1 [, $n12 = 0 [, $n13 = 0 [, $n20 = 0 [, $n21 = 0 [, $n22 = 1 [, $n23 = 0 [, $n30 = 0 [, $n31 = 0 [, $n32 = 0 [, $n33 = 1]]]]]]]]]]]]]]]])

Parameters

$n00 - $n33 (Optional) Values for a matrix that the Local Matrix is multiplied by

Return Value

None.

See also

 

_S3d_Polygon

Draws or fills a polygon
_S3d_Polygon($aPoints [, $fFill = False])

Parameters

$aPoints Array that specify the vertices of the polygon, see remarks
$fFill (Optional) If true, the polygon is filled

Return Value

Success: 1

Failure: 0

@error = 0 : _GDIPlus_GraphicsFillPolygon or _GDIPlus_GraphicsDrawPolygon failed

@error = 1 : $aPoints is not an array

@error = 2 : Failed to convert the coordinates of $aPoints[@extended][0] - $aPoints[@extended][2]

Remarks

$aPoints must be in the following format:


$aPoints[0][0] : The number of points
$aPoints[n][0] : nth X
$aPoints[n][1] : nth Y
$aPoints[n][2] : nth Z

See also

 

_S3d_RegPolygon

Draws or fills a regular polygon
_S3d_RegPolygon($nX, $nY, $nZ, $nRad, $iNum [, $fFill = True])

Parameters

$nX, $nY, $nZ The coordinates of the center point of the regular polygon
$nRad Radius
$iNum The number of the vertices
$fFill (Optional) If true, the regular polygon is filled

Return Value

Success: 1

Failure: 0

Remarks

This function draws or fills a regular polygon on the XY plane when called without changing the local matrix.

See also

 

_S3d_RibbonTo

Fills a ribbon like plane
_S3d_RibbonTo($nXL, $nYL, $nZL, $nXR, $nYR, $nZR)

Parameters

$nXL, $nYL, $nZL, $nXR, $nYR, $nZR The coordinates of the new positions

Return Value

Success: 1

Failure: 0, @error = 1 if ($nXL, $nYL, $nZL) is behind the camera; 2 if ($nXR, $nYR, $nZR) is.

Remarks

This function is a plane version of _S3d_LineTo.

If this function succeeds, the current positions are set to the specified points. This function failes if either of the specified point is behind the camera.

See also

 

_S3d_SelectBrush

Selects a brush object to work with
_S3d_SelectBrush($hBrush)

Parameters

$hPen Brush object to work with

Return Value

None.

 

_S3d_SelectFont

Selects a font object to work with
_S3d_SelectFont($hFont)

Parameters

$hFont Font object to work with

Return Value

None.

 

_S3d_SelectFormat

Selects a String Format object to work with
_S3d_SelectFormat($hFormat)

Parameters

$hFormat String Format object to work with

Return Value

None.

 

_S3d_SelectGraphic

Selects a Graphics object to work with
_S3d_SelectGraphic($hGraphic, $iWidth, $iHeight, [$iSmooth = 2])

Parameters

$hGraphic Graphics object to work with
$iWidth Width in pixels
$iHeight Height in pixels
$iSmooth (Optional) Smoothing mode

Return Value

None.

 

_S3d_SelectPen

Selects a pen object to work with
_S3d_SelectPen($hPen)

Parameters

$hPen Pen object to work with

Return Value

None.

 

_S3d_SetCamera

Moves the camera
_S3d_SetCamera($nCameraX, $nCameraY, $nCameraZ, $nTargetX, $nTargetY, $nTargetZ, [$nVAngle = 0 [, $nFAngle = 0.8 [, $nFScale = 1000 ]]])

Parameters

$nCameraX The X coordinate of the camera
$nCameraY The Y coordinate of the camera
$nCameraZ The Z coordinate of the camera
$nTargetX The X coordinate of the point that the camera looks at
$nTargetY The Y coordinate of the point that the camera looks at
$nTargetZ The Z coordinate of the point that the camera looks at
$nVAngle (Optional) The angle between the camera top and the screen top
$nFAngle (Optional) The view angle
$nFScale (Optional) The base scale value (global)

Return Value

None.

See also

 

_S3d_SetCameraEx

Moves the camera
_S3d_SetCameraEx($nCameraX, $nCameraY, $nCameraZ, [$nXYAngle = 0 [, $nXZAngle = 0 [, $nVAngle = 0 [, $nFAngle = 0.8 [, $nFScale = 1000 ]]]]])

Parameters

$nCameraX The X coordinate of the camera
$nCameraY The Y coordinate of the camera
$nCameraZ The Z coordinate of the camera
$nXYAngle (Optional) The camera angle (horizontal)
$nXZAngle (Optional) The camera angle (vertical)
$nVAngle (Optional) The angle between the camera top and the screen top
$nFAngle (Optional) The view angle
$nFScale (Optional) The base scale value (global)

Return Value

None.

See also

 

_S3d_SetLocalMatrix

Defines local coordinates
_S3d_SetLocalMatrix([$n00 = 1 [, $n01 = 0 [, $n02 = 0 [, $n03 = 0 [, $n10 = 0 [, $n11 = 1 [, $n12 = 0 [, $n13 = 0 [, $n20 = 0 [, $n21 = 0 [, $n22 = 1 [, $n23 = 0 [, $n30 = 0 [, $n31 = 0 [, $n32 = 0 [, $n33 = 1]]]]]]]]]]]]]]]])

Parameters

$n00 - $n33 (Optional) New values for the Local Matrix

Return Value

None.

Remarks

If all the parameters are omitted, Local Matrix will be an identity matrix.

See also

 

_S3d_SetLocalMatrixEx

Sets the local matrix directly
_S3d_SetLocalMatrixEx(ByRef $aMatrix)

Parameters

$aMatrix New local matrix (2 dimensional array)

Return Value

None.

See also

 

_S3d_Square

Draws or fills a square
_S3d_Square($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2, $nX3, $nY3, $nZ3, $nX4, $nY4, $nZ4 [, $fFill = True])

Parameters

$nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2, $nX3, $nY3, $nZ3, $nX4, $nY4, $nZ4 The coordinates of the vertices
$fFill (Optional) If true, the square is filled

Return Value

Success: 1

Failure: 0, @error = 1

Remarks

This function failes if all of the specified points are behind the camera.

See also

 

_S3d_Star

Draws or fills a star
_S3d_Star($nX, $nY, $nZ, $nRad1, $nRad2, $iNum [, $fFill = True])

Parameters

$nX, $nY, $nZ The coordinates of the center point of the star
$nRad1 Radius1
$nRad2 Radius2
$iNum $iNum * 2 is the number of the vertices
$fFill (Optional) If true, the star is filled

Return Value

Success: 1

Failure: 0

Remarks

This function draws or fills a star on the XY plane when called without changing the local matrix.

See also

 

_S3d_String

Draws a string
_S3d_String($sString, $nX, $nY, $nZ)

Parameters

$sString String to be drawn
$nX, $nY, $nZ The coordinate where the string will be drawn

Return Value

Success: 1

Failure: 0, @error = 0 if _GDIPlus_GraphicsDrawStringEx failed, 1 if ($nX, $nY, $nZ) is behind the camera.

Remarks

Before calling this function, Font and String Format must be specified using _S3d_SelectFont and _S3d_SelectFormat.

See also

 

Author: Starg