Most visited

Recently visited

Polygon

public class Polygon
extends Geometry

java.lang.Object
   ↳ com.viro.core.Geometry
     ↳ com.viro.core.Polygon


Polygon represents a one-sided plane whose boundary is defined by a list of vertices.

Summary

Public constructors

Polygon(List<Vector> vertices, float u0, float v0, float u1, float v1)

Construct a flat polygon with the given perimeter.

Polygon(List<Vector> vertices, List<List<Vector>> holes, float u0, float v0, float u1, float v1)

Construct a flat polygon with the given perimeter and holes.

Public methods

void dispose()

Release native resources associated with this Polygon.

Public constructors

Polygon

Polygon (List<Vector> vertices, 
                float u0, 
                float v0, 
                float u1, 
                float v1)

Construct a flat polygon with the given perimeter. The perimeter is specified as a list of 2D points on the XY plane. Both convex and concave polygonal shapes are supported.

Texture coordinates are represented on 2D U and V axes (essentially the X and Y axes of the texture). The left edge of the texture is U = 0.0 and the right edge of the texture is U = 1.0. Similarly, the top edge of a texture is V = 0.0 and the bottom edge of the texture is V = 1.0.

Specifying greater than 1.0 on either the U or V axis will cause the texture to either tile and repeat itself or clamp, depending on the Texture's setWrapS(Texture.WrapMode). Specifying less than 1.0 on the U or V axis will render that texture partially over the surface.

For example, specifying u0,v0 as (0,0) and (u1,v2) as (2,2) will tile the Texture twice over the width and height of the polygon, effectively displaying 4 textures on the polygon. Alternatively, setting (u1,v1) as (0.5, 0.5) will display a quarter of the texture over the polygon.

Parameters
vertices List: The list of boundary vertex positions in local model space.

u0 float: The texture coordinate that specifies the start Texture left edge.

v0 float: The texture coordinate that specifies the start Texture top edge.

u1 float: The texture coordinate that specifies the end Texture left edge.

v1 float: The texture coordinate that specifies the end Texture top edge.

Polygon

Polygon (List<Vector> vertices, 
                List<List<Vector>> holes, 
                float u0, 
                float v0, 
                float u1, 
                float v1)

Construct a flat polygon with the given perimeter and holes. The perimeter is specified as a list of 2D points on the XY plane, and the holes are each similarly represented as a list of 2D points. Both convex and concave polygonal shapes are supported.

Texture coordinates are represented on 2D U and V axes (essentially the X and Y axes of the texture). The left edge of the texture is U = 0.0 and the right edge of the texture is U = 1.0. Similarly, the top edge of a texture is V = 0.0 and the bottom edge of the texture is V = 1.0.

Specifying greater than 1.0 on either the U or V axis will cause the texture to either tile and repeat itself or clamp, depending on the Texture's setWrapS(Texture.WrapMode). Specifying less than 1.0 on the U or V axis will render that texture partially over the surface.

For example, specifying u0,v0 as (0,0) and (u1,v2) as (2,2) will tile the Texture twice over the width and height of the polygon, effectively displaying 4 textures on the polygon. Alternatively, setting (u1,v1) as (0.5, 0.5) will display a quarter of the texture over the polygon.

Parameters
vertices List: The list of boundary (perimeter) vertex positions in local model space.

holes List: The boundary of each hole in the polygon. Each hole is given as a separate List of Vectors.

u0 float: The texture coordinate that specifies the start Texture left edge.

v0 float: The texture coordinate that specifies the start Texture top edge.

u1 float: The texture coordinate that specifies the end Texture left edge.

v1 float: The texture coordinate that specifies the end Texture top edge.

Public methods

dispose

void dispose ()

Release native resources associated with this Polygon.

Hooray!