Creating Other 3D Primitives in Quil Using Clojure - clojure

I am working on a Clojure program that is in need of using 3D graphics and for that I am using Quil. The first question I have is are there alternatives using Clojure to Quil? As far as I can tell it seems like the most advanced processing library I could find.
Having asked that, my second question is using Quil (which is based on a Java framework called Processing) what is the best way to add other 3 dimensional primitives. I want to add in a Cylinder, a Cone, and a Torus. I believe my Math and Programming skills are up for the challenge but I need some help on how I should contribute.
First off, if I am to go about adding those primitives, should I add them in Processing or should I add them into Quil? I have been programming for a while but haven't contributed for a bit to open source projects. Having said that, if anyone uses Quil, if I were to use the Vertex commands such as 'begin-shape' in Clojure, would I be able to make a Cylinder with triangle vertices? It says that the shape can not work with 'translate' but would it work with 'with-translation'?
In general I looking for the best way to approach adding 3D primitives to Quil and due to the nature of the code, cannot use Clojurescript so I need to add them for Clojure. Any help is greatly appreciated.
Cheers,

It seems that the functions are implemented only for ClojureScript at this time due to a recent migration from a dependency that was no longer being maintained? See this commit and https://github.com/quil/quil/issues/255
Here's a ClojureScript example of a Torus.

Related

Can i use Box2D-objects side by side with Cocos2d-X objects?

