Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis12-cl/test/square-detect/square_score-40.diderot
ViewVC logotype

View of /branches/vis12-cl/test/square-detect/square_score-40.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1817 - (download) (annotate)
Tue Apr 10 16:12:03 2012 UTC (7 years, 5 months ago) by nseltzer
Original Path: branches/vis12/test/square-detect/square_score-40.diderot
File size: 8507 byte(s)
Performance issue examples.
field#2(2)[] T = bspln3 ⊛ load("square-template.nrrd");
field#2(2)[] F = bspln3 ⊛ load("square-rotate.nrrd");

vec2 v00 = [-0.5, -0.5];
vec2 v01 = [-0.5, -0.3];
vec2 v02 = [-0.5, -0.1];
vec2 v03 = [-0.5, 0.1];
vec2 v04 = [-0.5, 0.3];
vec2 v05 = [-0.5, 0.5];
vec2 v06 = [-0.3, -0.5];
vec2 v07 = [-0.3, -0.3];
vec2 v08 = [-0.3, -0.1];
vec2 v09 = [-0.3, 0.1];
vec2 v10 = [-0.3, 0.3];
vec2 v11 = [-0.3, 0.5];
vec2 v12 = [-0.1, -0.5];
vec2 v13 = [-0.1, -0.3];
vec2 v14 = [-0.1, -0.1];
vec2 v15 = [-0.1, 0.1];
vec2 v16 = [-0.1, 0.3];
vec2 v17 = [-0.1, 0.5];
vec2 v18 = [0.1, -0.5];
vec2 v19 = [0.1, -0.3];
vec2 v20 = [0.1, -0.1];
vec2 v21 = [0.1, 0.1];
vec2 v22 = [0.1, 0.3];
vec2 v23 = [0.1, 0.5];
vec2 v24 = [0.3, -0.5];
vec2 v25 = [0.3, -0.3];
vec2 v26 = [0.3, -0.1];
vec2 v27 = [0.3, 0.1];
vec2 v28 = [0.3, 0.3];
vec2 v29 = [0.3, 0.5];
vec2 v30 = [0.5, -0.5];
vec2 v31 = [0.5, -0.3];
vec2 v32 = [0.5, -0.1];
vec2 v33 = [0.5, 0.1];
vec2 v34 = [0.5, 0.3];
vec2 v35 = [0.5, 0.5];
vec2 v36 = [0.0, 0.0];
vec2 v37 = [0.0, 0.0];
vec2 v38 = [0.0, 0.0];
vec2 v39 = [0.0, 0.0];

