Tower of Hanoi, graph requirements - towers-of-hanoi

Hi we are trying to find out what are the minimal requirements for a graph to be able to solve the hanoi problem.
Where the vertex are the pegs, and each edge represent a possible movement from one peg to another.
So basicly its Hanoi problem with restrictions that tell us what are our possible moves.
There can be any number of pegs and any number of discs.
So far we found that we need a strongly connected graph. but there is no explanation why.
If anyone can shed some light on the subject it will be appreciated, thank you!

Related

3d Modeling - How do I make a 3d model that’s complex?

So, I’m attempting to create a 3d model of a bow (and arrow). I have some experience with making 3d models but nothing this complicated. I’ve created the 2d sketch of it and then extruded it to make it 3d, but I can’t figure out how to round the edges to make the bow circular rather than squarish. I’ve tried freeCAD, but the fillet causes the part to fail, and I’ve found no good alternatives that don’t cost me an arm and a leg.
Am I going about this totally wrong? Looking for some guidance or recommended references. Please excuse any ignorance on the topic I might be displaying here in asking this question.
This is a very broad question, and I would suggest first going over some tutorials like this to get started (in case you are interested in learning the software).
In case you just want the model for the bow and arrow, I'm positive you can find a whole bunch of them online (on sites like free3d.com or turbosquid etc.)

Check for millions of collisions?

I'm building a solution to fit a number of objects most efficiently into a box. I hope to implement more efficient algorithms soon, but to start out with I'm going to use the brute force method, checking every possible position. This is fine for now since the box is small, with a very few number of items. Later, the complexity will grow.
I'm using Unity to allow the user to see how the items ultimately fit in the box. My initial thought was to also use Unity's physics and collision detection to implement the best fit algorithm; but, with a huge potential number of locations and positions to check, is this a bad approach? Am I much better off running my algorithm in a data structure instead? A 10x10x10 box with even three 1x1x1 objects have almost a billion possible positions...
I'm new to Unity so any advice is welcome; thanks!
Update: right, so this problem is definitely in the bin-packing set of problems, which I know is NP hard. I'm assuming a rectangular box, filled with rectangular box-shaped items of random dimensions.
My question is...
My question is: given my particular algorithm, when we ask, "is there currently something in this x,y,z space?" would it be more efficient to figure that out via code, or to use Unity objects with collision-detection.
Based on the answers I've seen, I can see using Unity would be profoundly inefficient.
If you LITERALLY want to know:
"is there currently something in this x,y,z space?"
the best possible way to do that, is to simply use Unity's engine. So, you trivially check the AABB to see if a point is inside it (or perhaps just check for intersection). You can use one of many
I understand that the question "is there currently something in this x,y,z space?" is or could be one important part of whatever solution you are planning. And indeed the best way to do that is to let Unity's engine do that. It's absolutely impossible you or I could write anything as efficient -- to begin with it comes right off the quaternion cloud in the GPU.
That is the actual answer to what you have now stated is your specific question.
Now regarding the more general issue, which I first fully explained when that was the question you were asking :)
Here are some of my thoughts on trivial "box packing" algorithms in 2D, at the level useful in video games.
https://stackoverflow.com/a/35228592/294884
Regarding 3D "box packing" it's absolutely impossible to offer any guidance unless you include a screen shot of what you are trying to do and fully explain the shapes and constraints involved.
If you are a matheatician and looking for the latest in algorithmic thinking on the matter, just google something like "3d box packing algorithm"
example , example
Again, readers here have utterly no clue what shapes/etc you are dealing with, so please click Edit and explain!
Note too that sphere packing is a really fascinating scientific problem, if that's what you are talking about:
https://en.wikipedia.org/wiki/Close-packing_of_equal_spheres

Tutorial for steering behvior : Path following

I am working on a car racing game. I am almost done with prototype, but one thing.I am unable to add opponent cars. I searched for steering behaviors, I found a cool tutorial for Wandering. But couldn't find much useful on path following.
I found this link, but dint help me understand much.
Does anyone help me with some good tutorial for steering behaviors, which would help me grasp the basic concepts..?
This is non-trivial. Cars don't just follow a path, unless you want them to behave unrealistically. What you need is an AI driver. A good driving AI checks what's in front of it and then makes decisions to steer more or less in one direction, or brake or step on the gas.
This article covers some of the basics.
For the simplest solution I suggest a waypoint AI where the car just tries to head to the next waypoint of a predetermined path laid out by you. Depending on the angle between the past, the current and the next waypoint the AI can decide how much to steer and whether to step on the brakes to make the turn. You need to be sure that the AI actually does recognize reaching a waypoint by checking if the car is in a reasonable range. The distance between two waypoints must be greater than this range, otherwise the AI is prone to skipping ahead or possibly even turning back.

