anar

Class Obj

java.lang.Object
  extended by anar.Parametric
      extended by anar.Obj
All Implemented Interfaces:
iTaggable, iTransformable
Direct Known Subclasses:
Blob, BoolOp, Box, Extrude, ObjFacesFromTwoLines, ObjGLBlob, Platonic, Pyramid, Revolve, SubdivSurf, Sweep, SweepTwoPaths, SwissCross3D, Voronoi

public class Obj
extends Parametric
implements iTransformable

Objects

Object is a combination of faces, points and lines. In OOG, while the primary focus is a logic representation, the Object doesn't have limitations such as BREP data structures of volumetric information. An object could be composed of a point (1D) or line (2D).


Field Summary
 java.util.ArrayList<Face> faces
           
static RenderObj globalRender
           
 java.util.ArrayList<Pts> lines
           
 Pts pts
           
 RenderObj render
           
 
Fields inherited from class anar.Parametric
meta
 
Constructor Summary
Obj()
           
Obj(Obj o)
           
Obj(Obj o, Transform t)
           
 
Method Summary
 Obj add(Face f)
           
 Obj add(Obj myO)
          done on the stress, consider revise tthis
 Obj add(Pt pt)
           
 Obj add(Pts pts)
           
 void addAllFaces(java.util.ArrayList<Face> list)
           
 void addAllPt(java.util.ArrayList<Pt> list)
           
 void addAllPts(java.util.ArrayList<Pts> list)
           
 java.util.ArrayList<Pt> allPts()
          Scan and collect all points from an object.
 Obj apply(Transform t)
           
 float area()
           
static float area(Obj o)
           
 XYZ[] bound()
           
 XYZ boundCenter()
           
 Obj copy()
           
 void draw()
           
 Obj exportANSYS()
           
 Obj exportANSYS(java.lang.String fileName)
           
 Obj exportAutolisp()
           
 Obj exportAutolisp(java.lang.String fileName)
           
 Obj exportOBJ()
           
 Obj exportOBJ(java.lang.String fileName)
           
 Obj exportPovRAY()
           
 Obj exportPovRAY(java.lang.String fileName)
           
 Obj exportRadiance()
           
 Obj exportRadiance(java.lang.String fileName)
           
 Obj exportRhino()
           
 Obj exportRhino(java.lang.String fileName)
           
 Obj exportSketchUp()
           
 Obj exportSketchUp(java.lang.String fileName)
           
 Face face(int i)
           
 Obj face(Pt[] pts)
           
 Face faceEnd()
           
 Face faceEnd(int i)
           
 Pts faceMod(int i)
          Get the face i%numOfFaces() in the list.
 Obj fill(AColor c)
           
 Obj fill(float g)
           
 Obj fill(float g, float a)
           
 Obj fill(float r, float g, float b)
           
 Obj fill(float r, float g, float b, float a)
           
 Obj fill(RenderFace c)
           
 Obj fillP5(int c)
           
 Face getFace(int i)
           
 Pts getLine(int i)
           
 Pt getPt(int i)
          Deprecated replaced by pt(int)
 Pts line(int i)
           
 Obj line(Pt[] pts)
           
 Pts lineEnd()
           
 Pts lineEnd(int i)
           
 Pts lineMod(int i)
          Get the line i%numOfLine() in the list.
 int numOfFaces()
           
 int numOfLines()
           
 int numOfPts()
           
 Obj orphaned()
          Export the geometry without any Parametric features.
 Pt pt(int i)
           
 Pt ptEnd()
           
 Pt ptEnd(int i)
           
 Pt ptMod(int i)
          Get the point i%numOfPts() in the list.
 void removeFace(Face i)
           
 Face removeFace(int i)
           
 Pt removePt(int i)
           
 void removePt(Pt i)
           
 Pts removePts(int i)
           
 void removePts(Pts i)
           
 Obj render(RenderFace render)
          Change the render for this object.
 Obj render(RenderObj render)
          Change the render for this object.
 Obj render(RenderPt render)
          Change the render for this object.
 Obj render(RenderPts render)
          Change the render for this object.
 Obj rotateX(float v)
           
 Obj rotateX(Param v)
           
 Obj rotateY(float v)
           
 Obj rotateY(Param v)
           
 Obj rotateZ(float v)
           
 Obj rotateZ(Param v)
           
 Obj scale(float x)
           
 Obj scale(float x, float y)
           
 Obj scale(float x, float y, float z)
           
 Obj scale(Param x)
           
 Obj scale(Param x, Param y)
           
 Obj scale(Param x, Param y, Param z)
           
 Obj scale(Pt p)
           
 Obj scale(XYZ vector)
           
 Obj scaleX(float x)
           
 Obj scaleX(Param x)
           
 Obj scaleY(float y)
           
 Obj scaleY(Param y)
           
 Obj scaleZ(float z)
           
 Obj scaleZ(Param z)
           
 Obj set(Meta meta)
           
 void set(RenderFace r)
           
 Obj set(java.lang.String tag)
           
 Obj setMeta(Meta meta)
           
 Obj tag(Meta tag)
           
 Obj tag(java.lang.String tag)
           
 java.lang.String toANSYS()
           
 java.lang.String toAutocad()
          Deprecated 
 void toAutocad(TextIO out)
          Text formated as AutoLisp code.
 java.lang.String toObjExporter()
          Deprecated 
 java.lang.String toObjExporter(java.lang.String name)
          Deprecated 
 void toObjExporter(TextIO out)
          Text formated as Obj (file format).
 void toObjExporter(TextIO out, java.lang.String name)
           
 java.lang.String toPovRay()
          Deprecated 
 void toPovRay(TextIO out)
          Text formated as PovRAY code.
 void toRadiance(TextIO out)
          Text formated as Radiance code.
 java.lang.String toRhino()
          Deprecated 
 void toRhino(TextIO out)
          Text formated as Rhino VisualBasic code.
 java.lang.String toSketchUp()
          Deprecated 
 void toSketchUp(TextIO out)
          Text formated as Ruby code for SketchUP.
 java.lang.String toString()
           
 Obj translate(float x, float y)
           
 Obj translate(float x, float y, float z)
           
 Obj translate(Param x, Param y)
           
 Obj translate(Param x, Param y, Param z)
           
 Obj translate(Pt p)
           
 Obj translate(XYZ vector)
           
 Obj translateX(float x)
           
 Obj translateX(Param x)
           
 Obj translateY(float y)
           
 Obj translateY(Param y)
           
 Obj translateZ(float z)
           
 Obj translateZ(Param z)
           
 Obj triangulate()
           
 
