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

Provide various SPoly texturing manipulation methods. More...

Functions

Object ColorizeCloudFromImage (SCloud cloud, SImage image)
 Colorize a SCloud with a SImage. More...
 
Object ConvertColorToTexture (SPoly meshToTexture, number pixelsPerTriangle, boolean isUpdateOnlyTriWithoutTexture=false)
 Convert colors/inspections of a SPoly into texture. More...
 
Object ConvertInspectionToTexture (SPoly poly, number textureWidth=4096)
 Convert inspection to texture on a SPoly. More...
 
Object ConvertTextureMapsToAtlas (SPoly poly)
 Convert all the texture maps of a SPoly into one (or several) texture atlas. More...
 
Object ExtractImageFromTexture (SPoly poly)
 Convert dynamic textures from a SPoly to scene SImage. More...
 
number GetNumberOfTextureMaps (SPoly poly)
 Return the number of dynamic textures (texture maps) applied to the SPoly. More...
 
number GetNumberOfTextures (SPoly poly)
 Return the number of textures applied to the SPoly. More...
 
Object GetTextureName (SPoly poly, number textureIdx)
 Return the original name of a dynamic texture (texture map) applied to a SPoly. More...
 
Object RemoveTexture (SPoly poly)
 Remove all textures applied to the SPoly. More...
 
Object TakeColorFromClouds (SPoly meshToColor, Array< SCloud > cloudsTable, number ignoreOver, number resetColor, number defaultRed, number defaultGreen, number defaultBlue)
 Use the color (or the color of inspection) of SCloud to color the vertices on the current SPoly. More...
 
Object TextureAddRepetitive (SPoly meshToTexture, string filePathName, number nbRepWidth, number nbRepHeight, SVector dirXScreen, SVector dirYScreen, SPoint imageOrigin)
 Add repetitive texture to a SPoly. More...
 
Object TextureFromClouds (SPoly meshToTexture, Array< SCloud > cloudsTable, number ignoreOverInM, number defaultRed, number defaultGreen, number defaultBlue, number pixelSize=0.01, number existingOption=0)
 Use the color (or the color of inspection) of SCloud to texture the current SPoly. More...
 
Object TextureMeshSmart (SPoly meshToTexture, Array< SImage > imagesTable, number pixelSize=0.01, number textureSize=4096, number existingOption=0, Array< SPoly > obstaclesTbl=[], boolean considerTrianglesOrientation=false)
 Texture a SPoly with SImage, using the Smart Texture method. More...
 
Object TextureMeshStandard (SPoly meshToTexture, Array< SImage > imagesTable, number visibilityOption, number imageOption, number existingOption=0)
 Texture a SPoly with SImage. More...
 

Detailed Description

Provide various SPoly texturing manipulation methods.

Function Documentation

◆ ColorizeCloudFromImage()

Object STexturingUtil::ColorizeCloudFromImage ( SCloud  cloud,
SImage  image 
)

Colorize a SCloud with a SImage.

License
This function requires the license Survey.
Parameters
cloud(SCloud) The SCloud to colorize
image(SImage) The SImage to use
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: Invalid input parameters
  • 2: An error occurred
ret.Cloud(SCloud) The colorized SCloud

◆ ConvertColorToTexture()

Object STexturingUtil::ConvertColorToTexture ( SPoly  meshToTexture,
number  pixelsPerTriangle,
boolean  isUpdateOnlyTriWithoutTexture = false 
)

Convert colors/inspections of a SPoly into texture.

License
This function requires the license Survey.
Note
The function will use the current representation to convert the color
Deprecated:
This function is deprecated. Use STexturing.ConvertInspectionToTexture() instead.
See also
SPoly.SetPolyRepresentation()
Parameters
meshToTexture(SPoly) The SPoly to texture
pixelsPerTriangle(number) The number of pixels per triangle to create the texture value (between 4 and 32)
isUpdateOnlyTriWithoutTexture(boolean) Should the triangles that are not already textured be the only ones updated?
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The textured SPoly

