Texture

Textures are images that exist in space and are mapped to their corresponding elements. Unlike data, they do not need to correspond to mesh nodes or cell centers. This image shows how textures are mapped to a surface. Their position is defined by an origin and axis vectors then they are mapped laterally to the element position.

../_images/ImageTexture.png

Like data, multiple textures can be applied to a element; simply provide a list of textures. Each of these textures provides an origin point and two extent vectors for the plane defining where images rests. The axis_* properties define the extent of that image out from the origin. Given a rectangular PNG image, the origin is the bottom left, origin + axis_u is the bottom right, and origin + axis_v is the top left. This allows the image to be rotated and/or skewed. These values are independent of the corresponding Surface; in fact, there is nothing requiring the image to actually align with the Surface.

>> ...
>> my_surface = omf.SurfaceElement(...)
>> ...
>> my_tex_1 = omf.ImageTexture(
       origin=[0.0, 0.0, 0.0],
       axis_u=[1.0, 0.0, 0.0],
       axis_v=[0.0, 1.0, 0.0],
       image='image1.png'
   )
>> my_tex_2 = omf.ImageTexture(
       origin=[0.0, 0.0, 0.0],
       axis_u=[1.0, 0.0, 0.0],
       axis_v=[0.0, 0.0, 1.0],
       image='image2.png'
   )
>> my_surface.textures = [
       my_tex_1,
       my_tex_2
   ]
class omf.texture.ImageTexture(**kwargs)[source]

Contains an image that can be mapped to a point set or surface

Required Properties:

  • axis_u (Vector3): Vector corresponding to the image x-axis, a 3D Vector of <type ‘float’> with shape (3), Default: X
  • axis_v (Vector3): Vector corresponding to the image y-axis, a 3D Vector of <type ‘float’> with shape (3), Default: Y
  • description (String): Description, a unicode string
  • image (ImagePNG): PNG image file, a PNG image file, valid modes include (u’ab+’, u’rb+’, u’wb+’, u’rb’)
  • name (String): Title, a unicode string
  • origin (Vector3): Origin point of the texture, a 3D Vector of <type ‘float’> with shape (3), Default: [0.0, 0.0, 0.0]

Other Properties:

  • date_created (GettableProperty): Date project was created
  • date_modified (GettableProperty): Date project was modified
  • uid (Uuid): Unique identifier, a unique ID auto-generated with uuid.uuid4()