Methods inherited from class anar.Parametric
child, get, 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

faces

public java.util.ArrayList<Face> faces

lines

public java.util.ArrayList<Pts> lines

pts

public Pts pts

globalRender

public static RenderObj globalRender

render

public RenderObj render
Constructor Detail

Obj

public Obj()

Obj

public Obj(Obj o)

Obj

public Obj(Obj o,
           Transform t)
Method Detail

copy

public Obj copy()

add

public Obj add(Obj myO)
done on the stress, consider revise tthis

Parameters:
myO -

add

public Obj add(Face f)

add

public Obj add(Pts pts)

add

public Obj add(Pt pt)

line

public Obj line(Pt[] pts)
Parameters:
pts - describing the line to add.
Returns:

face

public Obj face(Pt[] pts)
Parameters:
pts - describing the face to add.
Returns:

addAllFaces

public void addAllFaces(java.util.ArrayList<Face> list)

addAllPts

public void addAllPts(java.util.ArrayList<Pts> list)

addAllPt

public void addAllPt(java.util.ArrayList<Pt> list)

set

public Obj set(Meta meta)
Specified by:
set in interface iTaggable

set

public Obj set(java.lang.String tag)
Parameters:
string -

setMeta

public Obj setMeta(Meta meta)
Specified by:
setMeta in interface iTaggable

tag

public Obj tag(java.lang.String tag)
Specified by:
tag in interface iTaggable

tag

public Obj tag(Meta tag)

set

public void set(RenderFace r)

numOfPts

public int numOfPts()
Returns:

numOfLines

public int numOfLines()
Returns:

numOfFaces

public int numOfFaces()
Returns:

getPt

@Deprecated
public Pt getPt(int i)
Deprecated replaced by pt(int)


pt

public Pt pt(int i)

ptMod

public Pt ptMod(int i)
Get the point i%numOfPts() in the list. Could be negative. The list is a closed sequence. Equivalent to pt((i%numOfPts()+numOfPts())%numOfPts());

Parameters:
i -
Returns:
See Also:
pt(int)

ptEnd

public Pt ptEnd()

ptEnd

public Pt ptEnd(int i)