◆ ConvertInspectionToTexture()

Object STexturingUtil::ConvertInspectionToTexture ( SPoly  poly,
number  textureWidth = 4096 
)

Convert inspection to texture on a SPoly.

License
This function requires the license Survey.
Parameters
poly(SPoly) The SPoly to texture from its inspection
textureWidth(number) Number of colors for the texture. Default value: 4096
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The textured SPoly

◆ ConvertTextureMapsToAtlas()

Object STexturingUtil::ConvertTextureMapsToAtlas ( SPoly  poly)

Convert all the texture maps of a SPoly into one (or several) texture atlas.

License
This function requires the license Survey.
Parameters
poly(SPoly) The SPoly to convert
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The SPoly with the texture atlas

◆ ExtractImageFromTexture()

Object STexturingUtil::ExtractImageFromTexture ( SPoly  poly)

Convert dynamic textures from a SPoly to scene SImage.

License
This function requires the license Survey.
Parameters
poly(SPoly) The SPoly to extract textures from
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.ImageTbl(Array<SImage>) The SImage extracted from the texture

◆ GetNumberOfTextureMaps()

number STexturingUtil::GetNumberOfTextureMaps ( SPoly  poly)

Return the number of dynamic textures (texture maps) applied to the SPoly.

Parameters
poly(SPoly) The SPoly to consider
Returns
(number) The number of textures

◆ GetNumberOfTextures()

number STexturingUtil::GetNumberOfTextures ( SPoly  poly)

Return the number of textures applied to the SPoly.

Parameters
poly(SPoly) The SPoly to consider
Returns
(number) The number of textures

◆ GetTextureName()

Object STexturingUtil::GetTextureName ( SPoly  poly,
number  textureIdx 
)

Return the original name of a dynamic texture (texture map) applied to a SPoly.

Parameters
poly(SPoly) The SPoly to consider
textureIdx(number) The texture index
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.String(string) The original texture name

◆ RemoveTexture()

Object STexturingUtil::RemoveTexture ( SPoly  poly)

Remove all textures applied to the SPoly.

License
This function requires the license Survey.
Parameters
poly(SPoly) The SPoly to consider
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: The SPoly does not have any texture to remove
ret.Value(number) The number of removed textures

◆ TakeColorFromClouds()

Object STexturingUtil::TakeColorFromClouds ( SPoly  meshToColor,
Array< SCloud cloudsTable,
number  ignoreOver,
number  resetColor,
number  defaultRed,
number  defaultGreen,
number  defaultBlue 
)

Use the color (or the color of inspection) of SCloud to color the vertices on the current SPoly.

Note
For each vertex of the current SPoly 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 SCloud
Deprecated:
This function is deprecated. Use STexturing.TextureFromClouds() instead.
Parameters
meshToColor(SPoly) The SPoly to color using the SCloud
cloudsTable(Array<SCloud>) The table of SCloud containing the colors. Each of the SCloud must have a colored information, else the SCloud is not taken into account
ignoreOver(number) If a point of the SCloud has a distance to the current SPoly greater than this value, it is ignored. The color of a point moves to a vertex only if the distance to the SPoly is less than this value. If this value is zero or less, takes 1% of the SPoly size
resetColor(number) When 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 SCloud can be used to define a new color.
defaultRed(number) The red color (between 0 and 1) to be used for the non colored vertices
defaultGreen(number) The green color (between 0 and 1) to be used for the non colored vertices
defaultBlue(number) The blue color (between 0 and 1) to be used for the non colored vertices
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: Warning, some of the point clouds have no color
  • 2: An error occurred
ret.Poly(SPoly) The colored SPoly

◆ TextureAddRepetitive()

Object STexturingUtil::TextureAddRepetitive ( SPoly  meshToTexture,
string  filePathName,
number  nbRepWidth,
number  nbRepHeight,
SVector  dirXScreen,
SVector  dirYScreen,
SPoint  imageOrigin 
)

