artofillusion.texture
Class Nonlinear2DTriangle

java.lang.Object
  extended by artofillusion.RenderingTriangle
      extended by artofillusion.texture.Nonlinear2DTriangle
All Implemented Interfaces:
java.lang.Cloneable

public class Nonlinear2DTriangle
extends RenderingTriangle

Nonlinear2DTriangle is a subclass of RenderingTriangle, which represents a triangle whose properties are defined by a nonlinear mapping of a Texture2D. It stores a 3D "intermediate texture coordinate" for each vertex. To find the surface properties at a given point, it linearly interpolates to find the intermediate texture coordinate at that point, then calls the NonlinearMapping2D object to determine the final 2D texture coordinate and get the surface spec.


Field Summary
 
Fields inherited from class artofillusion.RenderingTriangle
index, n1, n2, n3, theMesh, v1, v2, v3
 
Constructor Summary
Nonlinear2DTriangle(int v1, int v2, int v3, int n1, int n2, int n3, Vec3 t1, Vec3 t2, Vec3 t3)
           
 
Method Summary
 double getDisplacement(double u, double v, double w, double size, double t)
          Get the displacement for a point on the triangle.
 void getTextureSpec(TextureSpec spec, double angle, double u, double v, double w, double size, double t)
          Given the barycentric coordinates for a point in the triangle, build a TextureSpec describing the properties of the triangle at that point.
 void getTransparency(RGBColor trans, double angle, double u, double v, double w, double size, double t)
          Same as above, except only return the transparent color.
 void setMesh(RenderingMesh mesh, TextureMapping map, int index)
          Set the mesh that this triangle is part of.
 void setParameters(double[] p1, double[] p2, double[] p3, RenderingMesh mesh)
           
 
Methods inherited from class artofillusion.RenderingTriangle
clone, getParameters, getTextureMapping
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Nonlinear2DTriangle

public Nonlinear2DTriangle(int v1,
                           int v2,
                           int v3,
                           int n1,
                           int n2,
                           int n3,
                           Vec3 t1,
                           Vec3 t2,
                           Vec3 t3)
Method Detail

setParameters

public void setParameters(double[] p1,
                          double[] p2,
                          double[] p3,
                          RenderingMesh mesh)

setMesh

public void setMesh(RenderingMesh mesh,
                    TextureMapping map,
                    int index)
Set the mesh that this triangle is part of. This is automatically called when the triangle is added to the mesh.

Overrides:
setMesh in class RenderingTriangle
Parameters:
mesh - the RenderingMesh this triangle belongs to
map - the TextureMapping for this triangle
index - the index of this triangle within the mesh

getTextureSpec

public void getTextureSpec(TextureSpec spec,
                           double angle,
                           double u,
                           double v,
                           double w,
                           double size,
                           double t)
Description copied from class: RenderingTriangle
Given the barycentric coordinates for a point in the triangle, build a TextureSpec describing the properties of the triangle at that point. The properties should be averaged over a region of width size.

Specified by:
getTextureSpec in class RenderingTriangle

getTransparency

public void getTransparency(RGBColor trans,
                            double angle,
                            double u,
                            double v,
                            double w,
                            double size,
                            double t)
Description copied from class: RenderingTriangle
Same as above, except only return the transparent color. This can save time in cases where only the transparency is required, for example, when tracing shadow rays.

Specified by:
getTransparency in class RenderingTriangle

getDisplacement

public double getDisplacement(double u,
                              double v,
                              double w,
                              double size,
                              double t)
Description copied from class: RenderingTriangle
Get the displacement for a point on the triangle.

Specified by:
getDisplacement in class RenderingTriangle


Copyright © 1999-2011 by Peter Eastman.