getLine

public Pts getLine(int i)

line

public Pts line(int i)

lineMod

public Pts lineMod(int i)
Get the line i%numOfLine() in the list. Could be negative. The list is a closed sequence. Equivalent to line((i%numOfLines()+numOfLines())%numOfLines())

Parameters:
i -
Returns:

lineEnd

public Pts lineEnd()

lineEnd

public Pts lineEnd(int i)

getFace

public Face getFace(int i)

face

public Face face(int i)

faceMod

public Pts faceMod(int i)
Get the face i%numOfFaces() in the list. Could be negative. The list is a closed sequence. Equivalent to face((i%numOfFaces()+numOfFaces())%numOfFaces())

Parameters:
i -
Returns:

faceEnd

public Face faceEnd()

faceEnd

public Face faceEnd(int i)

removeFace

public Face removeFace(int i)

removePt

public Pt removePt(int i)

removePts

public Pts removePts(int i)

removeFace

public void removeFace(Face i)

removePt

public void removePt(Pt i)

removePts

public void removePts(Pts i)

rotateX

public Obj rotateX(Param v)

rotateX

public Obj rotateX(float v)

rotateY

public Obj rotateY(Param v)

rotateY

public Obj rotateY(float v)

rotateZ

public Obj rotateZ(Param v)

rotateZ

public Obj rotateZ(float v)

scale

public Obj scale(XYZ vector)

scale

public Obj scale(Pt p)

scale

public Obj scale(float x)

scale

public Obj scale(float x,
                 float y)

scale

public Obj scale(float x,
                 float y,
                 float z)

scale

public Obj scale(Param x,
                 Param y,
                 Param z)

scale

public Obj scale(Param x,
                 Param y)

scale

public Obj scale(Param x)

scaleX

public Obj scaleX(float x)

scaleX

public Obj scaleX(Param x)

scaleY

public Obj scaleY(float y)

scaleY

public Obj scaleY(Param y)

scaleZ

public Obj scaleZ(float z)

scaleZ

public Obj scaleZ(Param z)

translate

public Obj translate(XYZ vector)

translate

public Obj translate(Pt p)

translate

public Obj translate(float x,
                     float y,
                     float z)

translate

public Obj translate(float x,
                     float y)

translate

public Obj translate(Param x,
                     Param y,
                     Param z)

translate

public Obj translate(Param x,
                     Param y)

translateX

public Obj translateX(float x)

translateX

public Obj translateX(Param x)

translateY

public Obj translateY(float y)

translateY

public Obj translateY(Param y)

translateZ

public Obj translateZ(float z)

translateZ

public Obj translateZ(Param z)

apply

public Obj apply(Transform t)

draw

public void draw()

fill

public Obj fill(float g)

fill

public Obj fill(float g,
                float a)

fill

public Obj fill(float r,
                float g,
                float b)

fill

public Obj fill(float r,
                float g,
                float b,
                float a)

fillP5

public Obj fillP5(int c)

fill

public Obj fill(AColor c)

fill

public Obj fill(RenderFace c)

render

public Obj render(RenderObj render)
Change the render for this object.

Parameters:
render -
Returns:

render

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

Parameters:
render -
Returns:

render

public Obj render(RenderPts render)
Change the render for this object.

Parameters:
render -
Returns:

render

public Obj render(RenderPt render)
Change the render for this object.

Parameters:
render -
Returns:

orphaned

public Obj 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.


toANSYS

public java.lang.String toANSYS()

toAutocad

@Deprecated
public java.lang.String toAutocad()
Deprecated 

Export every faces, lines and points of an Object

Returns:
Text formated as AutoLisp code

toAutocad

public void toAutocad(TextIO out)
Text formated as AutoLisp code. Export every faces, lines and points of an Object.
 (Command  "_3dface"  "5.0,-5.0,-15.0" "5.0,5.0,-15.0" "-5.0,5.0,-15.0" "-5.0,-5.0,-15.0" "" "" )
 (Command  "_3dface"  "5.0,-5.0,-5.0" "5.0,5.0,-5.0" "5.0,5.0,-15.0" "5.0,-5.0,-15.0" "" "" )
 (Command  "_3dface"  "5.0,5.0,-5.0" "-5.0,5.0,-5.0" "-5.0,5.0,-15.0" "5.0,5.0,-15.0" "" "" )
 (Command  "_3dface"  "-5.0,5.0,-5.0" "-5.0,-5.0,-5.0" "-5.0,-5.0,-15.0" "-5.0,5.0,-15.0" "" "" )
 
 (Command  "line"  "30.0,100.0,0.0" "28.269678,104.48496,1.857639" "26.435183,109.49073,4.0277777" "" )
 