strand R (int i, int j, int k)
{
	vec3 t = [real(i) / 60.0 - 0.5, real(j) / 60.0 - 0.5, real(k) / 60.0 - 0.5];
    output real score = 0.0;

	vec2 r0 = [0.0, 0.0];
	vec2 r1 = [0.0, 0.0];

	vec2 pos = [0.0, 0.0];


	update
	{
		r0 = [1.0 - 2.0 * t[2] * t[2], -2.0*sqrt(1.0 - t[2] * t[2]) * t[2]];
		r1 = [2.0 * sqrt(1.0 - t[2] * t[2]) * t[2], 1.0 - 2.0 * t[2] * t[2]];


        // v00
		pos = [r0 • v00, r1 • v00] + [t[0], t[1]];
		if(inside(pos,F) && inside (v00, T))
        {
        score += (F(pos) - T(v00)) * (F(pos) - T(v00));
        }
        // v01
		pos = [r0 • v01, r1 • v01] + [t[0], t[1]];
		if(inside(pos,F) && inside (v01, T))
        {
		score += (F(pos) - T(v01)) * (F(pos) - T(v01));
        }
        // v02
		pos = [r0 • v02, r1 • v02] + [t[0], t[1]];
		if(inside(pos,F) && inside (v02, T))
        {
		score += (F(pos) - T(v02)) * (F(pos) - T(v02));
        }
        // v03
		pos = [r0 • v03, r1 • v03] + [t[0], t[1]];
		if(inside(pos,F) && inside (v03, T))
        {
		score += (F(pos) - T(v03)) * (F(pos) - T(v03));
        }
        // v04
		pos = [r0 • v04, r1 • v04] + [t[0], t[1]];
		if(inside(pos,F) && inside (v04, T))
        {
		score += (F(pos) - T(v04)) * (F(pos) - T(v04));
        }
        // v05
		pos = [r0 • v05, r1 • v05] + [t[0], t[1]];
		if(inside(pos,F) && inside (v05, T))
        {
		score += (F(pos) - T(v05)) * (F(pos) - T(v05));
        }
        // v06
		pos = [r0 • v06, r1 • v06] + [t[0], t[1]];
		if(inside(pos,F) && inside (v06, T))
        {
		score += (F(pos) - T(v06)) * (F(pos) - T(v06));
        }
        // v07
		pos = [r0 • v07, r1 • v07] + [t[0], t[1]];
		if(inside(pos,F) && inside (v07, T))
        {
		score += (F(pos) - T(v07)) * (F(pos) - T(v07));
        }
        // v08
		pos = [r0 • v08, r1 • v08] + [t[0], t[1]];
		if(inside(pos,F) && inside (v08, T))
        {
		score += (F(pos) - T(v08)) * (F(pos) - T(v08));
        }
        // v09
		pos = [r0 • v09, r1 • v09] + [t[0], t[1]];
		if(inside(pos,F) && inside (v09, T))
        {
		score += (F(pos) - T(v09)) * (F(pos) - T(v09));
        }
        // v10
		pos = [r0 • v10, r1 • v10] + [t[0], t[1]];
		if(inside(pos,F) && inside (v10, T))
        {
		score += (F(pos) - T(v10)) * (F(pos) - T(v10));
        }
        // v11
		pos = [r0 • v11, r1 • v11] + [t[0], t[1]];
		if(inside(pos,F) && inside (v11, T))
        {
		score += (F(pos) - T(v11)) * (F(pos) - T(v11));
        }
        // v12
		pos = [r0 • v12, r1 • v12] + [t[0], t[1]];
		if(inside(pos,F) && inside (v12, T))
        {
		score += (F(pos) - T(v12)) * (F(pos) - T(v12));
        }
        // v13
		pos = [r0 • v13, r1 • v13] + [t[0], t[1]];
		if(inside(pos,F) && inside (v13, T))
        {
		score += (F(pos) - T(v13)) * (F(pos) - T(v13));
        }
        // v14
		pos = [r0 • v14, r1 • v14] + [t[0], t[1]];
		if(inside(pos,F) && inside (v14, T))
        {
		score += (F(pos) - T(v14)) * (F(pos) - T(v14));
        }
        // v15
		pos = [r0 • v15, r1 • v15] + [t[0], t[1]];
		if(inside(pos,F) && inside (v15, T))
        {
		score += (F(pos) - T(v15)) * (F(pos) - T(v15));
        }
        // v16
		pos = [r0 • v16, r1 • v16] + [t[0], t[1]];
		if(inside(pos,F) && inside (v16, T))
        {
		score += (F(pos) - T(v16)) * (F(pos) - T(v16));
        }
        // v17
		pos = [r0 • v17, r1 • v17] + [t[0], t[1]];
		if(inside(pos,F) && inside (v17, T))
        {
		score += (F(pos) - T(v17)) * (F(pos) - T(v17));
        }
        // v18
		pos = [r0 • v18, r1 • v18] + [t[0], t[1]];
		if(inside(pos,F) && inside (v18, T))
        {
		score += (F(pos) - T(v18)) * (F(pos) - T(v18));
        }
        // v19
		pos = [r0 • v19, r1 • v19] + [t[0], t[1]];
		if(inside(pos,F) && inside (v19, T))
        {
		score += (F(pos) - T(v19)) * (F(pos) - T(v19));
        }
        // v20
		pos = [r0 • v20, r1 • v20] + [t[0], t[1]];
		if(inside(pos,F) && inside (v20, T))
        {
		score += (F(pos) - T(v20)) * (F(pos) - T(v20));
        }
        // v21
		pos = [r0 • v21, r1 • v21] + [t[0], t[1]];
		if(inside(pos,F) && inside (v21, T))
        {
		score += (F(pos) - T(v21)) * (F(pos) - T(v21));
        }
        // v22
		pos = [r0 • v22, r1 • v22] + [t[0], t[1]];
		if(inside(pos,F) && inside (v22, T))
        {
		score += (F(pos) - T(v22)) * (F(pos) - T(v22));
        }
        // v23
		pos = [r0 • v23, r1 • v23] + [t[0], t[1]];
		if(inside(pos,F) && inside (v23, T))
        {
		score += (F(pos) - T(v23)) * (F(pos) - T(v23));
        }
        // v24
		pos = [r0 • v24, r1 • v24] + [t[0], t[1]];
		if(inside(pos,F) && inside (v24, T))
        {
		score += (F(pos) - T(v24)) * (F(pos) - T(v24));
        }
        // v25
		pos = [r0 • v25, r1 • v25] + [t[0], t[1]];
		if(inside(pos,F) && inside (v25, T))
        {
		score += (F(pos) - T(v25)) * (F(pos) - T(v25));
        }
        // v26
		pos = [r0 • v26, r1 • v26] + [t[0], t[1]];
		if(inside(pos,F) && inside (v26, T))
        {
		score += (F(pos) - T(v26)) * (F(pos) - T(v26));
        }
        // v27
		pos = [r0 • v27, r1 • v27] + [t[0], t[1]];
		if(inside(pos,F) && inside (v27, T))
        {
		score += (F(pos) - T(v27)) * (F(pos) - T(v27));
        }
        // v28
		pos = [r0 • v28, r1 • v28] + [t[0], t[1]];
		if(inside(pos,F) && inside (v28, T))
        {
		score += (F(pos) - T(v28)) * (F(pos) - T(v28));
        }
        // v29
		pos = [r0 • v29, r1 • v29] + [t[0], t[1]];
		if(inside(pos,F) && inside (v29, T))
        {
		score += (F(pos) - T(v29)) * (F(pos) - T(v29));
        }
        // v30
		pos = [r0 • v30, r1 • v30] + [t[0], t[1]];
		if(inside(pos,F) && inside (v30, T))
        {
		score += (F(pos) - T(v30)) * (F(pos) - T(v30));
        }
        // v31
		pos = [r0 • v31, r1 • v31] + [t[0], t[1]];
		if(inside(pos,F) && inside (v31, T))
        {
		score += (F(pos) - T(v31)) * (F(pos) - T(v31));
        }
        // v32
		pos = [r0 • v32, r1 • v32] + [t[0], t[1]];
		if(inside(pos,F) && inside (v32, T))
        {
		score += (F(pos) - T(v32)) * (F(pos) - T(v32));
        }
        // v33
		pos = [r0 • v33, r1 • v33] + [t[0], t[1]];
		if(inside(pos,F) && inside (v33, T))
        {
		score += (F(pos) - T(v33)) * (F(pos) - T(v33));
        }
        // v34
		pos = [r0 • v34, r1 • v34] + [t[0], t[1]];
		if(inside(pos,F) && inside (v34, T))
        {
		score += (F(pos) - T(v34)) * (F(pos) - T(v34));
        }
        // v35
		pos = [r0 • v35, r1 • v35] + [t[0], t[1]];
		if(inside(pos,F) && inside (v35, T))
        {
		score += (F(pos) - T(v35)) * (F(pos) - T(v35));
        }
        // v36
		pos = [r0 • v36, r1 • v36] + [t[0], t[1]];
		if(inside(pos,F) && inside (v36, T))
        {
		score += (F(pos) - T(v36)) * (F(pos) - T(v36));
        }
        // v37
		pos = [r0 • v37, r1 • v37] + [t[0], t[1]];
		if(inside(pos,F) && inside (v37, T))
        {
		score += (F(pos) - T(v37)) * (F(pos) - T(v37));
        }
        // v38
		pos = [r0 • v38, r1 • v38] + [t[0], t[1]];
		if(inside(pos,F) && inside (v38, T))
        {
		score += (F(pos) - T(v38)) * (F(pos) - T(v38));
        }
        // v39
		pos = [r0 • v39, r1 • v39] + [t[0], t[1]];
		if(inside(pos,F) && inside (v39, T))
        {
		score += (F(pos) - T(v39)) * (F(pos) - T(v39));
        }
        // ********************************************
		stabilize;
	}
}

initially [ R(i, j, k) | i in 0..60, j in 0..60 , k in 0..60];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0