 License Public Domain
 Lines 66
##### Keywords graphics (9) nodebox (8)
##### Related Nodebox Flow Chart Edges Nodebox Flow Chart Nodes Nodebox Flow Charts Utility Geometry Code Color Picker for Nodebox
##### Permissions Owner: Theodore Test Viewable by Everyone Editable by All Siafoo Users

# Nodebox Primitives for Flow Charts 0

 In Brief Nodebox primitive functions that extend the core set. All are original or modified implementations of primitives submitted for public use in the Nodebox forum .... more
 Language Nodebox Python
# 's
` 1from utility_geometry import * 2 3def diamond_path(arg_x,arg_y,arg_width,arg_height,draw=True): 4    mid_x = arg_x + arg_width/2.0 5    mid_y = arg_y + arg_height/2.0 6    beginpath(arg_x,mid_y) 7    lineto(mid_x,arg_y) 8    lineto(arg_x+arg_width,mid_y) 9    lineto(mid_x,arg_y+arg_height)10    lineto(arg_x,mid_y)11    p = endpath(draw=draw)1213    return p1415def equilateral_triangle(x0,y0,length,draw=True):16    '''Draws an equilateral triangle.'''17    18    x1,y1 = coordinates(x0,y0,length,0)19    x2,y2 = coordinates(x0,y0,length,60)20    beginpath(x0,y0)21    lineto(x1,y1)22    lineto(x2,y2)23    lineto(x0,y0)24    p = endpath(draw)25    return p26    27def right_triangle(x0,y0,length1,length2,draw=True):28    '''Draws a right triangle, with the right angle at the origin'''29 30    x1,y1 = coordinates(x0,y0,length1,0)31    x2,y2 = coordinates(x0,y0,length2,90)32    beginpath(x0,y0)33    lineto(x1,y1)34    lineto(x2,y2)35    lineto(x0,y0)36    p = endpath(draw)37    return p38 39def isoscelestriangle(x0,y0,length,angle,draw=True):40    '''Draws an isosceles triangle defined by the length of the41    two equal sides and the angle between them.'''42    a = 180 - 2*angle43    x1,y1 = coordinates(x0,y0,length,0)44    x2,y2 = coordinates(x0,y0,length,a)45    beginpath(x0,y0)46    lineto(x1,y1)47    lineto(x2,y2)48    lineto(x0,y0)49    p = endpath(draw)50    return p51    52def scalenetriangle(x0,y0,length1,length2,angle,draw=True):53    '''Draws a scalene triange defined by the length of two sides54    and the angle between them.'''55    from math import radians, sin, cos,asin,degrees5657    a,c,angB = length1,length2,angle58    b = (a**2+c**2 - 2.0*a*c*cos(radians(angB)))**0.559    angA = degrees(asin((a*sin(radians(angB)))/b))60    angC = degrees(asin((c*sin(radians(angB)))/b))61 62    x1,y1 = coordinates(x0,y0,a,0)63    x2,y2 = coordinates(x0,y0,b,angC)64    65    beginpath(x0,y0)66    lineto(x1,y1)67    lineto(x2,y2)68    lineto(x0,y0)69    p = endpath(draw)70    return p`

Nodebox primitive functions that extend the core set. All are original or modified implementations of primitives submitted for public use in the Nodebox forum .

These functions are dependent on the Nodebox environment.