anar

Class Face

java.lang.Object
  extended by anar.Parametric
      extended by anar.Pts
          extended by anar.Face
All Implemented Interfaces:
iTaggable, iTransformable
Direct Known Subclasses:
Circle, Ellipse, FatCross, Rect, Star

public class Face
extends Pts

The face class extends Pts (list of points) to include renders that close the line and fill it. If the points are not on the same plane, the face will be triangulated according to PGraphic. This introduces uncontrolled creases, and may appear random with numerous points.


Field Summary
static Render globalRender
           
 Render render
           
 
Fields inherited from class anar.Pts
meta, ptList
 
Constructor Summary
Face()
          empty constructor.
Face(Face faceIn, Transform transform)
           
Face(Pt... pts)
           
Face(Pts ptsIn)
          creates a face from a list of point
Face(Pts ptsIn, Transform transform)
          creates a face from a list of points and add a linear transformation to change their positions
 
Method Summary
 Face add(float x, float y)
           
 Face add(float x, float y, float z)
           
 Face add(int index, Pt p)
           
 Face add(int index, Pts pts)
           
 Face add(Pt... pts)
           
 Face add(Pt p)
           
 Face add(Pts pts)
           
 Face apply(Transform t)
           
 Pt center()
          Return the center of a face.
 Face copy()
           
 void draw()
           
 Face fill(AColor color)
          change the filling of the face from a OogColor scheme
 Face fill(float grey)
          change the filling of the face
 Face fill(float grey, float alpha)
          change the filling of the face
 Face fill(float red, float green, float blue)
          change the filling of the face
 Face fill(float red, float green, float blue, float alpha)
          change the filling of the face
 Face fill(RenderFace render)
          change the render of the face
 Face fillP5(int colorP5)
          change the filling of the face from a P5 color scheme
 boolean isInside(XYZ p)
          Test if a point is inside a face
 java.lang.Boolean isPlanar()
          Test if a polygon is planar.
 Obj lazyTriangulation()
          performs a straightforward triangulation on the face
 Pt normal()
          return a normal to the face (centered at the origin)
 Pt normal(float size)
           
 Face orphaned()
          Export the geometry without any Parametric features.
 Face render(RenderFace render)
          Change the render for this object.
 Face rotateX(float v)
           
 Face rotateX(Param v)
           
 Face rotateY(float v)
           
 Face rotateY(Param v)
           
 Face rotateZ(float v)
           
 Face rotateZ(Param v)
           
 Face scale(float x)
           
 Face scale(float x, float y)
           
 Face scale(float x, float y, float z)
           
 Face scale(Param x)
           
 Face scale(Param x, Param y)
           
 Face scale(Param x, Param y, Param z)
           
 Face scale(Pt p)
           
 Face scale(XYZ vector)
           
 Face scaleX(float x)
           
 Face scaleX(Param x)
           
 Face scaleY(float y)
           
 Face scaleY(Param y)
           
 Face scaleZ(float z)
           
 Face scaleZ(Param z)
           
 Face stroke(AColor c)
           
 Face stroke(float g)
           
 Face stroke(float g, float a)
           
 Face stroke(float r, float g, float b)
           
 Face stroke(float r, float g, float b, float a)
           
 java.lang.String toANSYS()
           
 java.lang.String toAutocad()
          Example Output:
 java.lang.String toObjExporter()
           
 java.lang.String toObjExporter(java.lang.String name)
           
 java.lang.String toPovRay()
          Export a face to PovRAY Output example:
 java.lang.String toRadiance()
          Export a face to Radiance Output example:
 java.lang.String toRhino()
           
 java.lang.String toRhinoAsObject()
          Export a face to Rhino Output example:
 java.lang.String toSketchUp()
          Export a face to SketchUP Output example:
 Face translate(float x, float y)
           
 Face translate(float x, float y, float z)
           
 Face translate(Param x, Param y)
           
 Face translate(Param x, Param y, Param z)
           
 Face translate(Pt p)
           
 Face translate(XYZ vector)
           
 Face translateX(float x)
           
 Face translateX(Param x)
           
 Face translateY(float y)
           
 Face translateY(Param y)
           
 Face translateZ(float z)
           
 Face translateZ(Param z)
           
 Obj triangulate()
          Triangulation algorithm based on Delaunay triangulation.
 
Methods inherited from class anar.Pts
add, addPointsFrom, area, area, bound, boundCenter, color, color, color, color, color, discretization, drawPoints, flip, get, getPt, inLine, iterator, length, numOfPts, pt, ptEnd, ptEnd, ptMod, ptOnCurve, remove, remove, render, render, reverse, set, set, setMeta, size, tag, tag, toMegaPOVLink, toPovRayAsArray, toPovRayAsCylinder, toRadianceAsCylinder, toString
 
