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-15.diderot
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2402 - (download) (annotate)
Sat Jul 27 13:55:03 2013 UTC (6 years, 1 month ago) by jhr
File size: 3604 byte(s)
  Create branch for adding OpenCL to vis12 branch.  Based on r2401 of the vis12 branch.
field#2(2)[] T = bspln3 ⊛ image("square-template.nrrd");
field#2(2)[] F = bspln3 ⊛ image("square-rotate.nrrd");

vec2 v00 = [-0.5, -0.5];
vec2 v01 = [-0.5, -0.15];
vec2 v02 = [-0.5, 0.15];
vec2 v03 = [-0.5, 0.5];
vec2 v04 = [-0.15, 0.5];
vec2 v05 = [-0.15, -0.15];
vec2 v06 = [-0.15, 0.15];
vec2 v07 = [-0.15, 0.5];
vec2 v08 = [0.15, -0.5];
vec2 v09 = [0.15, -0.15];
vec2 v10 = [0.15, 0.15];
vec2 v11 = [0.15, 0.5];
vec2 v12 = [0.5, -0.5];
vec2 v13 = [0.5, -0.15];
vec2 v14 = [0.5, 0.15];

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));
        }
        // ********************************************
		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