def evalonebitangency(srfs, pts): ruling = irit.nil() tmp1pts = irit.nil() tmp2pts = irit.nil() if (irit.ThisObject(srfs) == irit.SURFACE_TYPE): srf1 = srfs srf2 = srfs else: srf1 = irit.nth(srfs, 1) srf2 = irit.nth(srfs, 2) i = 1 while (i <= irit.SizeOf(pts)): pt = irit.nth(pts, i) pt1 = irit.seval(srf1, irit.FetchRealObject(irit.coord(pt, 1)), irit.FetchRealObject(irit.coord(pt, 2))) pt2 = irit.seval(srf2, irit.FetchRealObject(irit.coord(pt, 3)), irit.FetchRealObject(irit.coord(pt, 4))) irit.snoc(pt1 + pt2, ruling) irit.snoc(pt1 * irit.tx(0), tmp1pts) irit.snoc(pt2 * irit.tx(0), tmp2pts) i = i + 1 irit.attrib(ruling, "rgb", irit.GenStrObject("255, 128, 128")) if (irit.SizeOf(tmp1pts) > 1 and irit.SizeOf(tmp2pts) > 1): tmp1pts = irit.poly(tmp1pts, irit.TRUE) tmp2pts = irit.poly(tmp2pts, irit.TRUE) irit.attrib(tmp1pts, "rgb", irit.GenStrObject("128, 255, 128")) irit.attrib(tmp2pts, "rgb", irit.GenStrObject("128, 255, 128")) retval = irit.list(ruling, tmp1pts, tmp2pts) else: retval = irit.nil() return retval
def evalantipodalptsonsrf( srf ): aps = irit.antipodal( srf, 0.001, (-1e-012 ) ) irit.printf( "%d antipodal points detected\n", irit.list( irit.SizeOf( aps ) ) ) retval = irit.nil( ) diam = 0 i = 1 while ( i <= irit.SizeOf( aps ) ): ap = irit.nth( aps, i ) u1 = irit.coord( ap, 1 ) v1 = irit.coord( ap, 2 ) u2 = irit.coord( ap, 3 ) v2 = irit.coord( ap, 4 ) pt1 = irit.seval( srf, irit.FetchRealObject(u1), irit.FetchRealObject(v1) ) pt2 = irit.seval( srf, irit.FetchRealObject(u2), irit.FetchRealObject(v2) ) if ( irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), irit.coerce( pt2, irit.POINT_TYPE ) ) > diam ): diam = irit.dstptpt( irit.coerce( pt1, irit.POINT_TYPE ), irit.coerce( pt2, irit.POINT_TYPE ) ) diamline = pt1 + pt2 irit.snoc( irit.list( pt1 + pt2, pt1 * irit.tx( 0 ), pt2 * irit.tx( 0 ) ), retval ) i = i + 1 irit.color( retval, irit.YELLOW ) irit.color( diamline, irit.CYAN ) irit.adwidth( diamline, 3 ) irit.snoc( irit.list( diamline ), retval ) return retval
def raytraptris3d(srfs, subeps, numeps): pts = irit.raytraps(srfs, 1, subeps, numeps, 1) retval = irit.nil() if (irit.SizeOf(pts) > 1): irit.printf("%d solution(s) found\n", irit.list(irit.SizeOf(pts))) i = 1 while (i <= irit.SizeOf(pts)): pt = irit.coord(pts, i) err = irit.getattr(pt, "rngerror") if (irit.ThisObject(err) == irit.NUMERIC_TYPE): irit.printf("error = %16.14f\n", irit.list(err)) else: irit.printf("error is not provided\n", irit.nil()) points = irit.nil() j = 1 while (j <= irit.SizeOf(srfs)): irit.snoc( irit.seval( irit.nth(srfs, j), irit.FetchRealObject(irit.coord(pt, 1 + (j - 1) * 2)), irit.FetchRealObject(irit.coord(pt, 2 + (j - 1) * 2))), points) j = j + 1 irit.snoc(irit.poly(points, 0), retval) i = i + 1 return retval
def getbisectpt( crv1, crv2, pt ): pt1 = irit.ceval( crv1, irit.FetchRealObject(irit.coord( pt, 0 ) )) pt2 = irit.ceval( crv2, irit.FetchRealObject(irit.coord( pt, 1 ) )) nrml1 = irit.cnormalplnr( crv1, irit.FetchRealObject(irit.coord( pt, 0 ) )) nrml2 = irit.cnormalplnr( crv2, irit.FetchRealObject(irit.coord( pt, 1 ) )) interpts = irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ) retval = irit.nth( interpts, 1 ) return retval
def gammakernelpolysrfs( pl, maxgamma, extent ): retval = irit.nil( ) i = 1 while ( i <= irit.SizeOf( pl ) ): c = irit.coerce( irit.coord( pl, i - 1 ), irit.E2 ) + irit.coerce( irit.coord( pl, i ), irit.E2 ) k1 = irit.crvkernel( c, maxgamma, 0, irit.GenRealObject(extent), 2 ) k2 = irit.crvkernel( c, (-maxgamma ), 0, irit.GenRealObject(extent), 2 ) irit.snoc( irit.list( setrandomcolor( k1 ), setrandomcolor( k2 ) ), retval ) i = i + 1 return retval
def rigidmotionpos(cnew, c): t = irit.FetchRealObject(irit.nth(irit.pdomain(c), 1)) pos = irit.coerce(irit.ceval(c, t), irit.VECTOR_TYPE) tn = irit.ctangent(c, t, 1) retval = cnew * \ irit.rz( math.atan2( irit.FetchRealObject(irit.coord( tn, 1 )), irit.FetchRealObject(irit.coord( tn, 0 )) ) * \ 180/math.pi ) * \ irit.trans( irit.Fetch3TupleObject(pos) ) return retval
def plgntoplln( pl ): retval = irit.nil( ) j = 0 while ( j <= irit.SizeOf( pl ) - 1 ): irit.snoc( irit.coord( pl, j ), retval ) j = j + 1 irit.snoc( irit.coord( pl, 0 ), retval ) retval = irit.poly( retval, irit.TRUE ) irit.attrib( retval, "dwidth", irit.GenIntObject(3 )) return retval
def animbisectcrv2( crv1, crv2, data, cntr ): irit.color( crv1, irit.YELLOW ) irit.color( crv2, irit.YELLOW ) irit.adwidth( crv1, 4 ) irit.adwidth( crv2, 4 ) i = 0 while ( i <= irit.SizeOf( cntr ) - 1 ): pt = irit.coord( cntr, i ) pt1 = irit.ceval( crv1, irit.FetchRealObject(irit.coord( pt, 0 ) )) pt2 = irit.ceval( crv2, irit.FetchRealObject(irit.coord( pt, 1 ) )) nrml1 = cnormalplnr( crv1, irit.coord( pt, 0 ) ) nrml2 = cnormalplnr( crv2, irit.coord( pt, 1 ) ) aaa = irit.ptslnln( irit.Fetch3TupleObject(irit.coerce( pt1, irit.POINT_TYPE )), irit.Fetch3TupleObject(nrml1), irit.Fetch3TupleObject(irit.coerce( pt2, irit.POINT_TYPE )), irit.Fetch3TupleObject(nrml2 )) if (irit.IsNullObject(aaa)): interpt = irit.GenNullObject(); else: interpt = irit.nth( aaa, 1 ) if ( irit.ThisObject(interpt) == irit.POINT_TYPE ): irit.color( pt1, irit.GREEN ) irit.color( pt2, irit.GREEN ) irit.color( interpt, irit.WHITE ) bisectlns = irit.coerce( pt1, irit.E2 ) + irit.coerce( interpt, irit.E2 ) + irit.coerce( pt2, irit.E2 ) irit.color( bisectlns, irit.MAGENTA ) if ( irit.FetchRealObject(irit.coord( interpt, 1 )) < 10 and \ irit.FetchRealObject(irit.coord( interpt, 1 )) > (-10 ) and \ irit.FetchRealObject(irit.coord( interpt, 2 )) < 10 and \ irit.FetchRealObject(irit.coord( interpt, 2 )) > (-10 ) ): irit.view( irit.list( crv1, crv2, data, pt1, pt2, interpt, \ bisectlns ), irit.ON ) i = i + 1
def extracte3pts(uvxyzpts): retval = irit.nil() irit.printf("found %d points\n", irit.list(irit.SizeOf(uvxyzpts))) i = 1 while (i <= irit.SizeOf(uvxyzpts)): uvxyzpt = irit.nth(uvxyzpts, i) irit.snoc( irit.ctlpt(irit.E3, irit.coord(uvxyzpt, 3), irit.coord(uvxyzpt, 4), irit.coord(uvxyzpt, 5)), retval) i = i + 1 return retval
def computeerror(crv, dist, ocrv): dst = irit.symbdiff(crv, ocrv) dstsqr = irit.symbdprod(dst, dst) ffmin = irit.max(irit.coord(irit.ffextreme(dstsqr, 1), 1), 0) ffmax = irit.max(irit.coord(irit.ffextreme(dstsqr, 0), 1), 0) irit.printf( "%1.0lf %lf", irit.list( irit.SizeOf(ocrv), irit.max(irit.abs(math.sqrt(ffmin) - dist), irit.abs(math.sqrt(ffmax) - dist))))
def evaluvtoe3(srf, uvs, clr): retval = irit.nil() i = 1 while (i <= irit.SizeOf(uvs)): uv = irit.nth(uvs, i) irit.snoc( irit.seval(srf, irit.FetchRealObject(irit.coord(uv, 1)), irit.FetchRealObject(irit.coord(uv, 2))), retval) i = i + 1 irit.color(retval, clr) return retval
def printctlpoint( cpt ): s = irit.SizeOf( cpt ) if ( s < 0 ): irit.printf( "\t[w=%-9.6lg ", irit.list( irit.coord( cpt, 0 ) ) ) s = (-s ) else: irit.printf( "\t[", irit.nil( ) ) i = 1 while ( i <= s ): irit.printf( "%9.6lg ", irit.list( irit.coord( cpt, i ) ) ) i = i + 1 irit.printf( "]\n", irit.nil( ) )
def drawcircs(pls): retval = irit.nil() i = 0 while (i <= irit.SizeOf(pls) - 1): v = irit.coord(pls, i) irit.snoc( colorcirc( irit.circle((irit.FetchRealObject(irit.coord( v, 0)), irit.FetchRealObject(irit.coord(v, 1)), (-1)), irit.FetchRealObject(irit.coord(v, 2))), irit.FetchRealObject(irit.coord(v, 2)) > 0), retval) i = i + 1 return retval
def originalf(f, newf, deg, c, ptype): net = irit.nil() f_p = irit.coerce(f, irit.POWER_TYPE) tmp = irit.ffsplit(f_p) tmp3 = irit.ffsplit(newf) i = 1 while (i <= c): t = irit.coord(irit.coord(irit.nth(tmp, i), deg), 1) tmp2 = irit.nth(tmp3, i) * irit.sc(irit.FetchRealObject(t)) irit.snoc(irit.coerce(tmp2, irit.E1), net) i = i + 1 retval = irit.ffmerge(net, ptype) return retval
def getbisectcrv( crv1, crv2, cntr ): ptlist = irit.nil( ) i = 0 while ( i <= irit.SizeOf( cntr ) - 1 ): pt = irit.coord( cntr, i ) pt1 = irit.ceval( crv1, irit.coord( pt, 0 ) ) pt2 = irit.ceval( crv2, irit.coord( pt, 1 ) ) nrml1 = irit.cnormalplnr( crv1, irit.coord( pt, 0 ) ) nrml2 = irit.cnormalplnr( crv2, irit.coord( pt, 1 ) ) interpts = irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ) irit.snoc( irit.nth( interpts, 1 ), ptlist ) i = i + 1 retval = irit.cbspline( 2, ptlist, irit.list( irit.KV_OPEN ) ) return retval
def animateorthomatchpts(ppl, crv, scl): bg_obj = irit.list(unitsquare, crv, ppl) i = 0 while (i <= irit.SizeOf(ppl) - 1): pl = irit.coord(ppl, i) j = 0 while (j <= irit.SizeOf(pl) - 1): pt = irit.coord(pl, j) t1 = irit.coord(pt, 0) t2 = irit.coord(pt, 1) if (t1 > t2): displayposnormal(crv, t1, t2, scl, bg_obj) j = j + 1 i = i + 1
def displayptscrctan2crvs(pts, r, c1, c2): retval = irit.nil() circ = irit.circle((0, 0, 0), r) i = 1 while (i <= irit.SizeOf(pts)): pt = irit.coord(pts, i) prms = irit.getattr(pt, "params") ptc1 = irit.ceval(c1, irit.FetchRealObject(irit.coord(prms, 0))) ptc2 = irit.ceval(c2, irit.FetchRealObject(irit.coord(prms, 1))) irit.snoc( irit.list( irit.coerce( pt, irit.E2 ) + ptc1, \ irit.coerce( pt, irit.E2 ) + ptc2, \ circ * irit.trans( irit.Fetch3TupleObject(irit.coerce( pt, irit.VECTOR_TYPE )) ) ), retval ) i = i + 1 return retval
def cnvrtcrvs2ranges( crvs, idx, merge ): retval = irit.nil( ) if ( merge ): crvs = mergeverticalbndrycrvs( crvs ) i = 1 while ( i <= irit.SizeOf( crvs ) ): dm = irit.nth( crvs, i ) pt1 = irit.ceval( dm, 0 ) pt2 = irit.ceval( dm, 1 ) rng = irit.list( irit.coord( pt1, 2 ) ) + irit.list( irit.coord( pt2, 2 ) ) irit.attrib( rng, "index", irit.GenRealObject(idx) ) irit.snoc( rng, retval ) i = i + 1 return retval
def evaloneflecnodalpts(srf, pts): if (irit.ThisObject(pts) == irit.CTLPT_TYPE): retval = irit.seval(srf, irit.FetchRealObject(irit.coord(pts, 1)), irit.FetchRealObject(irit.coord(pts, 2))) irit.color(retval, irit.BLUE) else: retval = irit.nil() i = 1 while (i <= irit.SizeOf(pts)): pt = irit.nth(pts, i) irit.snoc( irit.seval(srf, irit.FetchRealObject(irit.coord(pt, 1)), irit.FetchRealObject(irit.coord(pt, 2))), retval) i = i + 1 return retval
def computeerror(fname, crv, dist, ocrv): crv = irit.creparam(crv, 0, 1) ocrv = irit.creparam(ocrv, 0, 1) dst = irit.symbdiff(crv, ocrv) dstsqr = irit.symbdprod(dst, dst) ffmin = irit.max( irit.FetchRealObject(irit.coord(irit.ffextreme(dstsqr, 1), 1)), 0) ffmax = irit.max( irit.FetchRealObject(irit.coord(irit.ffextreme(dstsqr, 0), 1)), 0) irit.printf( "\n\t%s: min %lf, max %lf, max error %lf (ctlpts = %1.0lf)", irit.list( fname, math.sqrt(ffmin), math.sqrt(ffmax), irit.max(abs(math.sqrt(ffmin) - dist), abs(math.sqrt(ffmax) - dist)), irit.SizeOf(ocrv)))
def tagcurve(crv, n, len): tmin = irit.FetchRealObject(irit.coord(irit.pdomain(crv), 1)) tmax = irit.FetchRealObject(irit.coord(irit.pdomain(crv), 2)) dt = (tmax - tmin) / float(n - 1) retval = irit.nil() t = tmin i = 1 while (i <= n): pt = irit.coerce(irit.ceval(crv, t), irit.POINT_TYPE) nrml = irit.coerce(irit.cnormal(crv, t), irit.VECTOR_TYPE) irit.snoc( irit.coerce(pt - nrml * len, irit.E2) + irit.coerce(pt + nrml * len, irit.E2), retval) t = t + dt i = i + 1 return retval
def interactorthomap(ppl, crv, scl): irit.clntpickcrsr(irit.CLIENTS_ALL) crsrkeep = irit.iritstate("cursorkeep", 1) quit = 0 irit.view((ppl, crv, unitsquare), irit.ON) while (quit == 0): c = irit.clntcrsr(100) if (irit.SizeOf(c) > 0): u = irit.coord(irit.nth(c, 1), 0) v = irit.coord(irit.nth(c, 1), 1) irit.printf("u = %f, v = %f\n", irit.list(u, v)) if (u < 0 or u > 1 or v < 0 or v > 1): quit = 1 else: displayposnormal(crv, u, v, scl) irit.clntpickdone(irit.CLIENTS_ALL) crsrkeep = irit.iritstate("cursorkeep", crsrkeep)
def warpsurface( srf, tv ): usize = irit.FetchRealObject(irit.nth( irit.ffmsize( srf ), 1 )) vsize = irit.FetchRealObject(irit.nth( irit.ffmsize( srf ), 2 )) clr = irit.getattr( srf, "color" ) i = 0 while ( i <= usize * vsize - 1 ): pt = irit.coord( srf, i ) x = irit.FetchRealObject(irit.coord( pt, 1 )) y = irit.FetchRealObject(irit.coord( pt, 2 )) z = irit.FetchRealObject(irit.coord( pt, 3 )) pt = irit.teval( tv, x, y, z ) v = math.floor( i/float(usize) ) u = i - v * usize srf = irit.seditpt( srf, pt, u, v ) i = i + 1 irit.attrib( srf, "color", clr ) retval = srf return retval
def uvpos2pt(srf, pt, mindist): pt = irit.coerce(pt, irit.POINT_TYPE) uvpt = irit.srfptdst(srf, irit.Fetch3TupleObject(pt), mindist, 0.001, 1e-010) e3pt = irit.seval(srf, irit.FetchRealObject(irit.coord(uvpt, 0)), irit.FetchRealObject(irit.coord(uvpt, 1))) e3nrml = irit.snormal(srf, irit.FetchRealObject(irit.coord(uvpt, 0)), irit.FetchRealObject(irit.coord(uvpt, 1))) edge = (irit.coerce(pt, irit.E3) + e3pt) nedge = (e3pt + irit.coerce(irit.coerce(e3pt, irit.POINT_TYPE) - e3nrml, irit.E3)) irit.color(e3pt, irit.MAGENTA) irit.adwidth(e3pt, 3) irit.color(pt, irit.YELLOW) irit.color(edge, irit.CYAN) irit.color(nedge, irit.GREEN) retval = irit.list(e3pt, pt, edge, nedge) return retval
def canonicalh(f, g, deg, c, ptype): net = irit.nil() t = irit.ceval(g, 1) g2 = g * irit.sc(1 / irit.FetchRealObject(irit.coord(t, 1))) f2 = irit.cregion(f, 0, irit.FetchRealObject(irit.coord(t, 1))) f_p = irit.coerce(f2, irit.POWER_TYPE) tmp = irit.ffsplit(f_p) i = 1 while (i <= c): bm = irit.coord(irit.coord(irit.nth(tmp, i), deg), 1) tmp2 = irit.coerce(irit.nth(tmp, i), irit.BEZIER_TYPE) * irit.sc( 1 / irit.FetchRealObject(bm)) irit.snoc( irit.coerce(irit.coerce(irit.compose(tmp2, g2), irit.BEZIER_TYPE), irit.E1), net) i = i + 1 retval = irit.ffmerge(net, ptype) return retval
def genanimationorthomatchcrvpts(ppl, crv, scl): pt1 = irit.point(0, 0, 0) pt2 = irit.point(0, 0, 0) vec1 = ( irit.ctlpt( irit.E2, 0, 0 ) + \ irit.ctlpt( irit.E2, 0, scl ) ) irit.color(vec1, irit.YELLOW) vec2 = ( \ irit.ctlpt( irit.E2, 0, 0 ) + \ irit.ctlpt( irit.E2, 0, scl ) ) irit.color(vec2, irit.CYAN) pos1 = irit.nil() pos2 = irit.nil() rot1 = irit.nil() rot2 = irit.nil() i = 0 while (i <= irit.SizeOf(ppl) - 1): pl = irit.coord(ppl, i) j = 0 while (j <= irit.SizeOf(pl) - 1): pt = irit.coord(pl, j) t1 = irit.coord(pt, 0) t2 = irit.coord(pt, 1) if (t1 > t2): irit.snoc( irit.coerce(irit.ceval(crv, irit.FetchRealObject(t1)), irit.POINT_TYPE), pos1) irit.snoc( irit.coerce(irit.ceval(crv, irit.FetchRealObject(t2)), irit.POINT_TYPE), pos2) n1 = irit.cnormal(crv, irit.FetchRealObject(t1)) n2 = irit.cnormal(crv, irit.FetchRealObject(t2)) irit.snoc( irit.vector( math.atan2(irit.FetchRealObject(irit.coord(n1, 0)), irit.FetchRealObject(irit.coord(n1, 1))) * 180 / math.pi, 0, 0), rot1) irit.snoc( irit.vector( math.atan2(irit.FetchRealObject(irit.coord(n2, 0)), irit.FetchRealObject(irit.coord(n2, 1))) * 180 / math.pi, 0, 0), rot2) j = j + 1 if (t1 > t2): irit.snoc(irit.vector(10000, 0, 0), pos1) irit.snoc(irit.vector(10000, 0, 0), pos2) irit.snoc(irit.vector(0, 0, 0), rot1) irit.snoc(irit.vector(0, 0, 0), rot2) i = i + 1 irit.attrib(pt1, "animation", makerottransanimobj(irit.nil(), pos1)) irit.attrib(pt2, "animation", makerottransanimobj(irit.nil(), pos2)) irit.attrib(vec1, "animation", makerottransanimobj(rot1, pos1)) irit.attrib(vec2, "animation", makerottransanimobj(rot2, pos2)) retval = irit.list(pt1, pt2, vec1, vec2) return retval
def animbisectcrv( crv1, crv2, data, cntr ): irit.color( crv1, irit.YELLOW ) irit.color( crv2, irit.YELLOW ) irit.adwidth( crv1, 4 ) irit.adwidth( crv2, 4 ) i = 0 while ( i <= irit.SizeOf( cntr ) - 1 ): pt = irit.coord( cntr, i ) pt1 = irit.ceval( crv1, irit.coord( pt, 0 ) ) pt2 = irit.ceval( crv2, irit.coord( pt, 1 ) ) nrml1 = irit.cnormalplnr( crv1, irit.coord( pt, 0 ) ) nrml2 = irit.cnormalplnr( crv2, irit.coord( pt, 1 ) ) interpt = irit.nth( irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ), 1 ) if ( irit.ThisObject(interpt) == irit.POINT_TYPE ): irit.color( pt1, irit.GREEN ) irit.color( pt2, irit.GREEN ) irit.color( interpt, irit.WHITE ) irit.view( irit.list( crv1, crv2, pt1, pt2, data, interpt ), irit.ON ) i = i + 1
def getbisectlines( crv1, crv2, cntr, n, start, end ): if ( start == (-1 ) ): start = 0 if ( end == (-1 ) ): end = irit.SizeOf( cntr ) - 1 retval = irit.nil( ) ii = start while ( ii <= end ): i = irit.floor( ii ) pt = irit.coord( cntr, i ) pt1 = irit.ceval( crv1, irit.coord( pt, 0 ) ) pt2 = irit.ceval( crv2, irit.coord( pt, 1 ) ) nrml1 = irit.cnormalplnr( crv1, irit.coord( pt, 0 ) ) nrml2 = irit.cnormalplnr( crv2, irit.coord( pt, 1 ) ) interpts = irit.ptslnln( irit.coerce( pt1, irit.POINT_TYPE ), nrml1, irit.coerce( pt2, irit.POINT_TYPE ), nrml2 ) irit.snoc( irit.coerce( pt1, irit.E2 ) + irit.coerce( irit.nth( interpts, 1 ), irit.E2 ) + irit.coerce( pt2, irit.E2 ), retval ) ii = ii + ( end - start - 1 )/n - 1e-005 irit.color( retval, irit.CYAN ) irit.awidth( retval, 0.0001 ) return retval
def estimatesphericalcrv(theta1, theta2, phi1, phi2): orthovec = computeorthovector(theta1, theta2, phi1, phi2) retval = 0 t = 0 while (t <= 100): theta = (theta2 * t + theta1 * (100 - t)) * math.pi / (180 * 100) phi = (phi2 * t + phi1 * (100 - t)) * math.pi / (180 * 100) aaa = irit.FetchRealObject(irit.coord( orthovec, 0 )) * \ math.cos( theta ) * \ math.cos( phi ) bbb = irit.FetchRealObject(irit.coord( orthovec, 1 )) * \ math.cos( theta ) * \ math.sin( phi ) ccc = irit.FetchRealObject(irit.coord( orthovec, 2 )) * \ math.sin( theta ) val = aaa + bbb + ccc if (retval < val): retval = val t = t + 1 return retval
def silandsilinfl(s, v): sil = irit.silhouette(s, v, 1) irit.color(sil, irit.YELLOW) pts = irit.ssilinfl(s, v, 0.01, (-1e-010)) e3pts = irit.nil() i = 1 while (i <= irit.SizeOf(pts)): p = irit.nth(pts, i) irit.snoc( irit.coerce( irit.seval(s, irit.FetchRealObject(irit.coord(p, 0)), irit.FetchRealObject(irit.coord(p, 1))), irit.E3), e3pts) i = i + 1 irit.color(e3pts, irit.CYAN) irit.printf("detected %d silhouette high order contact points.\n", irit.list(irit.SizeOf(e3pts))) view_mat_sil = viewmatfromviewdir(v) retval = irit.list(e3pts, sil, view_mat_sil) return retval