Parameters:
out - - PrintWriter in file

toRhino

@Deprecated
public java.lang.String toRhino()
Deprecated 

Export every faces, lines and points of an Object

Returns:
Text formated as Rhino VisualBasic code

toRhino

public void toRhino(TextIO out)
Text formated as Rhino VisualBasic code. Export every faces, lines and points of an Object.
 x = Array(    Array(17.320509,-10.0,70.0),    
 Array(10.0,-17.320509,70.0),    
 Array(-2.3092639E-14,-20.0,70.0),  
 Array(-10.0,-17.320509,70.0),   
 Array(-17.320509,-10.0,70.0),   
 Array(-20.0,1.4210855E-14,70.0),    
 Array(-17.320509,10.0,70.0),    
 Array(-10.0,17.320509,70.0),    
 Array(7.1054274E-15,20.0,70.0),   
 Array(17.320509,-10.0,70.0) )
 y = Rhino.AddPolyline(x)
   rhino.MeshPolyline(y)
   rhino.DeleteObject(y)
 
 x = Array(      Array( 30.0, 100.0, 0.0),
 Array( 23.333333333333332, 116.66666666666667, 6.666666666666667),      
 Array( 13.333333333333334, 150.0, 23.333333333333332),      
 Array( 10.0, 150.0, 20.0)   )
 y = Rhino.AddCurve( x)
 x = Array(      Array( 10.0, 150.0, 20.0),      
 Array( 6.666666666666666, 150.0, 16.666666666666668),      
 Array( 16.666666666666668, 120.0, -13.333333333333334),      
 Array( 20.0, 100.0, -10.0)   )
 y = Rhino.AddCurve( x)
 

Parameters:
out - - PrintWriter in file

toPovRay

@Deprecated
public java.lang.String toPovRay()
Deprecated 

Export every faces, lines and points of an Object.

Returns:
Text formated as PovRAY code.

toPovRay

public void toPovRay(TextIO out)
Text formated as PovRAY code. Export every faces, lines and points of an Object
 polygon {
   12,
   <17.320509,70.0,-10.0>,
   <10.0,70.0,-17.320509>,
   <-2.3092639E-14,70.0,-20.0>,
   <-10.0,70.0,-17.320509>,
   <-17.320509,70.0,-10.0>,
   <-20.0,70.0,1.4210855E-14>,
   <-17.320509,70.0,10.0>,
   <-10.0,70.0,17.320509>,
   <7.1054274E-15,70.0,20.0>,
   <10.0,70.0,17.320509>,
   <17.320509,70.0,10.0>,
   <20.0,70.0,0.0>
   texture{ DefTex }
 }
 cylinder {  <30.0,0.0,100.0>, <28.269678,1.857639,104.48496>, CylRad }
 cylinder {  <28.269678,1.857639,104.48496>, <26.435183,4.0277777,109.49073>,  CylRad }
 cylinder {  <26.435183,4.0277777,109.49073>,  <24.53125,6.40625,114.84375>, CylRad }
 cylinder {  <24.53125,6.40625,114.84375>, <22.59259,8.888889,120.37036>,  CylRad }
 cylinder {  <22.59259,8.888889,120.37036>,  <20.653936,11.371528,125.896996>, CylRad }
 cylinder {  <20.653936,11.371528,125.896996>, <18.75,13.75,131.25>, CylRad }
 

Parameters:
out - - PrintWriter in file

toRadiance

public void toRadiance(TextIO out)
Text formated as Radiance code. Export every faces, lines and points of an Object
 
 
 
 

Parameters:
out - - PrintWriter in file

toSketchUp

@Deprecated
public java.lang.String toSketchUp()
Deprecated 

Export every faces, lines and points of an Object

Returns:
Text formated as Ruby code for SketchUP

toSketchUp