Cocos2d-x supports the physics engines Box2D and Chipmunk and i used it until now via Cocos2d-x objects like cocos2d::PhysicsWorld or cocos2d::PhysicsJoint (we're talking C++ here). Now i want to integrate some custom Joint that is available for Box2D. Also, i experience problems with tunneling at high speed that i hope to get rid of by implementing some objects directly with Box2D (b2World etc.).
Is it possible to define some Box2D objects and just add them to the Cocos2d-X physics? And if it's not, do i have to reimplement the whole physics stuff from world-start to fixture-end?
The official Box2D tutorial doesn't mention the native objects at all and seems be a little outdated.
It seems no one is willing to answer this.
As i progressed i can give others looking for an answer the hint, that i think you have to adapt completely to Box2D, create a b2world, add b2bodies etc.
For me it wasn't complicated and the simulation is much more accurate. It solved the problems i was facing with the cocos2dx-objects, so if you run into problems like tunneling or want to use more sophisticated features of Box2D, i'd suggest switching.

Using mesh gradients in Cairo for coloring a path

I'm a newbie in this type of approach to programming since I really doesn't care for hardcore graphics generation. I design, write, run, and study parametrized climate models with python. But, at last, I have encountered myself with a visualization issue.
I was looking for something in Cairo library that allows me to map a linear gradient onto an arbitrary curve (not necessarily a circumference) such that there is a more or less smooth variation of colour (or shade) across my path. Then I have been looking for some pattern and I finally found that maybe mesh gradients in Cairo are the solution.
However, I can't create a new mesh gradient from my python script with cairo.pattern_create_mesh()!
Therefore, my questions are: How I use mesh gradients in Cairo? Is there any other simple way to do what I want with Cairo (I don't know, like a simple mapping from a line segment to a curve via parametrization, I know I ask too much)?
Mesh patterns were added in cairo 1.12 which is the latest release. Thus, most language bindings likely don't support them yet. I don't know anything about the combination of python and cairo and thus don't know any workaround.
I don't know any simple way to simulate what you need with other patterns, sorry. (Although I am not really sure how you want to do your mapping via mesh gradients either...)

3-d animation in C++

I am doing a scientific project in C++ and I need to draw simple animated 3-d images of moving atomic groups. What is a good and convenient graphics library to do that? Some general remarks are also appreciated. I work in Linux.
Thank you in advance, Roman
OpenGL of course,
one library you could use is glut for that.
have a look on http://nehe.gamedev.net/
If you want to show 3D in linux, you should use OpenGL. But since it is a C library, you can use a wrapper, like for example glt or sfml
The easiest library to use is Vtk. A more difficult and slower, but potentially better rasterization can be achieved using POVRAY.
I suggest looking at game oriented graphics engines. They provide OO wrappers around openGL and have lots of utility functions for loading 3d model formats etc.
If you don't want to get bogged down in writing the graphics, a game oriented renderer is likely the fastest way for you to get stuff on screen.
Ogre may be a good choice - it has a fairly large and helpful community.
Irrlicht is another possibility.
There are several possibilities, some perhaps more suitable than others, obviously!
I think any one of the options mentioned above would serve to do so.
I personally recommend OSG.
http://www.openscenegraph.org/projects/osg

Finding the right tools for programming a futuristic-styled UI project

I've always been inspired by dynamic, futuristic-like user interfaces. The best I can describe is a graphic interface such as in the latest Iron Man movies.
Although I wouldn't build a full blown application, I would like to make little snipplets of animations that I plan to make interactive. And maybe put them together someday to make something bigger. Admittedly, I will use for audio manipulation in the future but anyway, that's not the point since it's the animations/graphics I'm unsure of.
I know it's possible to make those kind of animations in Adobe After Effects. I'm just having a hard time thinking of the processes (artistically and programmability) to proceed.
While researching on this on my own I have acquired basic experience with OGRE 3D and Blender. I've imported and compiled meshes on OGRE, have been able to do basic things like move the meshes around which is about it.
I'm beginning to think I may be approaching this the wrong way and there are better tools or if 3D is overkill for those kind of animations when 2D would suffice and maybe provide a smoother experience.
I'm having trouble understanding the process and am wondering two things:
1.)The main thing I'm having trouble understanding is how to get still graphics to make animations? Do the meshes keep the timeline from a program like Blender then a graphics engine like OGRE reads the timeline and plays them?
Most importantly:
2.)Do I even need graphics (meshes)? Most of the interface are thin-border boxes, text and shapes of transparent LED-like colors that can move around dynamically to make that futuristic effect.
Please share your opinions, suggestions and anything you think might help me accomplish to develop those kinds of sexy eye candy! Thanks.
When you look at awesome futuristic UIs in movies, they are usually made of
basic primitives
desaturated colors, and/or one color tone
transparency
a cool font or two
high-tech text, graphs or similar
simple animations to make things look "alive", blinking lights/text and similar
a touch interface, of course
Maybe you can't do a lot about the touch interface, but the rest is really not hard graphics wise, it's a matter of carefully crafted artwork and combining simple elements in a cool way.
Also I would look into Adobe Photoshop and fancy texturing rather than Blender and fancy modelling, as you are looking for a fancy 2D UI, and detailed 3D models will not be that important. Playing around in photoshop (well, or GIMP if you want a free alternative) can help you develop your art skills, and help you get that high-tech, sci-fi look on a 2D surface.
You know, I would go as far as to suggest making some sci-fi wallpapers in the style you are after before trying to solve this problem in code. I think you will find that photo manipulation skills and an eye for art will help you here. And for gods sake, look at those movies (Iron Man, Minority Report etc.) that have those UIs you are aiming at, and analyze what exactly they are. Decompose them like I did in the list above.
As for the "which tools should I use?", I say the answer to that is fairly simple:
OpenGL
Photoshop (or GIMP if you are a starving student etc.)
A compiler & toolchain
A code editor/IDE
A cup
I see this is tagged C++, which is an excellent choice of programming language if I may say so.
Ogre is a full blown 3D engine, which is fine, but not exactly targeted at what you want to use it for. You might find that you struggle to get what you want done (disclaimer: I have not tried this in Ogre, and it might work well for this. Then again, when did you last see Ogre used in an audio manipulation program?). My advice is to learn good, simple OpenGL. That would give you complete power over your UI, not get in your way or limit you in any way. It is also cross platform, well documented, and used by tons of developers all over the world (also for audio manipulation applications). I can't see how you could possibly go wrong with it. The fun part is that it probably won't take you long to get advanced enough in it to start developing some pretty nice UIs. As I mentioned, it's more of an art problem than a coding problem.
The cup is for the coffee, by the way. :)
The easiest and most efficient way is to keep track of all your graphics data (meshes, animations, effects) in "media files" and load & play them in runtime. Though you'll be able to easily change your game without changing the code.
For example, you have a Diablo-like game and you wanna turn it to the future-style. You just need to rewrite some player and AI scripts and modify meshes/effects/sounds/animations. But if you've done those via code - it will be a new game from scratch.
I would suggest Ogre, but you already used that, so by my opinion, you are on the right track.
Look up 'billboards' in Ogre documentation, re: LED and 2D stuff.

generating a 3d graphics c++

I have found an interesting application on the net and i am using it for my end year study project.
http://www.cl.cam.ac.uk/~sjeh3/wii/ the video in the link explains my goal.
But i am having issue using it. the example of rendering the trajectory on a 3d axis is using Corba (omniorb) and i believe open inventor. but there isn't any idl file. and i don't know if it's possible to use it.
My question is :
Is it possible to render a 3d real time graphics using a lib in c++ making it easy and fast to implement? i tried using matlab engine or matlab simulation with tcpip communication but i am having issues with these technics so i am searching for another way.
Does anybody have an idea ?
sincerely,
Hugo
Take a look at OpenGL.
You might also look at SDL (which uses OpenGL).
Edit (re: comments)
For the plotting aspect, you could look at VTK and/or MayaVI (which puts a Python scripting wrapper around VTK).