Methods inherited from class anar.Parametric
child, getMeta, getPrimitive, parent, parent, parentList, parentList, parentList, parentListGraphViz, parentListGraphViz, parentListRecursive, parentListRecursiveGraphViz, parentToString, parentToStringRecursive, parentToStringRecursive, primitiveToString, replaceParent, replaceParent, replicate, tag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

globalRender

public static Render globalRender

render

public Render render
Constructor Detail

Face

public Face()
empty constructor. only initialises the face.


Face

public Face(Pts ptsIn)
creates a face from a list of point

Parameters:
ptsIn: - list of points.

Face

public Face(Pts ptsIn,
            Transform transform)
creates a face from a list of points and add a linear transformation to change their positions

Parameters:
ptsIn: - list of points
transform: - linear transformation applied on the list of points

Face

public Face(Face faceIn,
            Transform transform)

Face

public Face(Pt... pts)
Method Detail

draw

public void draw()
Overrides:
draw in class Pts

lazyTriangulation

public Obj lazyTriangulation()
performs a straightforward triangulation on the face

Returns:
a set of triangle in an Obj object

fill

public Face fill(float grey)
change the filling of the face

Parameters:
grey: - grey value from 0 to 1.0

fill

public Face fill(float grey,
                 float alpha)
change the filling of the face

Parameters:
grey: - grey value from 0 to 1.0
alpha: - transparency value from 0 to 1.0

fill

public Face fill(float red,
                 float green,
                 float blue)
change the filling of the face

Parameters:
red: - red value from 0 to 1.0
green: - green value from 0 to 1.0
blue: - blue value from 0 to 1.0

fill

public Face fill(float red,
                 float green,
                 float blue,
                 float alpha)
change the filling of the face

Parameters:
red: - red value from 0 to 1.0
green: - green value from 0 to 1.0
blue: - blue value from 0 to 1.0
alpha: - transparency value from 0 to 1.0

fillP5

public Face fillP5(int colorP5)
change the filling of the face from a P5 color scheme

Parameters:
colorP5: - color definition in P5

fill

public Face fill(AColor color)
change the filling of the face from a OogColor scheme

Parameters:
color: - color definition in OOG

fill

public Face fill(RenderFace render)
change the render of the face

Parameters:
render: - face rendering scheme

stroke

public Face stroke(float g)
Overrides:
stroke in class Pts

stroke

public Face stroke(float g,
                   float a)
Overrides:
stroke in class Pts

stroke

public Face stroke(float r,
                   float g,
                   float b)
Overrides:
stroke in class Pts

stroke

public Face stroke(float r,
                   float g,
                   float b,
                   float a)
Overrides:
stroke in class Pts

stroke

public Face stroke(AColor c)
Overrides:
stroke in class Pts

render

public Face render(RenderFace render)
Change the render for this object.

Parameters:
render -
Returns:

orphaned

public Face orphaned()
Export the geometry without any Parametric features. The geometry becomes static and loose all dynamic relationships between objects. Become all Pt derived or linked to antoher becomes x y z, Faces and Pts are set of static points.

Overrides:
orphaned in class Pts

add

public Face add(float x,
                float y,
                float z)
Overrides:
add in class Pts

add

public Face add(float x,
                float y)
Overrides:
add in class Pts

add

public Face add(int index,
                Pt p)
Overrides:
add in class Pts

add

public Face add(int index,
                Pts pts)
Overrides:
add in class Pts

add

public Face add(Pt p)
Overrides:
add in class Pts

add

public Face add(Pt... pts)
Overrides:
add in class Pts

add

public Face add(Pts pts)
Overrides:
add in class Pts

rotateX

public Face rotateX(float v)
Overrides:
rotateX in class Pts

rotateX

public Face rotateX(Param v)
Overrides:
rotateX in class Pts

rotateY

public Face rotateY(float v)
Overrides:
rotateY in class Pts

rotateY

public Face rotateY(Param v)
Overrides:
rotateY in class Pts

rotateZ

public Face rotateZ(float v)
Overrides:
rotateZ in class Pts

rotateZ

public Face rotateZ(Param v)
Overrides:
rotateZ in class Pts

scale

public Face scale(float x,
                  float y,
                  float z)
Overrides:
scale in class Pts

scale

public Face scale(float x,
                  float y)
Overrides:
scale in class Pts

scale

public Face scale(float x)
Overrides:
scale in class Pts

scale

public Face scale(Param x,
                  Param y,
                  Param z)
Overrides:
scale in class Pts

scale

public Face scale(Param x,
                  Param y)
Overrides:
scale in class Pts

scale

public Face scale(Param x)
Overrides:
scale in class Pts

scale

public Face scale(Pt p)
Overrides:
scale in class Pts

scale