Add repetitive texture to a SPoly.

License
This function requires the license Survey.
Parameters
meshToTexture(SPoly) The SPoly to texture
filePathName(string) The path to the texture
nbRepWidth(number) The number of repetitions in width of the screen
nbRepHeight(number) The number of repetitions in height of the screen
dirXScreen(SVector) The X direction of the projection plane
dirYScreen(SVector) The Y direction of the projection plane
imageOrigin(SPoint) The origin of the SImage
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The textured SPoly

◆ TextureFromClouds()

Object STexturingUtil::TextureFromClouds ( SPoly  meshToTexture,
Array< SCloud cloudsTable,
number  ignoreOverInM,
number  defaultRed,
number  defaultGreen,
number  defaultBlue,
number  pixelSize = 0.01,
number  existingOption = 0 
)

Use the color (or the color of inspection) of SCloud to texture the current SPoly.

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 SCloud
Parameters
meshToTexture(SPoly) The SPoly to texture
cloudsTable(Array<SCloud>) The table of SCloud containing the colors. Each of the SCloud must have a colored information, else the cloud is not taken into account
ignoreOverInM(number) The maximum distance between SPoly and points to apply the texture, in meter. If this value is zero or less, taking 1% of the SPoly size.
defaultRed(number) The red color (between 0 and 1) to be used for the triangles that are not textured
defaultGreen(number) The green color (between 0 and 1) to be used for the triangles that are not textured
defaultBlue(number) The blue color (between 0 and 1) to be used for the triangles that are not textured
pixelSize(number) The size of a pixel
existingOption(number) Used if the SPoly is already textured
  • 0: Overwrite existing texture
  • 1: Keep existing texture
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
  • 2: Error, the input SCloud have no color.
ret.Poly(SPoly) The textured SPoly

◆ TextureMeshSmart()

Object STexturingUtil::TextureMeshSmart ( SPoly  meshToTexture,
Array< SImage imagesTable,
number  pixelSize = 0.01,
number  textureSize = 4096,
number  existingOption = 0,
Array< SPoly obstaclesTbl = [],
boolean  considerTrianglesOrientation = false 
)

Texture a SPoly with SImage, using the Smart Texture method.

License
This function requires the license Survey.
Parameters
meshToTexture(SPoly) The SPoly to texture
imagesTable(Array<SImage>) The table of SImage used for texturing
pixelSize(number) The target pixel size, in file unit per pixel
textureSize(number) The final texture will have a maximum size of iTextureSize * iTextureSize pixels. A common value is 2048.
existingOption(number) Used if the SPoly is already textured
  • 0: Overwrite existing texture
  • 1: Keep existing texture
obstaclesTbl(Array<SPoly>) A list of SPoly to be considered as obstacles when selecting SImage to texture
considerTrianglesOrientation(boolean) If checked, a triangle can be textured only by an image facing it. Otherwise, any image may be selected
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The textured SPoly

◆ TextureMeshStandard()

Object STexturingUtil::TextureMeshStandard ( SPoly  meshToTexture,
Array< SImage imagesTable,
number  visibilityOption,
number  imageOption,
number  existingOption = 0 
)

Texture a SPoly with SImage.

License
This function requires the license Survey.
Parameters
meshToTexture(SPoly) The SPoly to texture
imagesTable(Array<SImage>) The table of SImage used for texturing
visibilityOption(number) Triangles that will be textured
  • 0: Include invisible parts
  • 1: Texture triangles with at least one visible vertex
  • 2: Texture only fully visible triangles
imageOption(number) Used if imagesTable contains more than one SImage
  • 0: Choose the SImage in which the projected triangle is the biggest
  • 1: The same SImage is used to texture a large group of neighboring triangles
existingOption(number) Used if the SPoly is already textured
  • 0: Overwrite existing texture
  • 1: Keep existing texture
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The textured SPoly