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 displayposnormal(crv, t1, t2, scl, bg_obj): pt1 = irit.ceval(crv, irit.FetchRealObject(t1)) pt2 = irit.ceval(crv, irit.FetchRealObject(t2)) n1 = irit.cnormal(crv, irit.FetchRealObject(t1)) n2 = irit.cnormal(crv, irit.FetchRealObject(t2)) ptt1 = (irit.ctlpt(irit.E2, t1, t2) + irit.ctlpt(irit.E2, t1, 0)) irit.color(ptt1, irit.YELLOW) ptt2 = (irit.ctlpt(irit.E2, t1, t2) + irit.ctlpt(irit.E2, 0, t2)) irit.color(ptt2, irit.CYAN) n1 = (irit.coerce( irit.coerce(pt1, irit.POINT_TYPE) + n1 * irit.sc(scl), irit.E2) + pt1) irit.color(n1, irit.YELLOW) n2 = (irit.coerce( irit.coerce(pt2, irit.POINT_TYPE) + n2 * irit.sc(scl), irit.E2) + pt2) irit.color(n2, irit.CYAN) irit.view(irit.list(n1, n2, pt1, pt2, ptt1, ptt2, bg_obj), irit.ON)
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
irit.printf( "tangent evaluations for\n\tpolynomial - %d\n\trational - %d\n", irit.list(checktangenteval(irit.coerce(cb, irit.E3)), checktangenteval(cb))) z = irit.iritstate("cmpobjeps", z) # # Surface and Curve normals. # irit.save( "bezier4", irit.list(irit.cnormal(cb, 0), irit.cnormal(cb, 0.1), irit.cnormal(cb, 0.3), irit.cnormal(cb, 0.5), irit.cnormal(cb, 0.9), irit.cnormal(cb, 1), irit.snormal(sb, 0, 0), irit.snormal(sb, 0.1, 0), irit.snormal(sb, 0.3, 0), irit.snormal(sb, 0.5, 0.5), irit.snormal(sb, 0.9, 0.1), irit.snormal(sb, 1, 1))) dlevel = irit.iritstate("dumplevel", dlevel) irit.SetResolution(save_res) # # save("cb", cb); # save("sb", sb); #