How to draw and process some 3D points? - c#

I have some points like
1,2,3
1,1,1
2,3,4
2,5,6
9,10,2
66,43,23
I want to draw and see them in the page but I don't know how can I do this. I read a little about XNA but I think there is better way. Can you help me?
update
I want to simulate 3D points as 3DMax does. it means have a 3d shape and can look it in all degrees.

What you need is a 3d graphics drawing API.
There are 2 main ones:
OpenGL
Direct3D
OpenGL is cross platform and is used on mobile devices like Android and iPhone.
Direct3D is Microsoft specific and generally is for Windows platform only.
Don't overestimate the value of building a cross-platform app. If it's a small pet project and you're not planning to go cross platform in the future, don't choose a more difficult API just because it's cross platform.
Programming OpenGL quite easy to start with via GLUT from C++, and there are tons of simple examples on the web
You can also use Direct3D via XNA, which is also easy to start with. There are a huge number of XNA 4.0 tutorials on youtube (I haven't watched it, it just has a very green likes bar!) and also the msdn tutorials

Related

Constructive geometry visualization in C#

I need to visualize constructive geometry in 3d using C#. And for that I want choose a library. Ideally, that library should be able to provide the following:
Rendering arbitrary polygons in 3d. Wireframe representation.
Orhtographic projection
Camera control. I need to be able to zoom-in/out, set center of rotation to turn camera around it.
Pick my polygons, edges, vertices with a mouse.
Draw text on top of vertices, edges and polygons.
Efficency isn't the priority, so it can be resonably slow if it can do these things right out of the box or provide a good high level service for it.
I tried to look at XNA. But as far as I understood it doesn't support visualization of polygons directly.
XNA does support visualization of polygons directly by providing access to the underlying Direct3D 9 GraphicsDevice object. You can also dynamically create a mesh and draw it in a managed way, however that will be slower.
See:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.xna.framework.graphics.graphicsdevice.drawprimitives.aspx
and related methods.
There's several DirectX wrappers in c#. I would avoid Managed DirectX since it's deprecated, and you have only access to direct3d9.
The two most common libraries for DirectX are:
SlimDX
SharpDX
Both work pretty well, and support latest DirectX feature set (SlimDX up to 11, SharpDX supports windows 8 and 11.1).
They both support what you need to do, it of course implies a bit of coding on your side.

3D scene graph for .NET

Is there any scene graph implementation for Windows Forms in .NET? It doesn't need to be free, but it can't be WPF.
I have to create a part of a bridge and color the stress accordingly. Interactive rotation would be nice, as well as zoom. I think DirectX or OpenGL would be fine.
A custom solution via XNA seems too complicated. I rather want to use a library, which provides higher level objects - optimally a scene graph, minimally triangles and light.
ILNumerics provides a scene graph in 3D. And supports Windows.Forms. Here are some examples.
Edit: It for sure is free: GPL version 3
You can do XNA rendering within Windows Forms it seems:
http://www.google.com/search?q=xna+windows+forms
There's SlimDX which wraps DirectX for .Net. I've gotten samples to work, but I'm new to 3D programming and there isn't much documentation on how to use SlimDX beyond the simplistic tutorials.
Unity3D is a game engine which might meet your needs with a straight-forward installation and 3D modeling import and view. No step-through debugger though, if that matters.
XNA might be a good choice, but I switched to evaluate SlimDX because of some concerning limitations Microsofts forces in networking gamer-services I saw early on. It made me think there would be other limitations that I wouldn't be able to bypass. Also, I was interested in more flexibility in performance and higher-quality realtime effects than I believed that XNA can provide. I'd be interested in others thoughts on whether such fears about XNA are founded. Perhaps they're not an issue for your stress visualization project.

What is the best template to use in C# Visual Studio 2008 for a 2D game?

Is it WPF? WFA? A custom template?
I currently use WFA, and it just doesn't seem anywhere near optimal. And no, I'm not asking for a referral to DirectX, or another language.
Thanks.
Do you want it to be really 2D, or you you want a "2.5D" game where 3D objects move in 2D?
For most basic 2D, like turn-based games or simple animation where very fine human input control is not necessary, the System.Drawing tools used in a WFA will probably be fine. You have access to a lot of the tricks, like using small images as sprites, rendering vector graphics, as well as the must-have elementary shape-drawing functions. You can use Image objects like Bitmaps to simulate page-flipping (create a Bitmap, draw the shapes on it, then call Graphics.DrawImage()), or simply use SetRedraw(false) on the control you're using as the Graphics pane to freeze what's there while you're drawing the next window.
WPF has some tools that are a major leap forward. Look at the System.Windows.Media.Media3D namespace; it has tools for 3D vector algebra and geometric primitives, allowing you to create 2.5D games with vertex shading and all the tricks. The basic structs can be referenced and used for their mathematical power, or you can build a WPF application that will integrate them into a graphics pane. You'll have to research this yourself; I'm a lightwight with WPF.
If you want your game to really get some FPS, you're going to have to use an accelerated platform like DirectX. XNA Game Studio is a free .NET-compatible API that wraps a lot of the DirectX functionality, allowing you to create .NET apps with accelerated graphics without requiring messy native code hookups. Creating and running apps on just about any .NET-compatible platform (including Windows) is free; you have to pay a fee and join the "XBox Creator Network" to publish even free games for XBox 360.
XNA, and the Box2D.XNA physics engine if your game requires 2D collision detection and physics. XNA takes care of hiding all that crazy DirectX stuff from you. It has a great content pipeline, which lets you add content to your game very easily. My favorite framework for small games.

is opengl suitable for making simulator of robotic arm or any other would be best for this purpose?

i m final year student want to make simulator for my robotic arm using opengl as i have command on c sharp so i would do coding using c sharp.
now have a query that would it be better to use opengl for simulator preparation or rather any other software(tool) will be best for the achievement of this task.
DO inform me
i would be grateful to u
thanks in advance
Let's get one thing straight: OpenGL is a graphics API. It can help you draw things to the screen, but it will not help you with "simulator preparation" (whatever that means).
If your program needs to display 3D graphics, OpenGL is one way to accomplish this. Direct3D would be another way, if you're on Windows (likely, since you're using C#).
However, both APIs have a learning curve, and it will take you a while to get up to speed with them. If your purpose is to display some simple 3D graphics without having to worry too much about the implementation, it may be better to use some engine or library on top of either OpenGL or Direct3D. I have no experience in this area, but you might want to look for something that allows you to load models from a file, and lets you render them in a few simple statements.
opengl or direct3d are great for rendering the 3Dimensional object, but for the simulation of the robot you should use a framework that offers you a scenegraph and/or a physics engine
have a look at the various gaming engines like ogre, or have a look at the blender game engine.
Here is one good OpenGL library for C#. Note that graphics is only a small part of what you'll need. Is your intention to create your own kinematics model or are you planning to use a physics system to articulate the robot based on raw 'servo' commands? If you want an off-the-shelf physics system, a good one is NVidia PhysX, though you have to explicitly register as a developer with them to get the API and it's in C++ (so you'd have to use C++/CLI To make good use of it.)

How should I start playing with 3D?

I'm a developer for just about 6 months now, and since I enjoy programming I've started little programs such as encripters, calculators, tools, stuff to play with DropBox (hehe), stuff that play with bitmaps, drawing graphics, and even a program to update the MSN display image according to the artwork of the music you're listening yo on iTunes.
One of my other hobbies is 3d modelling (completely amateur) and I'd like to mix these hobbies together! So I've read a little about it and figured I'd have to have good notions on geometry, math, point spacial position (which I do, from my 3d modelling experience), but I don't know how to use API's for it, so I've 'simulated' simple 3d with a simple program I've made (a spinning cube).
Here are some questions:
1) What would be a nice 3d development tool for a .NET programmer like me?
2) Is there a way of using 3d models made in 3DS Max ? (I intend on modelling characters)
3) What knowledge should I have in order to render it, and move it around ?
4) Which API should I use ?
NOTE: Not a dupe, I'm asking for directions specific for .NET development possibly using 3ds MAX, and there were no questions about it so far
EDIT:
I've got three answers that seem quite nice, so let me specify a little and maybe you can tell me what's the more appropriate tool.
What I'd like to build soon would be like:
portable (click'n'run, no need to install, and (hopefully) no need to send DLL's along)
"3D embedding" in winforms application, like a picturebox you could render in.
Real winforms application-like (having all System api's like IO, Drawing and etc)
The development enviroment would be nice if it:
Had the possibility to import existant 3D models (not a must, but a plus)
Had the ability to create 3d models programatically (a must)
Possibly has a tool for materials and textures (that would be a huge plus)
Is Well known (high availability of tutorials, questions in S.O., forums..)
And it would be really nice if I could use C# all the way :)
I'm going to provide another vote for XNA. The comment that it's too "game centric" is a non-starter - it provides a rendering loop with feedback on how fast everything is running so you can adjust your rendering to try to maintain a specific framerate (if you want). This isn't particularly game-centric as it's something that most 3D applications should worry about. The only thing that's really unusually game-centric about it is that it provides easy access to game controllers. Feel free to ignore that bit if you don't want to use it.
The only downside for you using XNA is your requirement that it be click'n'run, XNA has a redistributable that you have to worry about. Note that Win7 has this installed by default, but Vista and earlier don't.
EDIT:
XNA is made for applications that are strictly 3D. As such it doesn't natively support using typical windowing controls inside of an XNA project. But, there are ways around this...
A few useful links. Embedding XNA in a winform : http://forums.xna.com/forums/p/6471/34180.aspx#34180
WPF controls directly inside an XNA project : http://www.c-sharpcorner.com/UploadFile/iersoy/256/Default.aspx
Personally, I found XNA a little too "Game Centric" for my tastes. I was more interested in design/architecture type uses.
You may find SlimDX more to your liking.
Even though there are great suggestions in this post already(such as SlimDX and XNA), I'd just like to mention OpenTK.
OpenTK is closer to OpenGL than Direct3D, but it might be the best solution for cross-platform 3D .NET applications.
Since you are using C#.Net, the XNA library will be excellent for you. It is free off the Microsoft website and integrates into the VS IDE. A lot of available tutorials around to help get started.
Also, if I remember correctly. to use a 3d model in XNA, simply export the completed model as (.X). It can then be loaded into your work.
I vote you try Blender. www.blender.org
It's free, open source, and has a great community both on forums and IRC. Progress on the app is pushed forward by major community projects every year, some of which are movies and games and have won some awards. It is gaining industry acceptance as a way to model extremely fast.
Downsides: It's not considered as "pro" as Maya or ZBrush, and it has a very different brain about interface. Learning curve can be interesting, depending on how you learn and how much help you receive.
Upsides: It's free, great community, updated regularly, many tutorials and community projects to work on.
Community:
Blender channel on IRC
Blenderartists forums
Previous community Projects:
Elephant's Dream
Big Buck Bunny
My vote goes for Povray. It is a 3d renderer with a c-like syntax language. It doesn't satisfy your .net needs, but if cool non the less for 3d rendering. If you any kind of interactivity XNA is probably your best best. But I'm interested in your finds.
Re: "Has the ability to create 3d models programatically (a must)"
A few pointers:
Polygon Triangulation
(Dr. ?) Jonathan Richard Shewchuk's Triangle library
Dr. Hang Si's TetGen library
Constructive Solid Geometry
GNU Triangulated Surface Library
There are no .NET libraries I am aware of that allow you use the above mentioned libraries/techniques. You will have to use PInvoke or C++/CLI in order to make calls to these libraries from the managed world.

Categories