使用GeoGebra来进行项目辅助开发

4 篇文章 0 订阅

在开发包围盒寻路算法的过程中,经常碰到一个问题,就是虽然抓到了现场的数据,但是想通过数据还原场景就需要非常多的功夫,特别是还要想办法将地形绘制出来,往往这一步最耗时间,而且还可能因为绘制不精确导致某些线索的丢失。于是萌生了借助某些软件来实现现场还原的想法。最开始想用cad软件,但cad软件虽然可以支持命令输入,但cad软件操作太复杂了,用起来很不习惯。

后来在网上找到一个软件:GeoGebra几何。这个软件非常轻量级,但很好用,是一款数学绘图软件,虽然不支持直接批量输入绘图命令,但支持给对象导入js脚本。通过脚本来绘制批量图形,这样就彻底解决了我的问题。

通过放置一个按钮,然后把按钮的点击事件设置为javascript,然后把程序生成的脚本拷贝进去,点击按钮就可以显示效果,绘制出来的效果也不错。

下面是一个绘制的脚本示例,如果有朋友对GeoGebra来辅助开发有兴趣,可以参考这个它的脚本系统,详细的资料可以在官网找到。

ggbApplet.setAxesVisible(true, true);
ggbApplet.setCoordSystem(-90.20178, 1629.32966, -38.77859, 1090.65119);
ggbApplet.setGridVisible(true);
ggbApplet.evalCommand("S=(166.000000, 564.867554)\n E=(512.000000, 535.000000)\n u=Circle((166.000000, 564.867554), 2.000000)\n p=Segment((166.000000, 564.867554), (512.000000, 535.000000))\n border88083=Circle((350.000000, 512.000000), 14.000000)\n unit88083=Circle((350.000000, 512.000000), 12.000000)\n border88089=Circle((510.889160, 534.921997), 3.000000)\n unit88089=Circle((510.889160, 534.921997), 1.000000)\n border88090=Circle((511.768219, 534.984009), 3.000000)\n unit88090=Circle((511.768219, 534.984009), 1.000000)\n border88091=Circle((510.804840, 532.988831), 3.000000)\n unit88091=Circle((510.804840, 532.988831), 1.000000)\n border88092=Circle((510.815125, 533.003845), 3.000000)\n unit88092=Circle((510.815125, 533.003845), 1.000000)\n border88093=Circle((511.848053, 534.989502), 3.000000)\n unit88093=Circle((511.848053, 534.989502), 1.000000)\n item8=Polygon((216.000000, 456.000000), (252.000000, 456.000000), (252.000000, 480.000000), (216.000000, 480.000000))\n border8=Polygon((214.000000, 454.000000), (254.000000, 454.000000), (254.000000, 482.000000), (214.000000, 482.000000))\n item2=Polygon((480.000000, 348.000000), (552.000000, 348.000000), (552.000000, 480.000000), (480.000000, 480.000000))\n border2=Polygon((478.000000, 346.000000), (554.000000, 346.000000), (554.000000, 482.000000), (478.000000, 482.000000))\n item1=Polygon((480.000000, 552.000000), (552.000000, 552.000000), (552.000000, 696.000000), (480.000000, 696.000000))\n border1=Polygon((478.000000, 550.000000), (554.000000, 550.000000), (554.000000, 698.000000), (478.000000, 698.000000))\n item20=Polygon((348.000000, 528.000000), (396.000000, 528.000000), (396.000000, 564.000000), (348.000000, 564.000000))\n border20=Polygon((346.000000, 526.000000), (398.000000, 526.000000), (398.000000, 566.000000), (346.000000, 566.000000))\n item16=Polygon((216.000000, 564.000000), (252.000000, 564.000000), (252.000000, 612.000000), (216.000000, 612.000000))\n border16=Polygon((214.000000, 562.000000), (254.000000, 562.000000), (254.000000, 614.000000), (214.000000, 614.000000))\n item17=Polygon((240.000000, 552.000000), (444.000000, 552.000000), (444.000000, 636.000000), (240.000000, 636.000000))\n border17=Polygon((238.000000, 550.000000), (446.000000, 550.000000), (446.000000, 638.000000), (238.000000, 638.000000))\n item15=Polygon((168.000000, 564.000000), (228.000000, 564.000000), (228.000000, 600.000000), (168.000000, 600.000000))\n border15=Polygon((166.000000, 562.000000), (230.000000, 562.000000), (230.000000, 602.000000), (166.000000, 602.000000))\n ");
ggbApplet.setColor("S", 200, 0, 0);
ggbApplet.setColor("S", 200, 0, 0);
ggbApplet.setColor("E", 200, 0, 0);
ggbApplet.setColor("E", 200, 0, 0);
ggbApplet.setColor("u", 255, 102, 0);
ggbApplet.setFilling("u", 0.8);
ggbApplet.setColor("border88083", 100, 224, 130);
ggbApplet.setFilling("border88083", 0.3);
ggbApplet.setColor("unit88083", 80, 180, 100);
ggbApplet.setFilling("unit88083", 0.8);
ggbApplet.setColor("border88089", 100, 224, 130);
ggbApplet.setFilling("border88089", 0.3);
ggbApplet.setColor("unit88089", 80, 180, 100);
ggbApplet.setFilling("unit88089", 0.8);
ggbApplet.setColor("border88090", 100, 224, 130);
ggbApplet.setFilling("border88090", 0.3);
ggbApplet.setColor("unit88090", 80, 180, 100);
ggbApplet.setFilling("unit88090", 0.8);
ggbApplet.setColor("border88091", 100, 224, 130);
ggbApplet.setFilling("border88091", 0.3);
ggbApplet.setColor("unit88091", 80, 180, 100);
ggbApplet.setFilling("unit88091", 0.8);
ggbApplet.setColor("border88092", 100, 224, 130);
ggbApplet.setFilling("border88092", 0.3);
ggbApplet.setColor("unit88092", 80, 180, 100);
ggbApplet.setFilling("unit88092", 0.8);
ggbApplet.setColor("border88093", 100, 224, 130);
ggbApplet.setFilling("border88093", 0.3);
ggbApplet.setColor("unit88093", 80, 180, 100);
ggbApplet.setFilling("unit88093", 0.8);
ggbApplet.setColor("border8", 50, 150, 224);
ggbApplet.setFilling("border8", 0.3);
ggbApplet.setColor("item8", 60, 130, 180);
ggbApplet.setFilling("item8", 0.8);
ggbApplet.setColor("border2", 50, 150, 224);
ggbApplet.setFilling("border2", 0.3);
ggbApplet.setColor("item2", 60, 130, 180);
ggbApplet.setFilling("item2", 0.8);
ggbApplet.setColor("border1", 50, 150, 224);
ggbApplet.setFilling("border1", 0.3);
ggbApplet.setColor("item1", 60, 130, 180);
ggbApplet.setFilling("item1", 0.8);
ggbApplet.setColor("border20", 50, 150, 224);
ggbApplet.setFilling("border20", 0.3);
ggbApplet.setColor("item20", 60, 130, 180);
ggbApplet.setFilling("item20", 0.8);
ggbApplet.setColor("border16", 50, 150, 224);
ggbApplet.setFilling("border16", 0.3);
ggbApplet.setColor("item16", 60, 130, 180);
ggbApplet.setFilling("item16", 0.8);
ggbApplet.setColor("border17", 50, 150, 224);
ggbApplet.setFilling("border17", 0.3);
ggbApplet.setColor("item17", 60, 130, 180);
ggbApplet.setFilling("item17", 0.8);
ggbApplet.setColor("border15", 50, 150, 224);
ggbApplet.setFilling("border15", 0.3);
ggbApplet.setColor("item15", 60, 130, 180);
ggbApplet.setFilling("item15", 0.8);

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值