class config:
polygons = dict()
polygons['SHOW'] = True
- polygons['SHADING'] = 'FLAT'
- #polygons['HSR'] = 'PAINTER' # 'PAINTER' or 'NEWELL'
- polygons['HSR'] = 'NEWELL'
+ polygons['SHADING'] = 'FLAT' # FLAT or TOON
+ polygons['HSR'] = 'PAINTER' # PAINTER or NEWELL
# Hidden to the user for now
polygons['EXPANSION_TRICK'] = True
edges = dict()
edges['SHOW'] = False
edges['SHOW_HIDDEN'] = False
- edges['STYLE'] = 'MESH' # or SILHOUETTE
+ edges['STYLE'] = 'MESH' # MESH or SILHOUETTE
edges['WIDTH'] = 2
edges['COLOR'] = [0, 0, 0]
output['ANIMATION'] = False
output['JOIN_OBJECTS'] = True
- #output['FORMAT'] = 'SWF'
- #output['ANIMATION'] = True
-
# Utility functions
print_debug = False
isVertInside = staticmethod(isVertInside)
+
+ def det(a, b, c):
+ return ((b[0] - a[0]) * (c[1] - a[1]) -
+ (b[1] - a[1]) * (c[0] - a[0]) )
+
+ det = staticmethod(det)
+
+ def pointInPolygon(q, P):
+ is_in = False
+
+ point_at_infinity = NMesh.Vert(-INF, q.co[1], -INF)
+
+ det = HSR.det
+
+ for i in range(len(P.v)):
+ p0 = P.v[i-1]
+ p1 = P.v[i]
+ if (det(q.co, point_at_infinity.co, p0.co)<0) != (det(q.co, point_at_infinity.co, p1.co)<0):
+ if det(p0.co, p1.co, q.co) == 0 :
+ #print "On Boundary"
+ return False
+ elif (det(p0.co, p1.co, q.co)<0) != (det(p0.co, p1.co, point_at_infinity.co)<0):
+ is_in = not is_in
+
+ return is_in
+
+ pointInPolygon = staticmethod(pointInPolygon)
+
def projectionsOverlap(f1, f2):
""" If you have nonconvex, but still simple polygons, an acceptable method
is to iterate over all vertices and perform the Point-in-polygon test[1].
# If a point of f1 in inside f2, there is an overlap!
v1 = f1.v[i]
- if HSR.isVertInside(f2, v1):
+ #if HSR.isVertInside(f2, v1):
+ if HSR.pointInPolygon(v1, f2):
return True
# If not the polygon can be ovelap as well, so we check for
outputWriter.open(startFrame, endFrame)
# Do the rendering process frame by frame
- print "Start Rendering of %d frames" % (endFrame-startFrame)
+ print "Start Rendering of %d frames" % (endFrame-startFrame+1)
for f in xrange(startFrame, endFrame+1):
print "\n\nFrame: %d" % f
context.currentFrame(f)
if edgestyleSelect(e, mesh):
e.sel = 1
"""
+ #
# ---------------------------------------------------------------------
elif evt == GUI.evtOutFormatMenu:
i = GUI.outFormatMenu.val - 1
config.output['FORMAT']= outputWriters.keys()[i]
+ # Set the new output file
+ global outputfile
+ outputfile = Blender.sys.splitext(basename)[0] + "." + str(config.output['FORMAT']).lower()
elif evt == GUI.evtAnimToggle:
config.output['ANIMATION'] = bool(GUI.animToggle.val)