Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm going to write a simple animation in XPCE (four glasses puzzle to be precise). I know absolutely nothing about XPCE so I looked up a tutorial but the results are disappointing. Could anyone point me to some materials on the following:
working with a "canvas"
animation
timers
EDIT: Okay, here's a more detailed problem: I want to draw two boxes, wait two seconds, hide the boxes, then start a timer.
new(#box1, box(100,100)),
send(W, display, #box1),
new(#box2, box(100,100)),
send(W, display, #box2, point(200, 200)),
% wait two seconds here
% hide the boxes here
new(Msg1, and(message(B1, relative_move, point(5, 0)),
message(B4, relative_move, point(0, 5)))),
send(W, attribute, attribute(timer, new(T, timer(0.1, Msg1)))),
send(T, start),
EDIT 2: Okay, here is another question (should I open a new question?): This is the code I'm using:
get_file(0, 'glass.gif').
get_file(180, 'glass180.gif').
main(GA, GB, GC, GD) :- % e.g. main(0,0,180,0).
new(B1, figure),
get_file(GA, G1),
send(B1, display, new(BM1, bitmap(G1))),
send(BM1, transparent, #on),
send(W, display, B1, point(0,0)),
%analogically for the other three glasses
I'd like to set a new bitmap for B1. How do I do that? Would altering BM1 be enough? Or perhaps there is an alternative solution? I've been thinking about drawing both upright and reversed glasses off-screen and swapping them, but I'm not sure about the details of such solution.
EDIT2': Solved it. For posterity:
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_1.gif')),
send(timer(0.1), delay),
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_2.gif')),
% etc
Would this searchable pdf be of help?
link text
"Chapter 5. Simple graphics" talks about a picture (ie. a canvas).
On page 260 there's an example of using a timer to introduce a delay, and page 266 shows using a timer for a blinking graphical.
On page 40 there's a mention of utilizing 'graphical->flush' to explicitly force redraw right now.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm trying to learn how to do some 360 image edits like the site below, and I'm really just looking for any information to point me in the right direction. All I was told by the site owners was "we cant give away anything, but three.js".
Can anyone else help point me in the right direction. I've googled it and its basically sending me in circles.
I just want to be able to move from location to location like Street view and add pointers/annotations.
https://www.xplorit.com/long-beach
Using THREE.js you can set your panoramic photo as the texture on a sphere... You have to flip the .side of the material so it only draws the inside of the sphere.. then use the OrbitController to let the user zoom in/out/rotate the view..
Check out this demo here, and see if you can drag one of your equirectangular images on it:
https://threejs.org/examples/webgl_panorama_equirectangular.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm trying to add few animations to my game. I searched a bit for some animations software but everything I found was too complicated for me. Is there any simple animation software which I can use with Unity or should I just stick to default Unity animation tool?
If you want to roll it as you said, you can accomplish this in several ways without exiting Unity.
For instance, here are some :
Using an Animator component in the cube and applying a premade Animation (made within Unity via Animation window, just change transform rotation properties)
Using Physics to apply a constant rotation force (torque)
Using scripting to modify transform rotation properties on each frame update (c# or javascript)
Probably more exist but those are the simplest and easiest.
If I were to choose one, Animator + Animations would be my choice. Also have in mind that this component (Animator) is much better performance wise than any other solution when used on several instances in the scene (lots of cubes).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
OK. Let's say that I have 2 images. The first is a set of lines that form a grid with a circle. The second is the same grid and circle DISTORTED. The second image is the distorted result of the first image when it is stretched over a 3D solid.
What I want to do is morph the circle in the second distorted image to where it would be in the first image before distortion. Stated differently, I want to predict what shape the circle needs to be before distortion so that when it is distorted it ends up looking like the perfect circle in the first image.
The grid is only there as an aid, I am really interested in the circle. The circle is just an idealized image. In real life the "circle" represents a graphic of some kind. The two images would be actual scans from the sheet before and after distortion. The distortion is also just idealized. In real life it is more complicated than this.
I am open to commercial software or using Matlab or other software to write something. I just have no idea where to start on this one. All ideas are appreciated.
BTW...here is a post that is somewhat similar in nature.
Original - Undistorted image:
After distortion:
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there any library for converting a raster image to a vector one limiting the number of sampled colours to a specific set? Something like what is done in VectorMagic but giving a subset of colours to be used.
Imagetracer is a free and open source (Public Domain) library and application which might be useful. Disclaimer: I made these.
If you need a command line application, I recommend ImageTracer.jar from
https://github.com/jankovicsandras/imagetracerjava
with options like these
java -jar ImageTracer.jar input.png outfilename output.svg numberofcolors 4
to limit the number of colors to 4. If you call the library from a Java program, you can use custom palette, and there are many other options.
You can use the JavaScript version from the browser or with Node.js:
https://github.com/jankovicsandras/imagetracerjs
There is the opensource library/program potrace which performs a fine vectorization. The thing is it first converts the input image into a luminensce one, and then binarize it. This step is optional, made by a separate program, so you can use potrace but in a different manner, by constructing yourself several versions of binarized images. I think VectorMagic builds its contours based on the gradient/laplacian of the input image, that's why you cannot impose any set of colours.
If you have a subset of colours to be used as input, I advise you to folow the following algorithm:
for each colour of the input subset of colours, find the subspace of the colour space which is "nearest" from the selected colour than from any other colour. Something like an algorithm computing the Voronoi partition of the input subset would do the job quite well at once; use for example qhull for that.
for each subspace, binarize the input image, drawing every pixel white if inside the subspace and black otherwise. Then apply potrace's or VectorMagic's vectorization on it.
At the end, you will get a set of contours. Maybe the contours would not match exactly, but there would be sufficiently close to let you simplify them and delete properly doublons of contours.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Let's say I have a very simple image with a few colours (white, black, grey). And I have a set of tiny images (lots of them). Is there any library that can help me rebuild the big image using all of the tiny images as building blocks? Like a mosaic.
Here's an example: http://d.pr/i/LJ0Z
P.S. I've tried to google a solution, but it seems I can't create correct search query because of my bad english. I only get software solutions for creating mosaics.
Just posting a solution to my problem here in case anyone will need in the future.
Let's say you have a simple image with a few colours. You need to re-create it with a set of smaller images (like a mosaic).
Split your image into cells (4x4, 8x8 or any other number) and assign corresponding colour for each cells (in other words "pixelate" your image), create array of cells for each color you have.
Implement listing #4 for Maximal Rectangle Problem from this article: http://www.drdobbs.com/database/the-maximal-rectangle-problem/184410529 (huge thanks to David Vandevoorde for such a great explanation!)
Now, for each small image you have (pieces of mosaic), determine its size as a rectangle. Then, using rectangle packing algorithm of your choice fill the max rectangles with these small images (I've been using this one for C#: http://kossovsky.net/index.php/2009/07/cshar-rectangle-packing/ again, huge thanks to the author for sharing!)
That's it. It's not very fast, but it gets the job done.
this search turns up various results:
andreamosaic
pixisnap
etc.
adding "python library" found osaic. repeat for whatever language you are using...