Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
STexturingUtil Namespace Reference

Functions

static Array ColorizeCloudFromImage (SCloud iCloud, SImage iImage)
 Colorize a cloud with an image. More...
 
static Array ConvertColorToTexture (SPoly iPoly, Number iPixelsPerTriangle, Boolean iIsUpdateOnlyTriWithoutTexture)
 Converts colors/inspections of a mesh into texture. More...
 
static Array ConvertTextureMapsToAtlas (SPoly iPoly)
 Converts all the texture maps of a mesh into one (or several) texture atlas. More...
 
static Array ExtractImageFromTexture (SPoly iPoly)
 Converts dynamic textures from a mesh to scene images. More...
 
static Number GetNumberOfTextureMaps (SPoly iPoly)
 Returns the number of dynamic textures (texture maps) applied to the mesh. More...
 
static Number GetNumberOfTextures (SPoly iPoly)
 Returns the number of textures applied to the mesh. More...
 
static Array GetTextureName (SPoly iPoly, Number iTextureIdx)
 Returns the original name of a dynamic texture (texture map) applied to the mesh. More...
 
static Array RemoveTexture (SPoly ioPoly)
 Removes all textures applied to the mesh. More...
 
static Array TakeColorFromClouds (SPoly iPoly, Array< SCloud > iCloudsTbl, Number iIgnoreOver, Number iResetColor, Number iDefaultRed, Number iDefaultGreen, Number iDefaultBlue)
 Uses the color (or the color of inspection) of point clouds to color the vertices on the current mesh. More...
 
static Array TextureAddRepetitive (SPoly iPoly, String iFilePathName, Number iNbRepWidth, Number iNbRepHeight, SVector iDirXScreen, SVector iDirYScreen, SPoint iImageOrigin)
 Adds repetitive texture to a mesh. More...
 
Array TextureFromClouds (SPoly iPoly, Array< SCloud > CloudTbl, Number iIgnoreOverInM, Number iDefaultRed, Number iDefaultGreen, Number iDefaultBlue, Number iPixelSize=0.01, Number iExistingOption)
 Uses the color (or the color of inspection) of point clouds to texture the current mesh. More...
 
static Array TextureMeshSmart (SPoly iPoly, Array< SImage > iImgTbl, Number iPixelSize=0.01, Number iTextureSize, Number iExistingOption, Array< SPoly > iObstaclesTbl=Array< SPoly >())
 Textures a mesh with images, using the Smart Texture method. More...
 
static Array TextureMeshStandard (SPoly iPoly, Array< SImage > iImgTbl, Number iVisibilityOption, Number iImageOption, Number iExistingOption)
 Textures a mesh with images. More...
 

Function Documentation

◆ ColorizeCloudFromImage()

static Array STexturingUtil::ColorizeCloudFromImage ( SCloud  iCloud,
SImage  iImage 
)
static

Colorize a cloud with an image.

Return values
Array.ErrorCodeThe error code:
  • 0 Success,
  • 1 Invalid input parameters,
  • 2 An error occurred.
Array.CloudColorized point cloud.
Parameters
[in]iCloudCloud to colorize.
[in]iImageImage to use.

◆ ConvertColorToTexture()

static Array STexturingUtil::ConvertColorToTexture ( SPoly  iPoly,
Number  iPixelsPerTriangle,
Boolean  iIsUpdateOnlyTriWithoutTexture 
)
static

Converts colors/inspections of a mesh into texture.

Note
The function will use the current representation to convert the color
See also
SPoly.SetPolyRepresentation()
Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Array.PolyThe textured mesh.
Parameters
[in]iPolyMesh to convert
[in]iPixelsPerTriangleNumber of pixels per triangle to create the texture value (between 4 and 32)
[in]iIsUpdateOnlyTriWithoutTextureIf true: updates only triangles that are not already textured

◆ ConvertTextureMapsToAtlas()

static Array STexturingUtil::ConvertTextureMapsToAtlas ( SPoly  iPoly)
static