iOS image comparison

I am just doing some research into image processing and would appreciate it if someone could point me in the right direction. I want to compare image 'A' which is a picture of a person's face with image's stored in a database -B,C,D,E .. etc which are also pictures of faces. I want to compare them to see if the person 'A' is already in the database.
Several questions :
1.How is face recognition comparison usually done? (do you extract features e.g. eyes/mouth and compare them to other images?).
2. Are there prebuilt libraries that are able to do a comparison between images? or do i need to write my own algorithm?
3. Where can i start with this? (would appreciate some references/reading material).
Yes, you identify, extract and quantify various aspects of human faces, such as distance between pupils, width of mouth, percentage of head height where tip of nose is, etc.
There is a company, Luxand which makes software to do this, and I think they license it. Last time I looked (2009?) they didn't have an objective-c library. They do have an app that claims to merge faces from photograhs, so you can see what the offspring of any two people would look like, but it is very cheesy, with lots of hard-coded faces. (If you cross a dog with a tea-pot, you get the same baby-face as from crossing a 2 real faces.)
AFAIK, there is nothing in the iOS SDK that does this.
I would just Google "face recognition" and start reading. Good luck.
I would go with compiling openCV for the iPhone ( http://computer-vision-talks.com/2011/02/building-opencv-for-iphone-in-one-click/ ), and then implementing one of the classical ways to do face recognition like eigenfaces ( http://www.shervinemami.info/faceRecognition.html )
But don't expect miracles the accuracy will be low, and the app will be slow.
Also when you say face recognition is difficult doesn't the first link show how easy it is to detect faces on a picture?
The face detection from the first link is just to detect the face. It is just to see if there is a face in the image, which then you can pass as input to the recognition algorithm.
face recognition are very difficult, you need to extract some kind of "features" and perform some measurement...iphone hardware isn't very appropriate for this job.
yes, you can check here
http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/
for a tutorial and here
http://maniacdev.com/2011/12/open-source-library-for-adding-easy-face-to-your-ios-app-with-the-free-face-com-api/
for a free webservice.
3.i suggest you google scholar (http://scholar.google.it/scholar?q=face+recognition&hl=it&btnG=Cerca&lr=) but i think that if you want to write your own algorithm you need a lot o spare time :)

matlab object detection and tracking

I m doing a research project on "Object detection using my a digital camera".
Some suggestion on how to build and program the Matlab code.
In particular, I have a picture of one object, say a screen of my laptop. Than I rotate the laptop and I shot a new picture. I would like to know the difference on the position of the screen. I think I can use the edge detection after a subtraction of the two images but... it is quite difficult for me to implement it.
Some suggestion on how to build and program the matlab code.
That largely depends on the goal you want to achieve. Can you be more specific? Are you streaming the frames or are you tracking offline?
In particular, i have a picture of one object, say a screen of my laptop. Than i rotate the laptop and i shot a new picture. I would like to know the difference on the position of the screen.
There are many ways to do this, and an extensive litterature on the subject. I don't believe anyone would write up the equivalent of a survey paper on the subject as an answer on StackOverflow. Why don't you get started with an object tracking survey paper and then ask a more precise question?
hi, I m doing a reasearch project on "Object detection using my a digital camera". [...] I think i can use the edge detection after a subtraction of the two images but...is quite difficult for me to implement it.
What is your question? Are you asking us if this is a good way to track objects? Are you asking us if this is a new approach and has never been done? Are you asking someone to implement it for you?
Object tracking is a hard problem. I doubt that technique would succeed in any but the most basic scenarios. However, if you look at a survey paper, you might be pointed to a paper that already implemented this an presents results. Finally, I think you should brush up your programming skills because most (successful) object tracking techniques are not trivial to implement. If you don't want to program it yourself, there are online services where you can hire people. StackOverflow is not one of those places.
EDIT: I could deduce that you're new to both programming (in MATLAB) and in object tracking, hence in my answer. Don't mis-understand me, I'm trying to help. Let me re-phrase my suggestions as list:
Your question is far too general. You will get a lot more help from the SO community if you ask more precise questions for two reasons: A) general question result in general answers; and B) the way you asked your question could easily be interpreted as "someone, please do my work for me" even if that's not what you think you're asking.
Get acquainted with the problem domain. To ask more precise questions, you must be close to your answer. For good knowledge on the "object detection and tracking", find a good survey paper. If you're starting off on a research project, people in your lab should be of help to point you to a good one.
Learn to program simple things first. All of the most proficient (effective and efficient) programmers I've ever met struggled with the bubble sort when they were introduced to sorting. None of them would have been able to program an object detection algorithm as a first assignment. Get yourself a good image processing book that has exercises in MATLAB, go through execises one by one. If you can't do them all, choose those that are relevant to what you're trying to accomplish.