Skip to content

Commit fad3638

Browse files
committed
Vecpath stuff initial
1 parent 31a4b11 commit fad3638

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

src/js/mbvecpath_template.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ if (!mbpreserve) mbremoveall(mathbox, ["matrix", "vector"]) //reset old versions
22

33
divisions = span
44

5-
var d1dims = 3
6-
var mbjl_loop = true
7-
var vec_trails = 10
8-
var end_wait_cycles = 4
9-
var vecs_per_sec = 1
10-
115
var end_cycles_waited = 0
126
var firstidx = 0
137
var lastidx = 0
@@ -74,14 +68,30 @@ view
7468
channels: 3,
7569
});
7670

71+
72+
view.readback({
73+
expr: function (x, y, z, w, i, j, k, l) {
74+
console.log(x,y,z,w)
75+
}
76+
})
77+
//gradient of color to clarify of path direction
78+
//colors specified in mbjlinit.js
79+
var colr = colors[3]
7780
view.matrix({
7881
width: drows1/d1dims,
7982
height: dcols1,
8083
expr: function(emit, x, y, t, d){
8184
var idx = x + y*drows1 // baseidx(x,y,t)
82-
colr = colors[(idx/3)%colors.length]
83-
emit(colr.r, colr.g, colr.b, 1)
84-
}
85+
// colr = colors[(idx/3)%colors.length]
86+
if(idx >= firstidx && idx <= lastidx){
87+
total_vecs_displayed = (lastidx-firstidx)/3
88+
curvec = (idx-firstidx)/3
89+
alpha = mbbasic_lerp(0.25, 1, curvec/total_vecs_displayed)
90+
// emit(colr.r*scale, colr.g*scale, colr.b*scale, 1)
91+
emit(colr.r, colr.g, colr.b, alpha)
92+
}
93+
},
94+
channels: 4
8595
})
8696
// Draw a vector
8797
view.vector({
@@ -92,6 +102,7 @@ view.vector({
92102
end: true,
93103
})
94104

105+
//point coordinate labels
95106
view.
96107
array({
97108
data: data1,

src/js/test/vecpath_testinit.js

+6
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ var mbpreserve = false
2020
mbjlparams[divid] = {
2121
wigglefactor: 1
2222
}
23+
24+
var d1dims = 3
25+
var mbjl_loop = true
26+
var vec_trails = 10
27+
var end_wait_cycles = 4
28+
var vecs_per_sec = 1

0 commit comments

Comments
 (0)