duangsues.is_a? SaltedFish
60 subscribers
609 photos
6 videos
91 files
562 links
🌶🐔🐟 duangsuse 的日常
尤其喜欢发些奇奇怪怪的东西
和转载别人的东西
Download Telegram
Forwarded from Deleted Account
Forwarded from Deleted Account
好久之前搞的一个验证想法了...
Forwarded from Deleted Account
这是我自己的 activity,那 3 个 app 是运行在 adb process 创建的 virtual display 中的,我只是拿了 3 个 surface 画在一起,然后转发一下触摸事件
#draft #math #gui 想下以我能理解的技术,便于使用和拓展的函数图数据编辑器该怎么做

浮标因为有数轴往往不需要,所以界面基本就函数列表、配置按钮两个控件。
函数列表还是 <details> ,头部 summary 支持拖拽,含两个按钮,是 对齐到边缘/换边 、最小化到配置按钮旁

我要写必须支持(至少是)部分解析的符号系统,应该支持初中程度的等式化简,但不一定支持非线性绘图;反正一定要能做内联/外提/变量更新检测 之类的东西
所以配置页应该支持 eval 表达式,还有 LaTeX 的便利转换什么的

然后支持 URL 参数像这种
&text=group1: y(x)=sin(x); y=tan; x(y)=y+2 [x in 10..20 step 2]; group2: y(x, a=1)=x*a [x in 0..+-a]; animate a -10..10 once/*infinite,cycle,bounce*/; disable last/*y_3*/
&text=:a.txt
&style=.d2-pointer-info{display:none}
&axis=xy/x/y
&grid=no/yes/full/round
&xrange=0..+-10
sy=h; g. textBaseline E bottom";
] else [ signInbound = -1; ] 1 No idea to improve this .g.moveTo(0, sy); g. lineTo(w, sy);for (x=x0; x<ww; x+=x_ delta) [
let Sx = fromPx(x);
lineVert(sx, sy, markerD);

if (hasL) [
let x=x0, x1=ww+leg_ deltaX;for (; x<x1; x+=leg_ deltaX) [
let sx = fromPx(x);
g.fillText(showNum(x), sx, sy+markerD* (2*signInbound));lineVert(sx, sy, markerD*2)
if (someGrid) lineVert(sx, 0, h);

]
]
strokeAxes();

if (axis & 0b100) [
newPath(); g.textAlign = "left";let sx = fromPx(0);
let markerD = markerW; 11 slight different from aboveif (sx<=0) [ sx=0; ]else if (sx>w)
sx=w; markerD= -markerW;g.textAlign = "right";

g.moveTo(sx, 0); g. lineTo(sx, h);if (hasL) f
let y=ybounds[0], y1=ybounds[1]+leg_ deltaY;for (; y<y1; y+=leg deltaY) l
let sy = fromPy(y);
g. fillText(showNum(y), sx+markerD*2, sy+markerD);lineHorz(sx, sy, markerD*2);
if (someGrid) lineHorz(0, sy, w);

]
if (allGrid) [
let d= (y1-y) 1 miniorGridLDiv;
for (y=ybounds[0]; y<y1; y+=d) iineHorz(, fromPy(v)l w);

strokeAxes();
]
g. beginPath();
for (x=x0, x1=ww; x<x1; x+=x_ delta) f
y = y_func(x);
if (y<ybounds[0]) ybounds[0]=y;
else if (y>ybounds[1]) ybounds[1]=y;
g. lineTo(fromPx(x); fromPy(y)); 11 Draw func!

g.strokeStyle = color;g.stroke();
if (fromPx(x1-(x-x delta)) > 1) [ 11 Render hor-end line!
newPath()
g. moveTo(fromPx(x-x_ delta), fromPy(y));g.strokeStyle = cfg.noL inecolor;g. lineTo(w, fromPy(y));stroke( );

);
]
g.closePath();
if. (pressed[km_ scale]) i
if (v<0) v=1/-v; 11 scale down
if (!pressed[km_ _xmove]) scale[0]*=v; scale[1]*=v/*y-only*/;] else [
vp[(pressed[km_ .xmove])? 0 : 1] += v*cfg. moveSpeed;
onDraw. begin();]);
bindkeyNavigation(eGraph, vp_ .xy, scale_ _xy, "Shift", "Control");</script>
<script>
const y_ funcs = [["sin", Math.sin, 0.01, "red"], ["x**2", x=>x*x, 0.1,const idf = (from, into) => x => from(into(from(x)));
onDraw.begin = () => f
let [w, h] = wh;
g.clearRect(0,0, w,h);
let [vx, vy] = vp_ xy; 11 unit: pxlet [kx, ky] = scale_ xy; :
const intoPx = x => (x-vx)/w*kx, fromPx = px => px/kx*w+vx,
fromPy = y => h-h*(y+vy/w*ky/ *move speed*/ )/ky,11 orig func: -((y+vy/w"ky)/ky)*h +h
intoPy F py => (-(py-h)/h)*ky/ky-vy/w 1/-(ky*(h*vy-h*w+py*w)/(h*w))for (let [code, y_ func, x_ _delta, color] of y_ funcs) [
g.strokeStyle = color;g. beginPath();
for (let x=intoPx(0), x1=intoPx(w); x<x1; x+=x_ delta) l
let y = y_func(x);
g. lineTo(idf(fromPx, intoPx)(x), idf(fromPy, intoPy)(y));
g.LineTo(fromPx(x), fromPy(y));

g.strokeStyle m color;g.stroke();

if (fromPx(x1-(x-x. _delta)) > 1) [

newPath(); 11 render hor-end line

g, moveTo(fromPx(x-x_ delta), fromPy(y));g.strokeStyle . cfg. noLineCo Lor;g.lineTo(w, fromPy(y));stroke();

g.strokeStyle . "black"; 11 draw axes!

const [markerW, legendFont, legendLDiv, axis, showNum) . cfg;g.font m legendFont;

g.textBaseline m "top";let hasL . axis & 0bl;if (axis & 0b010) [

newPath( );

let sy . fromPy((x-0)/w*kx/*-intoPx"/);g.textAlign . "center" ; let markerD, nSign . 1;if (sy<0) [ sy#0

markerD . -markerw; else if (sy>h) ( sy=h

g.textBaseline . "bottom";markerD . markerW;

) else [ markerD . markeriW; 15191. -1; ]g.moveTo(0, sy); g. lineTo(w, sy);

for (xwintoPx(Ó); x<xl; x+=ж_ delta) [

let Sx m fromPx(x);

lineVert(sx, sy, markerD);íf (hasL) (

let d . w/legendLDiv;

for (let sx=Õ; sx<w+d; sx+=d) [

let x m intoPx(sx);

g.fillText(showium(x), 5x, sy-markerD* nSign*2);lineVert(sx, sy, markerD*2);

stroke();

if (aжis & 0b100) [

newPath();

let 5x . coerceIn(o, w-markerW, fromPx(0));g.textAlign m "left";let markerD m markerw; :

g.moveTo(sx, 0); g. LineTo(sx, h);if (hasL)[

let d . h/legendLDiv;

for (let sy=Ö;_ sy<h+d; sy+=d) [

let y . intoPy(sy);

g.fillText( showNum(y), sx+markerw, sy+markerW);lineHorz(sx, sy, markerD*2);

stroke();

.closePath();
Forwarded from dnaugsuz
现在的状态是不断卡住 我都想去用同样坐标API的 funcplot.com 抄绘制代码了……
Forwarded from dnaugsuz
我的技巧是不翻了睡大觉,自己写一个
除了 grep , ctags 外还有什么技巧…… 大概是猜作者对某功能点的实现方法吧
其实我也不常看人代码,自己完全重写比较多些,感觉分块(量/辅助函数/事件入口定义)清晰但命名冗长的代码可以快览,但是经验之谈没法教

对了,还可以用 VCS diff ,还有调试器断点
Forwarded from dnaugsuz
大佬 😋
不常用IDE补全外功能的我
Forwarded from dnaugsuz
说起来我看现在的一些调试器是越来越不顺眼了,允许断点时执行代码可以解决 debug print 重编译之类的问题,举手之劳,竟然没有几个调试器支持这种操作
Forwarded from dnaugsuz
那些设计调试器的人自己到底用不用调试器,什么流程都手动 step? 就看看 source, 太弱智了
Forwarded from dnaugsuz
就是在断点时有默认调试器指令序列,像如果值不符合什么条件直接继续
不必每次提示程序员
Forwarded from dnaugsuz
还可以 generalize ,直接执行代码去判断 ,能做更多事
比如说完全取代 debug print 或者去做 Frida 那样的 AOP 注入代码测试
Forwarded from dnaugsuz
Firefox 的不支持,气死我了
还搞 inline var preview ,根本过度设计
Forwarded from dnaugsuz
要重编译啊,我ts
Forwarded from dnaugsuz
关键是 developer console 方便啊
其实插入 script 也可以做到注入,但是为什么没内部支持
Forwarded from dnaugsuz
firefox 啊
我不用 Node npm 的