Are there any good open source SceneJS examples that can graph functions similar to those demonstrated in http://www.graphycalc.com/?
I haven't seen any but it should be relatively easy to simply use a custom vertex shader that transforms the vertices of a grid into your desired function: https://github.com/xeolabs/scenejs/wiki/shader
You can also use a data source plugin with a geometry node, to continually update it's mesh:
http://scenejs.org/examples.html?page=geometryPluginPullStream
http://scenejs.org/examples.html?page=geometryPluginPushStream
And here's the available vertex deformation examples (selected by tag, see left column, click one to load it):
http://scenejs.org/examples.html?tags=vertexDisplacement
Related
I am using the Edit2D extension on an svf created from a 2D dwg file and have a question about transforms. The Autodesk.Edit2D.Polygon's that are created have a getArea() method which is great. However it's not in the correct unit scale. I tested one and something that should be roughly 230sf in size is coming back as about 2.8.
I notice that the method takes an argument of type Autodesk.Edit2D.MeasureTransform which I'm sure is what I need, however I don't know how to get that transform. I see that I can get viewer.model.getData().viewports[1].transform. However, that is just an array of 16 numbers and not a transform object so it creates an error when I try to pass it in.
I have not been able to find any documentation on this. Can someone tell me what units this is coming back in and/or how to convert to the same units as the underlying dwg file?
Related question, how do I tell what units the underlying DWG is in?
EDIT
To add to this, I tried to get all polylines in the drawing which have an area property. In this case I was able to figure out that the polyline in the underlying dwg was reporting its area in square inches (not sure if that's always the case). I generated Edit2D polygons based on the polylines so it basically just drew over them.
I then compared the area property from the polyline to the result of getArea() on the polygon to find the ratio. In this case it was always about 83 or 84 times smaller than the square foot value of the polyline it came from (there is some degree of error in my tracing system so I don't expect they would be exact at this point). However, that doesn't fit any unit value that I know of. So remaining questions:
What unit is this?
Is this consistent or do I need to look somewhere else for this scale?
Maybe you missed the section 3.2 Units for Areas and Lengths of https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/advanced_options/edit2d-use/
If you use Edit2D without the MeasureExtension, it will display all coordinates in model units. You can customize units by modifying or replacing DefaultUnitHandler. More information is available in the Customize Edit2D tutorial.
and https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/advanced_options/edit2d-customize/
BTW, we can get the DefaultUnitHandler by edit2dExt.defaultContext.unitHandler
Ok after a great deal of experimentation and frustration I think I have it working. I ended up looking direction into the js for the getArea() method in dev tools. Searching through the script, I found a class called DefaultMeasureTransform that inherits from MeasureTransform and takes a viewer argument. I was able to construct that and then pass it in as an argument to getArea():
const transform = new Autodesk.Edit2D.DefaultMeasureTransform(viewer);
const area = polygon.getArea(transform);
Now the area variable matches the units in the original cad file (within acceptable rounding error anyway, it's like .05 square inches off).
Would be nice to have better documentation on the coordinate systems, am I missing it somewhere? Either way this is working so hopefully it helps someone else.
I am now using ITK library to image registration. I wonder, when setting initial parameters for ImageRegistrationMethodv4 type registration, shall I use SetMovingInitialTransform and SetFixedInitialTransform like in the tutorial, or just SetInitialTransform??
The "transform" in SetInitialTransform means transform for moving image or for fixed image? Thank you:)
(Please read this with caution--I do not have the library with me to test this answer; it's based on memory only.)
I believe SetInitialTransform() refers to the transform which is actually optimized by the registration method. In other words, it is a collection of transform parameters that specify an "initial guess" for the optimization process; these parameters will then start moving around at each iteration. (They are therefore applied to the moving image.)
I think SetMovingInitialTransform() and SetFixedInitialTransform() refer to static initial transforms which do no change at all during the registration process. They merely "set up" the moving and fixed images to desired starting locations, if you are not satisfied with their default positions in space.
If you have some simple 2D images, try testing this answer out with simple initial transformations, like a 5-unit translation transformation or something.
You could try reading the ImageRegistrationMethov4 documentation for a little more info.
I've been working a lot with AGAL vertex and fragment shaders. I've got individual objects lit correctly (including specular shading) but I'd like to have objects cast shadows on OTHER objects. I have looked online, but I think most people working directly with AGAL have built custom Stage3D libraries and the shadow-casting solution doesn't seem to be in the public domain. Anyone willing to change that?
I'd like to know how to get an object to cast a shadow on another. I can't post what I've tried, because I can't get my head around where to begin on this problem. How would you pass the information (whether other objects are blocking the light) into another object's shader?
Thanks.
IT's called Deferred shading, you have to do 2 pass of vertex and fragment shaders.
In the first pass you accumulate informations about distances, normals, occlusion...
In the second pass you render and apply the informations of the first pass to make shadows.
Another options is ShadowMapping:
Basic shadowmap
The basic shadowmap algorithm consists in two passes. First, the scene is rendered from the point of view of the light. Only the depth of each fragment is computed. Next, the scene is rendered as usual, but with an extra test to see it the current fragment is in the shadow.
The “being in the shadow” test is actually quite simple. If the current sample is further from the light than the shadowmap at the same point, this means that the scene contains an object that is closer to the light. In other words, the current fragment is in the shadow.
How to apply multiple filters in Adobe Pixelbender in Flash (=limited version)?
For example 3 different kinds of video displacement effects (1 displacement on the left, one on the right and one the top).
I know, it possible to just copy paste the code multiple times, but this wouldn't be very elegant.
It supposes to apply the second filter after the first filter is applied and the third filter after the second filter is applied.
You can apply pixel bender filters as Shader objects. Then just use:
myDisplayObject.filters = [shader1, shader2, shader3, ...etc];
Specifically, you use the ShaderFilter object. You can find a complete code sample in the documentation here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/ShaderFilter.html#includeExamplesSummary
You can also see a tutorial from Adobe here: http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS6FCADA8A-C82B-4d55-89AC-63CA9DEFF9C8.html
I have been developing a software package to plot astronomical data in the form of a movie. It looks like this.
To do this, I export 100 tables of data from Java to gnuplot and use a bash script to turn them into a GIF. I want instead to do it in HTML and maybe Raphael.
I'm thinking that I can use a Python script to iterate through folders and build a hundred plots, and then cycle through them. Any ideas on this? How can I get them to cycle?
You will have to test performance issues, but FLOT might be just the thing for you...
here is an example of flot animating:
http://people.iola.dk/olau/flot/examples/realtime.html
I think a canvas is what you need. Just draw all the points, clear the canvas, and redraw
your code would look something like this pseduo code
for each frame
for each point
canvas.draw point at x, y
end
clear canvas
end
Even I was looking for something similar, I found this one link will be trying it out http://humblesoftware.com/flotr2/