Converts all the texture maps of a mesh into one (or several) texture atlas.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Array.PolyThe mesh with the texture atlas.
Parameters
[in]iPolyMesh to convert

◆ ExtractImageFromTexture()

static Array STexturingUtil::ExtractImageFromTexture ( SPoly  iPoly)
static

Converts dynamic textures from a mesh to scene images.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, success.
  • 1 Unknown Error.
Array.ImageTblThe images extracted from the texture.
Parameters
[in]iPolyMesh to extract texture from

◆ GetNumberOfTextureMaps()

static Number STexturingUtil::GetNumberOfTextureMaps ( SPoly  iPoly)
static

Returns the number of dynamic textures (texture maps) applied to the mesh.

Return values
Thenumber of textures
Parameters
[in]iPolyMesh to consider

◆ GetNumberOfTextures()

static Number STexturingUtil::GetNumberOfTextures ( SPoly  iPoly)
static

Returns the number of textures applied to the mesh.

Return values
Thenumber of textures
Parameters
[in]iPolyMesh to consider

◆ GetTextureName()

static Array STexturingUtil::GetTextureName ( SPoly  iPoly,
Number  iTextureIdx 
)
static

Returns the original name of a dynamic texture (texture map) applied to the mesh.

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 An error occurred.
Array.StringThe original texture name
Parameters
[in]iPolyMesh to consider
[in]iTextureIdxThe texture index

◆ RemoveTexture()

static Array STexturingUtil::RemoveTexture ( SPoly  ioPoly)
static

Removes all textures applied to the mesh.

Return values
Array.ErrorCodeThe error code.
  • 0 No error.
  • 1 The mesh does not have any texture to remove.
Array.ValueThe number of textures removed.
Parameters
[in,out]ioPolyMesh to consider

◆ TakeColorFromClouds()

static Array STexturingUtil::TakeColorFromClouds ( SPoly  iPoly,
Array< SCloud iCloudsTbl,
Number  iIgnoreOver,
Number  iResetColor,
Number  iDefaultRed,
Number  iDefaultGreen,
Number  iDefaultBlue 
)
static

Uses the color (or the color of inspection) of point clouds to color the vertices on the current mesh.

Note
For each vertex of the current mesh the color of the nearest point is used
If the expected colors are the inspection's colors, you need first to convert the inspection colors to 'simple' colors with the function SCloud.ConvertInspectionToColor() on each cloud
See also
STexturingUtil.TextureFromClouds to compute a textured mesh
Return values
Array.ErrorCodeThe error code.
  • 0 No error
  • 1 Warning, some of the point clouds have no color
  • 2 Error, an exception occurred.
Array.PolyThe colored mesh.
Parameters
[in]iPolyMesh to color using the clouds
[in]iCloudsTblTable of clouds containing the colors. Each of the cloud must have a colored information, else the cloud is not taken into account
[in]iIgnoreOverIf a point of the cloud has a distance to the current mesh greater than this value, it is ignored. The color of a point moves to a vertex only if the distance to the mesh is less than this value. If this value is zero or less, takes 1% of the mesh size.
[in]iResetColorWhen should we use the default color ?
  • 0 Do not reset previous color. DefaultRGB is used only if no color is associated with the vertex.
  • 1 Previous color (if any) is reseted with the default color if no point of the cloud can be used to define a new color.
[in]iDefaultRedRed color between [0-1] to be used for the non colored vertices
[in]iDefaultGreenGreen color between [0-1] to be used for the non colored vertices
[in]iDefaultBlueBlue color between [0-1] to be used for the non colored vertices

◆ TextureAddRepetitive()

static Array STexturingUtil::TextureAddRepetitive ( SPoly  iPoly,
String  iFilePathName,
Number  iNbRepWidth,
Number  iNbRepHeight,
SVector  iDirXScreen,
SVector  iDirYScreen,
SPoint  iImageOrigin 
)
static