public Face scale(XYZ vector)
Overrides:
scale in class Pts

scaleX

public Face scaleX(float x)
Overrides:
scaleX in class Pts

scaleX

public Face scaleX(Param x)
Overrides:
scaleX in class Pts

scaleY

public Face scaleY(float y)
Overrides:
scaleY in class Pts

scaleY

public Face scaleY(Param y)
Overrides:
scaleY in class Pts

scaleZ

public Face scaleZ(float z)
Overrides:
scaleZ in class Pts

scaleZ

public Face scaleZ(Param z)
Overrides:
scaleZ in class Pts

translate

public Face translate(float x,
                      float y,
                      float z)
Overrides:
translate in class Pts

translate

public Face translate(float x,
                      float y)
Overrides:
translate in class Pts

translate

public Face translate(Param x,
                      Param y,
                      Param z)
Overrides:
translate in class Pts

translate

public Face translate(Param x,
                      Param y)
Overrides:
translate in class Pts

translate

public Face translate(Pt p)
Overrides:
translate in class Pts

translate

public Face translate(XYZ vector)
Overrides:
translate in class Pts

translateX

public Face translateX(float x)
Overrides:
translateX in class Pts

translateX

public Face translateX(Param x)
Overrides:
translateX in class Pts

translateY

public Face translateY(float y)
Overrides:
translateY in class Pts

translateY

public Face translateY(Param y)
Overrides:
translateY in class Pts

translateZ

public Face translateZ(float z)
Overrides:
translateZ in class Pts

translateZ

public Face translateZ(Param z)
Overrides:
translateZ in class Pts

apply

public Face apply(Transform t)
Overrides:
apply in class Pts

toANSYS

public java.lang.String toANSYS()
Overrides:
toANSYS in class Pts

toAutocad

public java.lang.String toAutocad()
Example Output:
(Command  "_3dface"  "16.496471743388526,8.784474824142091,0.0" "33.67561053776182,17.93247414103218,-20.379658117890358" "16.837804752737913,8.966236795666703,-20.379658117890358" "" "" )

Overrides:
toAutocad in class Pts
Returns:
String of code (MultiLines)

toRhino

public java.lang.String toRhino()
Overrides:
toRhino in class Pts
Returns:
String of code (MultiLines)

toRhinoAsObject

public java.lang.String toRhinoAsObject()
Export a face to Rhino Output example:
x = Array(    Array(38.5591,14.054252,0.0),   Array(27.743973,3.2854705,-20.0),   Array(39.060593,14.237039,-20.0),   Array(38.5591,14.054252,0.0)  )
 y = Rhino.AddPolyline(x)
   rhino.MeshPolyline(y)
   rhino.DeleteObject(y)
 

Overrides:
toRhinoAsObject in class Pts
Returns:
String of code (MultiLines)

toSketchUp

public java.lang.String toSketchUp()
Export a face to SketchUP Output example:
entities.add_face [
 Geom::Point3d.new(32.97344,16.216444,0.0),
 Geom::Point3d.new(50.377213,25.188606,-20.0),
 Geom::Point3d.new(33.402283,16.427351,-20.0)
 ]

Overrides:
toSketchUp in class Pts
Returns:
String of code (MultiLines)

toPovRay

public java.lang.String toPovRay()
Export a face to PovRAY Output example:
polygon {
   3,
   <49.73043,0.0,24.865215>,
   <38.5591,0.0,14.054252>,
   <39.060593,-20.0,14.237039>
   pigment { color rgbf <1.0, 0.03529412, 0.03529412, 1.0> }
 }

Returns:
String of code (MultiLines)

toObjExporter

public java.lang.String toObjExporter()
Overrides:
toObjExporter in class Pts

toRadiance

public java.lang.String toRadiance()
Export a face to Radiance Output example:
            material polygon name
                0
                0
                18      1454.1045       140.25954       0
                        1448.2742       142.885 0
                        1441.5046       166.70736       0
                        1444.0231       168.87313       0
                        1456.0293       164.97483       0
                        1464.2612       151.98389       0               
 

Returns:
String of code (MultiLines)

toObjExporter

public java.lang.String toObjExporter(java.lang.String name)
Overrides:
toObjExporter in class Pts

isInside

public boolean isInside(XYZ p)
Test if a point is inside a face


center

public Pt center()
Return the center of a face.

Returns:

normal

public Pt normal()
return a normal to the face (centered at the origin)

Returns:

normal

public Pt normal(float size)

isPlanar

public java.lang.Boolean isPlanar()
Test if a polygon is planar.

Returns:
planar state

triangulate

public Obj triangulate()
Triangulation algorithm based on Delaunay triangulation. (Alpha)

Returns:

copy

public Face copy()
Overrides:
copy in class Pts
Returns: