Android guiding application - java

I am creating an Android application in which the user searches for the position of a book in a library.
My issue is with the way I am going to draw the bookshelves and the shortest route that the user is going to follow from his position.
One idea is to implement an a matrix but I don't think it really works so I would like some help if possible.
This is the implementation of the library in paint (the green lines are the routes in a way the user can take to get to the book):

For example, you can create a model of library hall as a graph and search for shortest path from one vertex (current user location) to another (location of book) using Dijkstra's algorithm. Each vertex of graph is a real point in the library hall. Weight of each graph edge is real distance between these points. Algorithm is quite simple to implement and well described in Wikipedia.

Related

Drawing the shortest path from point a to point b given an array of coordinates to use

I am currently making a map generator using Java. I am using arrays to store coordinates, which are then used to draw land. So I also have cities, and I want to draw the most direct path from city a to city b without crossing the water, AKA, only using the coordinates that are stored as land. How can I do this? I have tried many algorithms a;ready, like solving systems to make sure things do not overlap (which takes too long, as i have 75,000 points) and also finding the nearest city that does not have any water in between the two, found by drawing a best fit line and solving just one systems (extremely inaccurate and probably just wrong). Thanks for all the help in advance!

Java2D pathfinding in 2D space shooter game

I'm writing 2D space shooter game, something like space invaders, kind of. Right now I have to decide in what way
I will be moving enemy sprites and I can't move forward until I will implement some kind of solution.
Newest version of game source code on my GitHub page (link in profile).
OK, so to the point. First of, I'm using only awt. I want to learn a lot, so I'm not using external libraries in this one.
I want to move my aliens on a 1280x800 field with no obstacles (except other aliens and player).
First I tried to move aliens on predesigned path constructed with Bezier curves, but I was unsatisfied with the result.
Solution lacks flexibility. So I decided to write AI for all aliens and program behavior that way. Unfortunately I didn't wrote
any pathfinding algorithm, and when I started learn about them I couldn't find anything appropriate to my situation. There is a
pathfinding algorithm for finding way in graph, but should I treat every pixel as separate node,
or create logical nodes (couple pixels on couple pixels each), and is it a good way?
Don't take me wrong mates, I'm not looking for fast to build, easy solution. I just need some pointing in right direction,
since my research didn't provide me with enough information.
Should I use a Dijkstra? If yes, how to solve node problem? Or maybe there is a better way?
If you know any good web materials on pathfinding or AI, I would be thankful if you share them with me.
Thanks for getting familiar with the issue mates!

Confusion regarding skeletal animation in the vertex shader

I see that there are some fairly similar questions, but those are mostly regarding performance. I would be very grateful if someone could take the time to explain as to how I could implement what I currently have into the vertex shader(For animation, as the title states).
I have a simple .FBX file reader which extracts the following:
Vertex coordinates (X, Y, Z);
Vertex indices;
Normal coordinates (X, Y, Z);
As far as bones go:
Bone names
Indices of the vertices attached to the bones;
The weight of each of the vertices;
A 4x4 matrix array of the bone. (Not sure how this is laid out, please explain! Wouldn't the matrix only hold the position of 1 end?)
Help appreciated!
Looks like you may be missing a few things. Most notably, the bone hierarchy.
The way it typically works, is you have a root node, whose transformations propagate down to the next level of "bones", whose transformations propagate, and so on until you reach the "leaf" bones, or bones with no children. This transformation chain is done using matrix multiplication.
There are a few ways to then transform the vertices. It's sometimes done with with an "influence" that is decided on beforehand and is usually loaded from a 3d application such as 3dsmax.
There's another way of doing this which is simple and straightforward. You simply calculate the distance from the vertex to the bone node. The influence of the bone's transformation is directly related to this distance.
The 4x4 matrix you speak of holds much more than just position. It holds rotational data as well. It has the potential to hold scaling data as well but this typically isn't used in skinning/bone applications.
Getting the orchestra to play together nicely requires a thorough understanding of matrix math/coordinate systems. I'd grab a book on the subject of 3D math for game programming. Any book worth its weight will have an entire section devoted to this topic.

Android map overlay with sprites pathfinding

I want to make an Android App, with a real map and a overlay for the map, where sprites are drawn (can be dots or small images).
This is a rather hard question, so I have made a sketch of a map of a small city, where only roads and streets can be seen. That might look something like this on the device:
Imagine the red dots to be bots, and they want to get to the yellow dot, assuming they know the position.
What Android Map API should I use to be able to:
Draw custom sprites on a given location on the map (geo-coordinates rather than screen coordinates).
Generate valid paths from the streets and roads on the map, which the dots can move on (black lines).
Use pathfinding to calculate the shortest routes, e.g. from red dot to yellow dot.
Must be able to draw more than 10 sprites on the map.
(the map doesn't have to support 3d views or street views. Plain old top-down view is just fine)
If no map API exists that does not meet these requirements, what are some other solutions?
I'm really excited about this project, but I'm having a lot of trouble getting started with it, so any help or guidance will be much appreciated.
EDIT:
It seems that there is no answer to my question. I will leave this open and report back with my own solution.
Google Maps Android API v2 and Marker class.
All valid paths? You probably should not need it if you use Android API v2 with real map drawn for you, but you can also try to use Google Directions API.
Google Directions API.
No API exist that can handle more than 10 objects. You probably need something from NASA.
Have fun coding.

interactive planar straight line graph in swing

I am trying to draw an interactive planar straight line graph (PSLG) on a JApplet. I am using mouse-clicks to determine the vertices of the PSLG.
Here is the algorithm which I am following for drawing edges of the PSLG
1. The point where user performs a mouse-click is added as a vertex of the PSLG.
2. If he clicks a second point,an edge is directly created among the point and the previously clicked-point
Here are certain flaws which I observed due to the use of this algorithm:
Inability to create disjoint-planar sets like say just a line segment
A closed polygon is only created if the user clicks at the exact location where the start point was [Essentially, if the user clicks very close to the start point, there is no way to tell that this point is actually the start point since it appears within a certain tolerance range from the point].
I've checked out some similar questions over here and people suggest to use the JFreeChart library. But as far as I get, the scenario in those questions was that the points of the PSLG were already known. I do not know whether JFreeChart can be used for creating interactive PSLG's
I thought about adding points and having a button which would say add edges among points,but if that's the case selecting the 2 points will still involve the proximity problem encountered in 2.
I was wondering if anybody could suggest me a better approach on how to handle this situation.
Thanks in advance
GraphPanel could be adapted to this task, although it might benefit from a more advanced edge model for faster searching. Also consider JGraph.

Categories

Resources