Adds repetitive texture to a mesh.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe textured mesh.
Parameters
[in]iPolyMesh to texture
[in]iFilePathNamePath to the texture
[in]iNbRepWidthNumber of repetition in width of the screen
[in]iNbRepHeightNumber of repetition in height of the screen
[in]iDirXScreenDirection X of the projection plane
[in]iDirYScreenDirection Y of the projection plane
[in]iImageOriginOrigin of the image

◆ TextureFromClouds()

Array STexturingUtil::TextureFromClouds ( SPoly  iPoly,
Array< SCloud CloudTbl,
Number  iIgnoreOverInM,
Number  iDefaultRed,
Number  iDefaultGreen,
Number  iDefaultBlue,
Number  iPixelSize = 0.01,
Number  iExistingOption 
)

Uses the color (or the color of inspection) of point clouds to texture the current mesh.

Note
If the expected colors are the inspection's colors, you need first to convert the inspection colors to 'simple' colors with the function SCloud.ConvertInspectionToColor() on each cloud
See also
STexturingUtil.TakeColorFromClouds to compute a colored mesh
Return values
Array.ErrorCodeThe error code.
  • 0 No error
  • 1 Error, an exception occurred.
  • 2 Error, input clouds have no color.
Array.PolyThe textured mesh.
Parameters
[in]iPolyMesh to texture
[in]CloudTblTable of clouds containing the colors. Each of the cloud must have a colored information, else the cloud is not taken into account
[in]iIgnoreOverInMMaximum distance between mesh and points to apply the texture, in meter. If this value is zero or less, taking 1% of the mesh size.
[in]iDefaultRedRed color between [0-1] to be used for the not textured triangles
[in]iDefaultGreenGreen color between [0-1] to be used for the not textured triangles
[in]iDefaultBlueBlue color between [0-1] to be used for the not textured triangles
[in]iPixelSizeSize of a pixel
[in]iExistingOptionUsed if the mesh is already textured
  • 0 : overwrite existing texture
  • 1 : keep existing texture

◆ TextureMeshSmart()

static Array STexturingUtil::TextureMeshSmart ( SPoly  iPoly,
Array< SImage iImgTbl,
Number  iPixelSize = 0.01,
Number  iTextureSize,
Number  iExistingOption,
Array< SPoly iObstaclesTbl = Array< SPoly >() 
)
static

Textures a mesh with images, using the Smart Texture method.

Note
If some SImage have texture masks, they are used in this function to avoid texturing the mesh with inappropriate image areas.
Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe textured mesh.
Parameters
[in]iPolyMesh to texture
[in]iImgTblTable of images used for texturing
[in]iPixelSizeTarget pixel size, in file unit per pixel
[in]iTextureSizeThe final texture will have a maximum size of iTextureSize * iTextureSize pixels. A common value is 2048.
[in]iExistingOptionUsed if the mesh is already textured
  • 0 : overwrite existing texture
  • 1 : keep existing texture
[in]iObstaclesTblList of meshes to be considered as obstacles when selecting images to texture

◆ TextureMeshStandard()

static Array STexturingUtil::TextureMeshStandard ( SPoly  iPoly,
Array< SImage iImgTbl,
Number  iVisibilityOption,
Number  iImageOption,
Number  iExistingOption 
)
static

Textures a mesh with images.

Return values
Array.ErrorCodeThe error code:
  • 0 No error occurred.
  • 1 An error occurred.
Array.PolyThe textured mesh.
Parameters
[in]iPolyMesh to texture
[in]iImgTblTable of images used for texturing
[in]iVisibilityOptionTriangles that will be textured
  • 0 : include invisible parts
  • 1 : texture triangles with at least one visible vertex
  • 2 : texture only fully visible triangles
[in]iImageOptionUsed if iImgTbl contains more than 1 image
  • 0 : choose the image in which the projected triangle is the biggest
  • 1 : the same image is used to texture a large group of neighboring triangles
[in]iExistingOptionUsed if the mesh is already textured
  • 0 : overwrite existing texture
  • 1 : keep existing texture