Search Results

Search found 3214 results on 129 pages for 'city simulation'.

Page 8/129 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Keyboard Simulation not working with Keyboard hook for modifier keys

    - by Eduardo Wada
    I have a piece of software that is being used to simulate a certain device on a touchscreen, this device already runs an application that receives keyboard input from the device. My software (reffered to as simulator) displays a virtual keyboard and runs the application. Thus, the simulator sends keys with input simulator: http://inputsimulator.codeplex.com/ And the applciation listens to keys with the following keyboard hook: https://svn.cyberduck.io/tags/release-4-1/source/ch/cyberduck/core/GlobalKeyboardHook.cs My problem is, what some keys from the device's hardware actually do is to sent a key combination (ex: left-alt + 1) to the application and a weird scenario is occurring: The application listens to normal keyboard inputs The simulator sends keys to other applications (ie: visual studio responds to the keys sent when debugging) The simulator can send single keys to the application (I can type) The simulator CANNOT send key combinations to the application (alt+1 is received as just 1 in the application) This started happenning when we imported the application's dll into the same process from the simulator. Could there be any reason why I can't simulate key combinations for a hook in the same process? Is there any easy fix for this?

    Read the article

  • Novel fitness measure for evolutionary image matching simulation

    - by Nick Johnson
    I'm sure many people have already seen demos of using genetic algorithms to generate an image that matches a sample image. You start off with noise, and gradually it comes to resemble the target image more and more closely, until you have a more-or-less exact duplicate. All of the examples I've seen, however, use a fairly straightforward pixel-by-pixel comparison, resulting in a fairly predictable 'fade in' of the final image. What I'm looking for is something more novel: A fitness measure that comes closer to what we see as 'similar' than the naive approach. I don't have a specific result in mind - I'm just looking for something more 'interesting' than the default. Suggestions?

    Read the article

  • Creating multiple process and simulation in C via fork()

    - by Yakup OZDEN
    i want to create multiple process groups which will call different functions. i write the code below. firstly i want to get following output ./fork 4 5 I am a child: 1 PID: 22330 I am a child2: 1 PID: 22334 I am a child: 2 PID: 22331 I am a child2: 5 PID: 22338 I am a child: 4 PID: 22333 I am a child: 3 PID: 22332 I am a child2: 2 PID: 22335 I am a child2: 4 PID: 22337 I am a child2: 3 PID: 22336 ' #include <stdio.h> #include <stdlib.h> #include <unistd.h> void forkChildren (int nChildren) { int i; pid_t pid; for (i = 1; i <= nChildren; i++) { pid = fork(); if (pid == -1) { /* error handling here, if needed */ return; } if (pid == 0) { printf("I am a child: %d PID: %d\n",i, getpid()); sleep (5); wait(NULL); return; } } } void forkChildren2 (int nChildren) { int i; pid_t pid; for (i = 1; i <= nChildren; i++) { pid = fork(); if (pid == -1) { /* error handling here, if needed */ return; } if (pid == 0) { printf("I am a child2: %d PID: %d\n",i, getpid()); sleep (2); return; } } } the code gives me the output [ozdeny@hyperion ~]$ ./fork 4 5 I am a child: 1 PID: 22330 I am a child: 2 PID: 22331 I am a child: 3 PID: 22332 I am a child: 4 PID: 22333 I am a child2: 1 PID: 22334 I am a child2: 2 PID: 22335 I am a child2: 4 PID: 22337 I am a child2: 5 PID: 22338 [ozdeny@hyperion ~]$ I am a child2: 3 PID: 22336 I am a child2: 1 PID: 22339 I am a child2: 2 PID: 22340 I am a child2: 3 PID: 22341 I am a child2: 4 PID: 22342 I am a child2: 5 PID: 22343 I am a child2: 1 PID: 22345 I am a child2: 2 PID: 22346 I am a child2: 3 PID: 22347 I am a child2: 1 PID: 22349 I am a child2: 2 PID: 22350 I am a child2: 1 PID: 22344 I am a child2: 2 PID: 22352 I am a child2: 3 PID: 22353 I am a child2: 4 PID: 22354 I am a child2: 5 PID: 22355 I am a child2: 3 PID: 22351 I am a child2: 4 PID: 22356 I am a child2: 5 PID: 22357 I am a child2: 4 PID: 22348 I am a child2: 5 PID: 22358

    Read the article

  • Matlab Simulation: Point (symbol) Moving from start point to end point and back

    - by niko
    Hi, I would like to create an animation to demonstrate LDPC coding which is based on Sum-Product Algorithm So far I have created a graph which shows the connections between symbol nodes (left) and parity nodes (right) and would like to animate points travelling from symbol to parity nodes and back. The figure is drawn by executing the following method: function drawVertices(H) hold on; nodesCount = size(H); parityNodesCount = nodesCount(1); symbolNodesCount = nodesCount(2); symbolPoints = zeros(symbolNodesCount, 2); symbolPoints(:, 1) = 0; for i = 0 : symbolNodesCount - 1 ji = symbolNodesCount - i; scatter(0, ji) symbolPoints(i + 1, 2) = ji; end; parityPoints = zeros(parityNodesCount, 2); parityPoints(:, 1) = 10; for i = 0 : parityNodesCount - 1 ji = parityNodesCount - i; y0 = symbolNodesCount/2 - parityNodesCount/2; scatter(10, y0 + ji) parityPoints(i + 1, 2) = y0 + ji; end; axis([-1 11 -1 symbolNodesCount + 2]); axis off %connect vertices d = size(H); for i = 1 : d(1) for j = 1 : d(2) if(H(i, j) == 1) plot([parityPoints(i, 1) symbolPoints(j, 1)], [parityPoints(i, 2) symbolPoints(j, 2)]); end; end; end; So what I would like to do here is to add another method which takes start point (x and y) and end point as arguments and animates a travelling circle (dot) from start to end and back along the displayed lines. I would appreciate if anyone of you could show the solution or suggest any useful tutorial about matlab simulations. Thank you!

    Read the article

  • R library for discrete Markov chain simulation

    - by stevejb
    Hello, I am looking for something like the 'msm' package, but for discrete Markov chains. For example, if I had a transition matrix defined as such Pi <- matrix(c(1/3,1/3,1/3, 0,2/3,1/6, 2/3,0,1/2)) for states A,B,C. How can I simulate a Markov chain according to that transition matrix? Thanks,

    Read the article

  • Where Not In OR Except simulation of SQL in LINQ to Objects

    - by Thinking
    Suppose I have two lists that holds the list of source file names and destination file names respectively. The Sourcefilenamelist has files as 1.txt, 2.txt,3.txt, 4.txt while the Destinaitonlist has 1.txt,2.txt. I ned to write a linq query to find out which files are in SourceList that are absent in DestinationFile list. e.g. here the out put will be 3.txt and 4.txt. I have done this by a foreach statement. but now I want to do the same by using LINQ(C#). Edit: My Code is List<FileList> sourceFileNames = new List<FileList>(); sourceFileNames.Add(new FileList { fileNames = "1.txt" }); sourceFileNames.Add(new FileList { fileNames = "2.txt" }); sourceFileNames.Add(new FileList { fileNames = "3.txt" }); sourceFileNames.Add(new FileList { fileNames = "4.txt" }); List<FileList> destinationFileNames = new List<FileList>(); destinationFileNames.Add(new FileList { fileNames = "1.txt" }); destinationFileNames.Add(new FileList { fileNames = "2.txt" }); IEnumerable<FileList> except = sourceFileNames.Except(destinationFileNames); And Filelist is a simple class with only one property fileNames of type string.

    Read the article

  • Dynamic margin (or simulation of margin) between left floated divs

    - by BugBusterX
    I have a number of divs floated left. When browser is resized they move down or up based on how many can fit on the line. I was wondering if there is a way to dynamically (with css) have those divs align (or have margin) in a way, that they would always fill the entire screen space by having their marhin resize? In other words margin between them would resize while browser is resized, but as soon as another div can fit it will be added in the line, or if minimum margin is reached and passed another div goes to next line while margins expand again. Here's an example how it is now, resize the wondow to see he leftover space that I want to "fill" <html> <head> <style> .test { float:left; width: 100px; height:100px; background-color: grey; margin: 0 10px 10px 0; } </style> </head> <body> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> <div class="test"></div> </body> </html>

    Read the article

  • Python/Biomolecular Physics- Trying to code a simple stochastic simulation of a system exhibiting co

    - by user359597
    *edited 6/17/10 I'm trying to understand how to improve my code (make it more pythonic). Also, I'm interested in writing more intuitive 'conditionals' that would describe scenarios that are commonplace in biochemistry. The conditional criteria in the below program is explained in Answer #2, but I am not satisfied with it- it is correct, but isn't obvious and isn't easy to implement for more complicated conditional scenarios. Ideas welcome. Comments/criticisms welcome. First posting experience @ stackoverflow- please comment on etiquette if needed. The code generates a list of values that are the solution to the following exercise: "In a programming language of your choice, implement Gillespie’s First Reaction Algorithm to study the temporal behaviour of the reaction A---B in which the transition from A to B can only take place if another compound, C, is present, and where C dynamically interconverts with D, as modelled in the Petri-net below. Assume that there are 100 molecules of A, 1 of C, and no B or D present at the start of the reaction. Set kAB to 0.1 s-1 and both kCD and kDC to 1.0 s-1. Simulate the behaviour of the system over 100 s." def sim(): # Set the rate constants for all transitions kAB = 0.1 kCD = 1.0 kDC = 1.0 # Set up the initial state A = 100 B = 0 C = 1 D = 0 # Set the start and end times t = 0.0 tEnd = 100.0 print "Time\t", "Transition\t", "A\t", "B\t", "C\t", "D" # Compute the first interval transition, interval = transitionData(A, B, C, D, kAB, kCD, kDC) # Loop until the end time is exceded or no transition can fire any more while t <= tEnd and transition >= 0: print t, '\t', transition, '\t', A, '\t', B, '\t', C, '\t', D t += interval if transition == 0: A -= 1 B += 1 if transition == 1: C -= 1 D += 1 if transition == 2: C += 1 D -= 1 transition, interval = transitionData(A, B, C, D, kAB, kCD, kDC) def transitionData(A, B, C, D, kAB, kCD, kDC): """ Returns nTransition, the number of the firing transition (0: A->B, 1: C->D, 2: D->C), and interval, the interval between the time of the previous transition and that of the current one. """ RAB = kAB * A * C RCD = kCD * C RDC = kDC * D dt = [-1.0, -1.0, -1.0] if RAB > 0.0: dt[0] = -math.log(1.0 - random.random())/RAB if RCD > 0.0: dt[1] = -math.log(1.0 - random.random())/RCD if RDC > 0.0: dt[2] = -math.log(1.0 - random.random())/RDC interval = 1e36 transition = -1 for n in range(len(dt)): if dt[n] > 0.0 and dt[n] < interval: interval = dt[n] transition = n return transition, interval if __name__ == '__main__': sim()

    Read the article

  • Terrarium-like agent interaction framework

    - by Gabi
    Hi, I'm looking for a framework for agent interaction simulation, where I can deploy some agents and let them interact and watch their evolution. Until now I found Terrarium 2.0 (http://terrarium2.codeplex.com/). In principle this is what I need: the ability to create some creature/agent and deploy it into a simulation framework where it will interact with other agents. But it seems that Terrarium is no longer under development. Do you know of any similar frameworks which are worth considering? Thanks.

    Read the article

  • How to build a simulation of a login hardware token in .Net

    - by Michel
    Hi, i have a hardware token for remote login to some citrix environment. When i click the button on the device, i get an id and i can use that to login to the citrix farm. I can click the button as much as i like, and every time a new code gets generated, and they all work. Now i want to secure my private website likewise, but not with the hardware token, but with a 'token app' on my phone. So i run an app on my phone, generate a key, and use that to (partly) authenticate myself on the server. But here's the point: i don't know how it works! How can i generate 1, 2 or 100 keys at one time which i can see (on the server) are all valid, but without the server and the phone app having contact (the hardware token also is an 'offline' solution). Can you help me with a hint how i would do this? This is what i thought of so far: the phone app and the server app know (hardcoded) the same encryption key. The phone app encrypts the current time. The server app decrypts the string to the current time and if the diff between that time and the actual server time is less than 10 minutes it's an ok. Difficult for other users to fake a key, but encryption gives such nasty strings to enter, and the hardware token gives me nice things like 'H554TU8' And this is probably not how the real hardware token works, because the server and the phone app must 'know' the same encryption key. Michel

    Read the article

  • crowd website simulation on localhost for a php/mysql project

    - by Mac Taylor
    hey guys I searched for a while on how to find a benchmarking software that can simulate crowd website with more than 1000 users online to find out leaks in my php/mysql script . as long as i ran my script for a huge community and it wasn't successful enough and lots of RAM usage happened , now I need a way to simulate that much usage to benchmark my script and optimize it . I am using XAMMP Local Server and my project written in PHP&MYSQL. thanks in advance

    Read the article

  • How do I read from a file consists of city names and coordinates/Populations and create functions to get the coordinates and population?

    - by Braybray
    I'm using Python, and I have a file which has city names and information such as names, coordinates of the city and population of the city: Youngstown, OH[4110,8065]115436 Yankton, SD[4288,9739]12011 966 Yakima, WA[4660,12051]49826 1513 2410 Worcester, MA[4227,7180]161799 2964 1520 604 Wisconsin Dells, WI[4363,8977]2521 1149 1817 481 595 How can I create a function to take the city name and return a list containing the latitude and longitude of the given city? fin = open ("miles.dat","r") def getCoordinates cities = [] for line in fin: cities.append(line.rstrip()) for word in line: print line.split() That's what I tried now; how could I get the coordinates of the city by calling the names of the city and how can I return the word of each line but not letters? Any help will be much appreciated, thanks all.

    Read the article

  • Research idea in simulation

    - by Nilani Algiriyage
    Hi, I'm an undergraduate in University of Keleniya,Sri Lanka. I'm interested in doing a research on BPM, BPMN. But I have very few knowledgeable people and very few resources in my country. My supervisor also doesn't have enough knowledge in this area. So if you can please help me to find a research topic in BPM or BPMN. At least please help me to get an idea what areas I can do? Thank you very much. Regards, Nilani.

    Read the article

  • Parallel Processing Simulation in Javascript

    - by le_havre
    Hello, I'm new to JavaScript so forgive me for being a n00b. When there's intensive calculation required, it more than likely involves loops that are recursive or otherwise. Sometimes this may mean having am recursive loop that runs four functions and maybe each of those functions walks the entire DOM tree, read positions and do some math for collision detection or whatever. While the first function is walking the DOM tree, the next one will have to wait its for the first one to finish, and so forth. Instead of doing this, why not launch those loops-within-loops separately, outside the programs, and act on their calculations in another loop that runs slower because it isn't doing those calculations itself? Retarded or clever? Thanks in advance!

    Read the article

  • What's the best way to implement one-dimensional collision detection?

    - by cyclotis04
    I'm writing a piece of simulation software, and need an efficient way to test for collisions along a line. The simulation is of a train crossing several switches on a track. When a wheel comes within N inches of the switch, the switch turns on, then turns off when the wheel leaves. Since all wheels are the same size, and all switches are the same size, I can represent them as a single coordinate X along the track. Switch distances and wheel distances don't change in relation to each other, once set. This is a fairly trivial problem when done through brute force by placing the X coordinates in lists, and traversing them, but I need a way to do so efficiently, because it needs to be extremely accurate, even when the train is moving at high speeds. There's a ton of tutorials on 2D collision detection, but I'm not sure the best way to go about this unique 1D scenario.

    Read the article

  • Debug CGI by simulation

    - by Jonathan
    I basically want to debug a cgi programm with gdb by emulating the environment variables and stdin stream. How do I set the variables and stdin? I am using lampp and gdb. Thanks!

    Read the article

  • Where Not In OR Except simulation of SQL in LINQ to Object(C#)

    - by Thinking
    Suppose I have two lists that holds the list of source file names and destination file names respectively. The Sourcefilenamelist has files as 1.txt, 2.txt,3.txt, 4.txt while the Destinaitonlist has 1.txt,2.txt. I ned to write a linq query to find out which files are in SourceList that are absent in DestinationFile list. e.g. here the out put will be 3.txt and 4.txt. I have done this by a foreach statement.. but now I want to do the same by using LINQ(C#). Help needed. Thanks

    Read the article

  • How to start coding the "Dining Philosophers" simulation?

    - by GrizzlyGuru
    I'm not a beginner at C# but I really need to increase my understanding, so I've picked a classic deadlock problem to code to help teach myself some of the more advanced concepts of C#. The Dining Philosophers Problem seems like a good one, but I need a little help to get started. I know I need to approach the "diners" as objects, but to simulate the random delays between eating, should I look to threading with each diner in a separate thread? Do I need some kind of "master" to monitor all the actions? Any general design concept advice is welcome, but I'd like to do the grunt programming as an exercise. Thanks!

    Read the article

  • Google maps in iPhone - city & State name by Longitude & Latitude

    - by sugar
    I have developed an application in which the data About Schools are stored in ASP.NET Web Server. The database has following values. =School Name = Longitude of School = Latitude of School. Now, I retrieve all the data in iPhone through web-service & NSURLRequest. Now, Following is my Problem. When user Clicks on a school ( in tableView ). Google map should be load - ( i can do that ) A pin should be dropped at the place - ( i can do that ) A pin title should be with City & State name - ( i can't do ) Thanks in advance for helping me.

    Read the article

  • Matlab Coin Toss Simulation

    - by user1772959
    I have to write some code in Matlab that simulates tossing a coin 150 times. I have to count how many times the coin lands on heads and create a vector that gives a running percentage of the heads. Then I have to make a table of the number of trials, random 'flips", and the running percentages of heads. I assume random "flips" means heads or tails for that trial. I also have to create a line graph with trials on the x-axis and probabilities (percentages) on the y-axis. I'm assuming the percentages are just the percentage of getting heads. Sorry if this post was long. I figure giving the details now will make it easier to see what I was trying to do with the code. I didn't create the table or plot yet because I'm not even sure how to code for the actual problem. NUM_TRIALS = 150; trials = 1:NUM_TRIALS; heads = 0; t = rand(NUM_TRIALS,1); for i = trials if (t < 0.5) heads = heads + 1; end z = zeros(NUM_TRIALS,1); percent_h = heads/trials; end

    Read the article

  • UI Design - design pattern for city/country drop down? (ASP.NET MVC)

    - by JK
    What is the best way to do a city/country dropdown pair in ASP.NET MVC? I see lots of places with country above city, but that's unnatural: in real life we write city/country. I've used city, then country, but the problem is that the user then has to go backwards after changing the country. The other problem is what do you do about cities/countries not in your list? If city/country are both drop downs, then the user cant type their own city if it is missing. But if you have a dropdown and a textbox, that makes it unwieldy (you end up with 4 controls to enter 2 pieces of data). Are there any examples websites where the city/country dropdown pair are done in a very useable and clear manner?

    Read the article

  • Effective simulation of compound poisson process in Matlab

    - by Henrik
    I need to simulate a huge bunch of compound poisson processes in Matlab on a very fine grid so I am looking to do it most effectively. I need to do a lot of simulations on the same random numbers but with parameters changing so it is practical to draw the uniforms and normals beforehand even though it means i have to draw a lot more than i will probably need and won't matter much because it will only need to be done once compared to in the order 500*n repl times the actual compound process generation. My method is the following: Let T be for how long i need to simulate and N the grid points, then my grid is: t=linspace(1,T,N); Let nrepl be the number of processes i need then I simulate P=poissrnd(lambda,nrepl,1); % Number of jumps for each replication U=(T-1)*rand(10000,nrepl)+1; % Set of uniforms on (1,T) for jump times N=randn(10000,nrepl); % Set of normals for jump size Then for replication j: Poiss=P(j); % Jumps for replication Uni=U(1:Poiss,j);% Jump times Norm=mu+sigma*N(1:Poiss,j);% Jump sizes Then this I guess is where I need your advice, I use this one-liner but it seems very slow: CPP_norm=sum(bsxfun(@times,bsxfun(@gt,t,Uni),Norm),1); In the inner for each jump it creates a series of same length as t with 0 until jump and then 1 after, multiplying this will create a grid with zeroes until jump has arrived and then the jump size and finally adding all these will produce the entire jump process on the grid. How can this be done more effectively? Thank you very much.

    Read the article

  • Defining scope for Record Count functoid:

    - by ArunManick
    Defining scope for Record Count functoid: Problem: One of the most common scenarios in BizTalk is calculating the record count of repeating structure. BizTalk has come up with an advanced functoid called Record Count functoid which will give the record count for the repeating structure however you cannot define the scope for a Record Count functoid. Because Record Count functoid accepts exactly one parameter which can be repeating record or field element.   If somebody don’t know what “scope” means I will explain with a simple example. Consider that we have a source schema having a structure Country -> State -> City. Country will have various states and each state will have different cities. Now you want to calculate no. of cities present in each state. Here scope is defined at the parent node “State”. Traditional Record Count functoid will give the total no. of cities present in the source message and not the State level city count.   Source Schema:   Destination Schema:   Soultion #1: As the title indicates we are not going to add one more parameter to the record count functoid. Instead of that, we are going to achieve the solution with the help of Scripting functoid with Inline XSLT script. XSLT is basically the transformation language used in the mapping.     “No.OfCities” indicates the destination field name to which we are going to send the value. In count(City), “count” refers to built in XPath function used in XSLT and “City” refers to source schema record name. Here you can find the list of built-in functions available in XSLT.   The mapping will look like as follows:   The 2 Record Count functoids used in this map will give the total number of states and total number of cities as that of input message.   Soultion #2:  If someone doesn’t like XSLT code and they wish to achieve the solution using functoids alone, then here is another solution.   Use logical Existence functoid to check whether “City” exist or not Connect the output of Logical Existence functoid to the Value Mapping functoid with second parameter as constant “1”. Hence if the first parameter is TRUE it will give the output as “1”. Connect the output of Value Mapping functoid to the Cumulative Sum functoid with scope as “1”   This will calculate the City count at the state level. The mapping will look like as follows:     Let us see the sample input and the map output.   Input: <?xml version="1.0" encoding="utf-8"?> <ns0:Country xmlns:ns0="http://RecordCount.Source">   <State>     <StateName>Tamilnadu</StateName>     <City>       <CityName>Pollachi</CityName>     </City>     <City>       <CityName>Coimbatore</CityName>     </City>     <City>       <CityName>Chennai</CityName>     </City>   </State>   <State>     <StateName>Kerala</StateName>     <City>       <CityName>Palakad</CityName>     </City>   </State>   <State>     <StateName>Karnataka</StateName>     <City>       <CityName>Bangalore</CityName>     </City>     <City>       <CityName>Mangalore</CityName>     </City>   </State> </ns0:Country>     Output: <ns0:Country xmlns:ns0="http://RecordCount.Destination">           <No.OfStates>3</No.OfStates>           <No.OfCities>6</No.OfCities>           <States>                    <No.OfCities>3</No.OfCities>           </States>           <States>                    <No.OfCities>1</No.OfCities>           </States>           <States>                    <No.OfCities>2</No.OfCities>           </States> </ns0:Country>   Conclusion: This is my first post and I hope you enjoyed it.   -Arun

    Read the article

  • Linq to XML Document Traversal

    - by Perpetualcoder
    I have an xml document like this: <?xml version="1.0" encoding="utf-8" ?> <demographics> <country id="1" value="USA"> <state id ="1" value="California"> <city>Long Beach</city> <city>Los Angeles</city> <city>San Diego</city> </state> <state id ="2" value="Arizona"> <city>Tucson</city> <city>Phoenix</city> <city>Tempe</city> </state> </country> <country id="2" value="Mexico"> <state id ="1" value="Baja California"> <city>Tijuana</city> <city>Rosarito</city> </state> </country> </demographics> How do I setup LINQ queries for doing things like: 1. Get All Countries 2. Get All States in a Country 3. Get All Cities inside a state of a paricular country ? I gave it a try and I am kind of confused when to use Elements["NodeName"] and Descendants etc. I know I am not the brightest XML guy around. Is the format of the XML file even correct for simple traversal?

    Read the article

  • 2D Ball Collisions with Corners

    - by Aaron
    I'm trying to write a 2D simulation of a ball that bounces off of fixed vertical and horizontal walls. Simulating collisions with the faces of the walls was pretty simple--just negate the X-velocity for a vertical wall or the Y-velocity for a horizontal wall. The problem is that the ball can also collide with the corners of the walls, where a horizontal wall meets with a vertical wall. I have already figured out how to detect when a collision with a corner is occurring. My question is how the ball should react to this collision--that is, how its X and Y velocities will change as a result. Here's a list of what I already know or know how to find: *The X and Y coordinates of the ball's center during the frame when a collision is detected *The X and Y components of the ball's velocity *The X and Y coordinates of the corner *The angle between the ball's center and the corner *The angle in which the ball is traveling just before the collision *The amount that the ball is overlapping the corner when the collision is detected I'm guessing that it's best to pretend that the corner is an infinitely small circle, so I can treat a collision between the ball and that circle as if the ball were colliding with a wall that runs tangent to the circles at the point of collision. It seems to me that all I need to do is rotate the coordinate system to line up with this imaginary wall, reverse the X component of the ball's velocity under this system, and rotate the coordinates back to the original system. The problem is that I have no idea how to program this. By the way, this is an ideal simulation. I'm not taking anything like friction or the ball's rotation into account. I'm using Objective-C, but I'd really just like a general algorithm or some advice. Many thanks if anyone can help!

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >