Standard
Class Standard_MappingShapePlane

Object
  extended by common:Generic
      extended by common:MappingShape
          extended by Standard:Standard_MappingShapePlane

class 
MappingShape:Standard_MappingShapePlane

Implements the Plane shape from 3D Mapping in Standard.uxf.


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_MappingShapePlane(common.ulb:MappingShape) {
 ; Implements the Plane shape from 3D Mapping in Standard.uxf.
 public:
   bool func GetTextureCoordinates(float sx, float sy, float sz, float dx, \
                                   float dy, float dz, complex &result)
     ; This equation must be solved:
     ; [ sx ]          [ dx ]   [ u ]
     ; [ sy ] + lambda [ dy ] = [ 0 ]
     ; [ sz ]          [ dz ]   [ v ]
     ; where (u,v) are the texture coordinates to return.
 
     float lambda = -sy / dy
     if lambda <= 0
       ; The line does not intersect the plane.
       return false
     else
       ; Calculate intersection point.
       result = sx + lambda * dx + flip(sz + lambda * dz)
       return true
     endif
   endfunc
 
 default:
   title = "Plane"
 }
 


Constructor Summary
Standard_MappingShapePlane()
           
 
Method Summary
 boolean GetTextureCoordinates(float sx, float sy, float sz, float dx, float dy, float dz, complex result)
          GetTextureCoordinates tests a ray against the mapping shape.
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Standard_MappingShapePlane

public Standard_MappingShapePlane()
Method Detail

GetTextureCoordinates

public boolean GetTextureCoordinates(float sx,
                                     float sy,
                                     float sz,
                                     float dx,
                                     float dy,
                                     float dz,
                                     complex result)
Description copied from class: MappingShape
GetTextureCoordinates tests a ray against the mapping shape. If the ray intersects the shape, it returns true, and returns the coordinates of the point on the shape that intersects the ray in the result argument. If the shape does not intersect the ray, returns false.

A concrete shape descendant should override this function to define the mapping shape.

The ray is defined as:
[ sx ] [ dx ]
[ sy ] + lambda [ dy ]
[ sz ] [ dz ]

Overrides:
GetTextureCoordinates in class MappingShape
Parameters:
sx - X coordinate of point in space that the ray passes through.
sy - Y coordinate of point in space that the ray passes through.
sz - Z coordinate of point in space that the ray passes through.
dx - Relative movement of the line along the X axis.
dy - Relative movement of the line along the Y axis.
dz - Relative movement of the line along the Z axis.
result - Receives the texture coordinates if the function returns true.
Returns:
True if the ray intersects the shape, false otherwise.