2d

Comparing a "path" (or GPS trail) of a vehicle.

Hi Guys, I have a bit of a difficult algorithm question, I can't find any suitable algorithm from a lot of searching, so I am hoping that someone here on stackoverflow might know the answer. I have a set of x,y coordinates for a vehicle as it moves through a 2D space, the coordinates are recorded at "decision points" in the time period...

How to render text into a box and replace excess with three dots

I render text with a custom table cell renderer and I want to trim the text drawn if it would exceed the current cell width, switching to a "This text is to long..." kind of representation, where the three dots at the end never leaves the bounding box. My current algorithm is the following: FontMetrics fm0 = g2.getFontMetrics(); int h ...

How do I find rotation transformed 2D coordinates in XNA?

I'm making an XNA game and have run into a small problem figuring out a bit of vector math. I have a class representing a 2D object with X and Y integer coordinates and a Rotation float. What I need is to have a Vector2 property for Position that gets and sets X and Y as a Vector2 that has been transformed using the Rotation float. This...

Javafx 2d text rendering speed up

Hello Guys, I am a little surprised that JavaFX do consume my CPU by showing simple floating text on a screen. My question is there any option tweaks to turn on hardware acceleration for nodes like Text? To Use GPU and not CPU when rendering 2D primitives? Here is the simple example that consume up to 40% cpu on my 2.53Mhz core 2 duo...

Curvilinear perspective: Convert 3D to 2D

Hi all, I'm looking for the mathematical expression converting a 3D coordinate (x0,y0,z0) to a 2D (x1,y1) coordinate in a curvilinear perspective of radius R where the values of x1 and y1 are the angles of views {-90° .. +90°} of the original point. (image via http://www.ntua.gr/arch/geometry/mbk/histor.htm ) Thanks ! ...

Using an existing C++ engine on the iPhone

I come from a C/C++ background and more recently flash. Anyway I wrote a 2D engine in AS3 and would like to get it running on the iPhone. To start with I converted it to C++. As a test I wrote a very simple C++ engine and added the files to a standard view-based application in XCode. I then added a UIImageView that covered the whole iPho...

Drawing a dot grid

I'm new to graphics programming. I'm trying to create a program that allows you to draw directed graphs. For a start I have managed to draw a set of rectangles (representing the nodes) and have made pan and zoom capabilities by overriding the paint method in Java. This all seems to work reasonably well while there aren't too many node...

Is drawing through the Canvas class hardware accelerated on Android?

Are calls to Canvas.drawPath()/drawArc()/etc hardware accelerated, passed to a device native implementation or implemented in Java? Or is OpenGL the only way to achieve hardware accelerated drawing? I am trying to determine if it is feasible to use the Canvas API for realtime animation. ...

Android: Difference between SurfaceView and View?

When is it necessary, or better to use a SurfaceView instead of a View? ...

How do I develop Java games for phones?

How do I begin developing J2ME games for mobile phones? Are any libraries available that can render pixel fonts for text? - for text games Are 2D graphic libraries available that can draw animated bitmaps? - for isometric and tiled games Any are 3D engines available with texture mapping & lighting? -- for racing and flying simulators ...

j2me 2d graphics engine

For J2ME I found a number of GUI frameworks like LWUIT, J2ME Polish, Twuik etc however, I am looking out for a 2d Graphics Engine for the Java ME platform preferably lightweight < 50K, I came across TinyLine this supports reasonable features for a mobile device. On similar lines do we have an open source or free 2d graphics engine, lib...

2D Shape Scaling

Hi well I got a problem about scaling shapes.Well I m trying to scale two similar shapes.It is in 2d and each shape has n points .I found a statement like this from a paper I read "The size of a shape is the root mean square distance between the shape points and it's centroid." So from this point if I calculate the size of both shapes...

windows ce - 2d graphics library

I have Windows CE 5.0 device and it doesn't support any hardware accelearation. I am looking for some good 2d graphics library to do following things. I prefer backend programming in Compact .Net Framework. Drawing fonts with antialiasing. drawing lines, and simple vector objects with antialiasing. I am not doing animation, so i don't ...

C# 2D collision detection problem

Hello! I am stuck trying to figure out how to alter my collision detection to work correctly, i got all my wall objects stacked inside a List and then when the player moves i loop thru each wall object and call the DetectCollision method, this returns true or false depending on if the object is inside the wall or not. Wall detect colli...

Algorithm for spread-out 2D point distribution

In a 2D pixel array, I need an efficient algorithm that will select p% of pixels that are the most spread out. This can be done adaptively by selecting points, then repeatedly adjusting the positions of points that are too close together. But this isn't efficient since it would require many iterations and distance calculations. It doe...

How do I draw simple graphics in C#?

I just want to draw simple 2D objects like circle, line, square etc in C#. How do I do that? Back in the Turbo C++ days I remember initializing some graphics library for doing the same. Do I need to do something similar in .NET? Is it any different for 3D objects? Will things like DirectX make this any easier? Any links to tutorials or s...

How To Produce A 2D Plane Cut from a 3D Image

Hi, I would like to write a C# program that generates a 2D image from a rendered 3D object(s) by "slicing" the 3D object or through a cut-plane. The desired output of the 2D image should be data that can be displayed using a CAD. For example: A 3D image is defined by its vertices, these vertices is contained within Point3DList(). A meth...

Anchor point of x,y in JavaFX nodes

Some sprite applications (namely pulpcore) allows you to define an anchor point for an object. For example if the anchor point of a rectangle is 0,0 and it's coordinates are x:0,y:0 the top left point of the rectangle would be displayed on the top left point of the screen. If however the anchor point of the rectangle is 50,50 and it's ...

Is it smart building an OpenGL C# application to replace GDI

Hello, I have developed a quite large application using MFC. Naturaly, I used GDI for drawing, CCmdTarget for event routing, and the document-view architecture. It was a convenient development path. Now, the client is interested in converting this application to .Net. I would prefer (and they too) writing the new product in C#. The ...

Combo with 2D borders on XAML

I am working with XAML. How can I add a combo box with flat borders (Not 3D)? ...