public void toSketchUp(TextIO out)
Text formated as Ruby code for SketchUP. Export every faces, lines and points of an Object.
 entities.add_face [
 Geom::Point3d.new(-20.0,1.4210855E-14,60.0),
 Geom::Point3d.new(-17.320509,-10.0,60.0),
 Geom::Point3d.new(-8.6602545,-5.0,40.0),
 Geom::Point3d.new(-10.0,7.1054274E-15,40.0)
 ]
 
 entities.add_face [
 Geom::Point3d.new(-17.320509,-10.0,60.0),
 Geom::Point3d.new(-10.0,-17.320509,60.0),
 Geom::Point3d.new(-5.0,-8.6602545,40.0),
 Geom::Point3d.new(-8.6602545,-5.0,40.0)
 ]
 
 entities.add_edges [
 Geom::Point3d.new(30.0,100.0,0.0),
 Geom::Point3d.new(30.0,100.0,0.0),
 Geom::Point3d.new(10.0,150.0,20.0),
 Geom::Point3d.new(20.0,100.0,-10.0),
 Geom::Point3d.new(20.0,90.0,30.0),
 Geom::Point3d.new(0.0,90.0,20.0),
 Geom::Point3d.new(-30.0,80.0,-20.0),
 Geom::Point3d.new(-30.0,80.0,-20.0)
 ]
 

Parameters:
out - - PrintWriter in file

toObjExporter

@Deprecated
public java.lang.String toObjExporter()
Deprecated 

If no name are provided a new object name.

Returns:

toObjExporter

@Deprecated
public java.lang.String toObjExporter(java.lang.String name)
Deprecated 


toObjExporter

public void toObjExporter(TextIO out)
Text formated as Obj (file format). Export every faces, lines and points of an Object.
See www.martinreddy.net
See www.royriggs.com
 o box2409635
 
 v 110.0 30.0 0.0
 v 110.0 30.0 20.0
 v 110.0 0.0 20.0
 v 110.0 0.0 0.0
 v 110.0 30.0 20.0
 v 100.0 30.0 20.0
 v 100.0 0.0 20.0
 v 110.0 0.0 20.0
 v 100.0 30.0 20.0
 v 100.0 30.0 0.0
 v 100.0 0.0 0.0
 v 100.0 0.0 20.0
 v 100.0 30.0 0.0
 v 110.0 30.0 0.0
 v 110.0 0.0 0.0
 v 100.0 0.0 0.0
 v 110.0 0.0 0.0
 v 110.0 0.0 20.0
 v 100.0 0.0 20.0
 v 100.0 0.0 0.0
 v 100.0 30.0 0.0
 v 100.0 30.0 20.0
 v 110.0 30.0 20.0
 v 110.0 30.0 0.0
 
 usemtl mm7792807
 
 f -24 -23 -22 -21 
 f -20 -19 -18 -17 
 f -16 -15 -14 -13 
 f -12 -11 -10 -9 
 f -8 -7 -6 -5 
 f -4 -3 -2 -1 
 
 v 20.822062 14.490453 46.083195
 p -1
 
 v 84.33638 6.5318503 27.491554
 p -1
 
 v 94.51364 83.29432 56.426346
 p -1
 


toObjExporter

public void toObjExporter(TextIO out,
                          java.lang.String name)

exportRhino

public Obj exportRhino()

exportRhino

public Obj exportRhino(java.lang.String fileName)

exportPovRAY

public Obj exportPovRAY()

exportPovRAY

public Obj exportPovRAY(java.lang.String fileName)

exportSketchUp

public Obj exportSketchUp()

exportSketchUp

public Obj exportSketchUp(java.lang.String fileName)

exportRadiance

public Obj exportRadiance()

exportRadiance

public Obj exportRadiance(java.lang.String fileName)

exportOBJ

public Obj exportOBJ()

exportOBJ

public Obj exportOBJ(java.lang.String fileName)

exportAutolisp

public Obj exportAutolisp()

exportAutolisp

public Obj exportAutolisp(java.lang.String fileName)

exportANSYS

public Obj exportANSYS()

exportANSYS

public Obj exportANSYS(java.lang.String fileName)

allPts

public java.util.ArrayList<Pt> allPts()
Scan and collect all points from an object. Points from the faces, lines and point set are collected and not duplicated.

Returns:
List of points of all points.

area

public static float area(Obj o)

area

public float area()

bound

public XYZ[] bound()
Returns:
the smallest bounding box enclosing the object in XYZ.

boundCenter

public XYZ boundCenter()
Returns:
the point in the middle of the smallest enclosing box.

triangulate

public Obj triangulate()
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
Display the number of objects contained in all lists.