te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - 3d surface plot in browser - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - 3d surface plot in browser - Stack Overflow

programmeradmin4浏览0评论

I have a python web server (cherrypy), and I want the user to be able to pute certain surfaces of this precise type. This is what I am able to generate from user input. He gives me some parameters, I pute my things, generate it as PNG on the server (matplotlib/numpy) and send it back through a JQuery load.

Problem is, this is pretty lame, and the surfaces can have various aspects. I'd like to be able to have an actual widget or so that would enable the user to rotate his surface...

My major constraints is that it has to work on IE 7 (8 would be cool as well), and allow the input of the data I pute somehow. I've seen many things on the web that only permit to input parametric functions. What I need is to be able to push in raw data triplets.

I've been looking at several things, Javascript would be the best but I failed to see something in JQuery or equivalents. I did look quite long around WebGL and started implementing stuff...from scratch... but way too long and random behavior in IE sometimes.

Maybe I'm missing out pletely on something, on some technology or format that is patible with my python, but I've spent days before adopting the temporary solution of plotting into PNGs.

Looking forward to reading you guys, Thanks in advance ;)

I have a python web server (cherrypy), and I want the user to be able to pute certain surfaces of this precise type. This is what I am able to generate from user input. He gives me some parameters, I pute my things, generate it as PNG on the server (matplotlib/numpy) and send it back through a JQuery load.

Problem is, this is pretty lame, and the surfaces can have various aspects. I'd like to be able to have an actual widget or so that would enable the user to rotate his surface...

My major constraints is that it has to work on IE 7 (8 would be cool as well), and allow the input of the data I pute somehow. I've seen many things on the web that only permit to input parametric functions. What I need is to be able to push in raw data triplets.

I've been looking at several things, Javascript would be the best but I failed to see something in JQuery or equivalents. I did look quite long around WebGL and started implementing stuff...from scratch... but way too long and random behavior in IE sometimes.

Maybe I'm missing out pletely on something, on some technology or format that is patible with my python, but I've spent days before adopting the temporary solution of plotting into PNGs.

Looking forward to reading you guys, Thanks in advance ;)

Share Improve this question edited Nov 4, 2011 at 17:00 BuZz asked Nov 4, 2011 at 16:13 BuZzBuZz 17.5k34 gold badges92 silver badges147 bronze badges 3
  • 1 Can chrome-frame be a requirement? – fnp Commented Nov 4, 2011 at 17:17
  • Well I was thinking about that, one some forum one guy did a nice summary of the best ways to use WebGL, chrome frame was evaluated as a solution as good as IEWebGL. I cannot consider it tough, because I need an install-less approach.. Sorry ;) – BuZz Commented Nov 4, 2011 at 17:28
  • 1 Worth a shot. It doesn't require admin rights anymore, if that helps – fnp Commented Nov 7, 2011 at 2:00
Add a ment  | 

4 Answers 4

Reset to default 3

As far as I know, if you need IE7 patibility, most of the available libraries in JS won't work for you - they require either canvas or SVG support. You're left with static images, Flash, or Java applets.

I would look into processing, which has good 3D support and can create Java applets for web use. See the 3D tutorials for good examples of interactive 3D surfaces.

If you wanted to get fancy, you could potentially also offer processing.js for browsers that support the canvas element. This would avoid loading a Java applet for those browsers, making for a slightly smoother UI and removing the Java dependency. You'd need to check for browser patibility and then load either the applet code or the processing.js code. The upside of this is that you should be able to use exactly the same processing code in both cases.

have the python script return the vertices/points of the 3D model in json format then use mrdoob's three.js to create a live, javascript-powered, 3D, webGL model directly in the browser.

Check out three.js here: https://github./mrdoob/three.js

(Look at the amazing examples there for inspiration, you can probably get a hold of mrdoob for insights also...)

EDIT: Oops, just noticed the IE7 requirement. No webGL for IE7 :(. You'll have to use Flash for 3D rendering. EIther that or have your python script create different angles of the view that can be loaded as images in the browser (for example the user clicks on the right button and the next image that loads is rotated at a certain angle to the right).

EDIT: Looks like IEWebGL will enable webGL for IE7!

EIDT: processing.js looks really nice for visualizations too!

I was looking for something similar (contour plots in JS) and came across one that looks like it works in IE6 (using excanvas): http://code.google./p/javascript-surface-plot/

It uses the Google Visualization API:

var data = new google.visualization.DataTable();
for (var i = 0; i < numCols; i++) {
    data.addColumn('number', 'col' + i);
}
data.addRows(numRows);
var d = 360 / numRows;
var idx = 0;
for (var i = 0; i < numRows; i++) {
    for (var j = 0; j < numCols; j++) {
        var value = (Math.cos(i * d * Math.PI / 180.0) * Math.cos(j * d * Math.PI / 180.0));
        data.setValue(i, j, value / 4.0);
        tooltipStrings[idx] = "x:" + i + ", y:" + j + " = " + value;
        idx++;
    }
}

so maybe you can load that up with your triplet data.

You want to use Pre3d. It doesn't use WebGL. It uses canvas element. here is the example of it http://www.graphycalc./

Use explorecanvas to add canvas support to IE.

发布评论

评论列表(0)

  1. 暂无评论