2d

dynamic 2d array in java using Arraylist

I found some problem in creating dynamic 2d array with arraylist,The original code is tediously long to read so i am giving a simple code here,the problem is same in both the cases: import java.util.*; class test{ public static void main(String args[]){ Integer test[]=new Integer[3]; ArrayList<Integer[]> al=new ArrayList<Inte...

Techniques employed for artstyle of sharp 2D visuals/animation

This is more of an offbeat question I guess but I am curious as to what graphic designers do to make flat images like in Paper Mario, Limbo or Shank so sharp. The extent of my knowledge goes into an intermediate level of Maya and some sprite creation in photoshop but I never understood the process through which they create such visuals. ...

Android OpenGL ES and 2D

Hi guys, Well, here's my request. I don't know OpenGL already, and I'm not willing to learn it, I want to learn OpenGL ES directly since I'm targeting my development to android, however. I want to learn openGL ES in order to develop my 2D games, I choosed that for performances purpose (since basic SurfaceView drawing isn't that efficien...

Are there any good 2D UITableView like implementations out there?

So what I'm looking for is a table view that supports and displays an array of cells (think excel). The 2D implementation should have cell caching for performance, optimized for panning. ...

Mouse Difference Rotated and Applied to Current Mouse Coordinates

I am having trouble with my 2D rotation implementation. I'm trying to create a pan feature for a map (move your mouse up; it should move the map down.) The map is just a 2d background image that is able to be rotated, etc. The problem is when it's in a rotated state moving my mouse up will continue to move the mouse in direction as if...

Pdf full text search on iPad with Quartz 2D

Hi guys :) I am trying to implement full text search using Quartz 2D but it's a nightmare. I can "extract" text from pdf page using PDF Operator (TJ and other...) CGPDFOperatorTableRef myTable; myTable = CGPDFOperatorTableCreate(); CGPDFOperatorTableSetCallback (myTable, "BT", &op_BT); CGPDFOperatorTableSetCallback (myTable, "Td",...

Testing if a line has a point within a triangle

How can I test whether a line has a point that lies within (not on the edge of) a triangle. (All in 2D). Currently I'm thinking I'll do this: Define the line, and each side of the triangle as Ax+By+C=0, and have an xrange. Check if the line intersects any of the lines of the triangle. If it does, check that this is NOT at the end of t...

2D game on Android SurfaceView runs slowly on touch

I am building a 2D game with Android SurfaceView. When I touch the screen the game animation runs slowly. Why, and how can I avoid this? The touch events are stubs just like onTouchEvents(MotionEvents ev){ empty };. All of the game logic and graphics draw code are in run() in an extends Thread class. ...

algorithm for scaling an image from a given pivot point

standard scaling using the center of an image as the pivot point and is uniform in all dimensions. I'd like to figure out a way to scale an image from an arbitrary pivot point such that points closer to the pivot point scale less than points away from that point. ...

iOS: UIVew & CALayer - 2D vs 3D transforms

in my previous code, I changed the coordinate system in my view's drawRect, so that the rectangle had 0,0 in the centre, 0,1 at the top centre and 1,0 in the centre of the right edge. I.e. a normalised Cartesian system. { // SCALE so that we range from TL(0, 0) - BR(2, -2) CGContextScaleCTM (X, 0.5 * bitmapSize.width, -...

OpenGL - ortho Projection matrix, glViewport

I'm having trouble wrapping my head around how these work. First, in a 2d game the projection matrix should be set up as ortho with left, right, top, bottom matching the window, right? But when the window resizes, should I just change glViewport, not the projection matrix? And how do I keep the aspect ratio? Could someone explain the pu...

sorting 2D arrays in Objective C

Hi Folks, I'm stuck with sorting 2D arrays in objective c. I have a 2D array which I made from two string arrays. NSArray *totalRatings = [NSArray arrayWithObjects:namesArray,ratingsArray,nil]; I've pulled the values using: for (int i=0; i<2; i++) { for (int j=0; j<5; j++) { NSString *strings = [[totalRatings objectAtIndex:i] ...

Getting text position while parsing pdf with Quartz 2D

Hi guys, another question regarding pdf parsing... Just read PDF Reference version 1.7 "5.3.1 Text-Positioning Operators" and I am a little bit confused. I wrote some code to get transformation matrix and initial text position. CGPDFOperatorTableSetCallback (table, "MP", &op_MP);//Define marked-content point CGPDFOperatorTa...

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. ...

Address label with 2d barcode

need to locate a postcode driven address labelling software that print a 2d barcode label containing all the address details. Can anybody point me in the right direction? JT ...

Calculate correct sprite direction image in bird's view game? (Math here might be speed vector to degrees angle?)

Background: I have 8 images for every sprite in my bird's view JavaScript game, representing top, top-right, right, right-bottom etc., depending on the player's space ship speed. Question: Given the values sprite.speed.x and sprite.speed.y (which could be something like 4 and -2.5, or 2 and 0 for instance), how do I get the correct angl...

How to Create an approximation of a 2-d Arc with line segments?

I have a poly-line-contour consisting of line segments and arcs of circles which i want to extrude to prisms. As my extrusion functions only support straight-edge polygons, i need to approximate the arcs using line segments. The arcs are defined through a starting point, center point and sweep angle (CCW). The sweep-angles i need to d...

Do randomly generated 2D points clump together, and how do I stop it?

Say you have a 2D area and you want to generate random points within it, by setting x = random() * width y = random() * height do the points clump around the centre of the area? I remember reading something saying they would, but I can't quite figure out why, and how to prevent it. ...

Area covered by a point cloud with R

Hi R experts! I have a cloud of points scattered in a 2D Euclidean space. I would like to calculate the area inside the polygon linking the most extreme (=peripheral) points of the cloud. In other words, I would like to estimate the area covered by the cloud in this space. Is there a formula in R? Thanks a lot for any response Julien ...

2D Tile System not behaving properly

Hello and Welcome I am trying to make a 2-D tile system heavily based off of the Snake example. The original mTileGrid is still there, but there is a new array: mMapGrid. The point is to copy the data from mMapGrid to mTileGrid on each update cycle and therefore simulate an area larger than the immediate screen. I wrote more functions...