Class: Face

Raphael3d. Face

represents face composed of vertices connected by edges

new Face(vertices, paper, attrs, edgeAttrs)

Face implementation (the assumption is that face is planar)
This:
Parameters:
Name Type Argument Description
vertices Array.<Raphael3d.Vertex> array of vertices of the face
paper Raphael.Paper <optional>
raphael paper instance
attrs Object <optional>
attrs passed to paper.path.attr
edgeAttrs Object <optional>
passed to edge.path.attr
Properties:
Name Type Description
vertices Array.<Raphael3d.Vertex> array of vertices of the face
edges Array.<Raphael3d.Edge> array of edges connecting face's vertices
path Raphael.el paper.path instance
material Raphael3d.Material material of receiver
normal Raphael3d.Vector3 real normal vector
projectedNormal Raphael3d.Vector3 projected normal vector
actual string color of the face
transparency number transparency of receiver (from 0 to 1)
isDoubleSided boolean if receiver is double sided. If yes, it is rendered always, if not, only whan projectedNormal has positive z cordinate
aabb Raphael3d.AABB receiver's axis aligned bounding box
aabbProjected Raphael3d.AABB aabb of receiver's projection
coveredByList Array list of objects receiver is covered by (defined by the user)
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1153

Methods

<static> create(vertices, paper, attrs, edgeAttrs) → {Raphael3d.Face}

Create new Face object, see Raphael3d.Face for arguments
Parameters:
Name Type Argument Description
vertices Array.<Raphael3d.Vertex>
paper Raphael.Paper <optional>
attrs Object <optional>
edgeAttrs Object <optional>
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1186
Returns:
new Face objects
Type
Raphael3d.Face

computeNormal() → {Raphael3d.Vector3}

Computes and updates normal of the receiver
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1247
Returns:
updated normal
Type
Raphael3d.Vector3

computeProjectedNormal() → {Raphael3d.Vector3}

Computes and updates projected normal of the receiver
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1260
Returns:
updated normal
Type
Raphael3d.Vector3

isCoveredBy(b) → {boolean}

Checks if receiver is covered by given object (i.e. if the given object is present in initially empty coveredByList attribute, filled by the user)
Parameters:
Name Type Description
b Raphael3d.Edge | Raphael3d.Face | Raphael3d.Surface given object
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1351
Returns:
true if receiver is covered by given object, false otherwise
Type
boolean

isProjectedZParallel() → {boolean}

Checks if projection of receiver is parallel to z axis
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1193
Returns:
Type
boolean

project(m) → {Raphael3d.Face}

Project receiver (i.e. updates projected coordinates of vertices) according to given matrix
Parameters:
Name Type Description
m Raphael3d.Matrix4x4 projection matrix
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1295
Returns:
receiver
Type
Raphael3d.Face

projectionContainsCoords(x, y) → {boolean}

Checks if projection of receiver contains given xy coordinates
Parameters:
Name Type Description
x number x coordinate to test
y number y coordinate to test
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1360
Returns:
Type
boolean

projectionContainsVertex(v) → {boolean}

Checks if projection of receiver contains projection if given vertex
Parameters:
Name Type Description
v Raphael3d.Vertex given vertex
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1385
Returns:
Type
boolean

render()

Renders receiver (update paper.path)
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1217

setMaterial(material) → {Raphael3d.Face}

Sets new material to the receiver
Parameters:
Name Type Description
material Raphael3d.Material new material
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1274
Returns:
receiver
Type
Raphael3d.Face

transform(m) → {Raphael3d.Face}

Transforms receiver (i.e. updates real coordinates of vertices) according to given matrix
Parameters:
Name Type Description
m Raphael3d.Matrix4x4 transformation matrix
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1283
Returns:
receiver
Type
Raphael3d.Face

update(material)

Updates receiver = update edges, computes normal, projectedNormal, sets color, isBackFace attributes
Parameters:
Name Type Argument Description
material Raphael3d.Material <optional>
material for color computations
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1200

updateAABB()

Updates AABB (axis aligned bounding box) of the receiver
Source:
  • /var/www/html/software/raphael3d/raphael3d.src.js, line 1306