Search Results

Search found 3826 results on 154 pages for 'graph theory'.

Page 33/154 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • 3D Ball Physics Theory: collision response on ground and against walls?

    - by David
    I'm really struggling to get a strong grasp on how I should be handling collision response in a game engine I'm building around a 3D ball physics concept. Think Monkey Ball as an example of the type of gameplay. I am currently using sphere-to-sphere broad phase, then AABB to OBB testing (the final test I am using right now is one that checks if one of the 8 OBB points crosses the planes of the object it is testing against). This seems to work pretty well, and I am getting back: Plane that object is colliding against (with a point on the plane, the plane's normal, and the exact point of intersection. I've tried what feels like dozens of different high-level strategies for handling these collisions, without any real success. I think my biggest problem is understanding how to handle collisions against walls in the x-y axes (left/right, front/back), which I want to have elasticity, and the ground (z-axis) where I want an elastic reaction if the ball drops down, but then for it to eventually normalize and be kept "on the ground" (not go into the ground, but also not continue bouncing). Without kluging something together, I'm positive there is a good way to handle this, my theories just aren't getting me all the way there. For physics modeling and movement, I am trying to use a Euler based setup with each object maintaining a position (and destination position prior to collision detection), a velocity (which is added onto the position to determine the destination position), and an acceleration (which I use to store any player input being put on the ball, as well as gravity in the z coord). Starting from when I detect a collision, what is a good way to approach the response to get the expected behavior in all cases? Thanks in advance to anyone taking the time to assist... I am grateful for any pointers, and happy to post any additional info or code if it is useful. UPDATE Based on Steve H's and eBusiness' responses below, I have adapted my collision response to what makes a lot more sense now. It was close to right before, but I didn't have all the right pieces together at the right time! I have one problem left to solve, and that is what is causing the floor collision to hit every frame. Here's the collision response code I have now for the ball, then I'll describe the last bit I'm still struggling to understand. // if we are moving in the direction of the plane (against the normal)... if (m_velocity.dot(intersection.plane.normal) <= 0.0f) { float dampeningForce = 1.8f; // eventually create this value based on mass and acceleration // Calculate the projection velocity PVRTVec3 actingVelocity = m_velocity.project(intersection.plane.normal); m_velocity -= actingVelocity * dampeningForce; } // Clamp z-velocity to zero if we are within a certain threshold // -- NOTE: this was an experimental idea I had to solve the "jitter" bug I'll describe below float diff = 0.2f - abs(m_velocity.z); if (diff > 0.0f && diff <= 0.2f) { m_velocity.z = 0.0f; } // Take this object to its new destination position based on... // -- our pre-collision position + vector to the collision point + our new velocity after collision * time // -- remaining after the collision to finish the movement m_destPosition = m_position + intersection.diff + (m_velocity * intersection.tRemaining * GAMESTATE->dt); The above snippet is run after a collision is detected on the ball (collider) with a collidee (floor in this case). With a dampening force of 1.8f, the ball's reflected "upward" velocity will eventually be overcome by gravity, so the ball will essentially be stuck on the floor. THIS is the problem I have now... the collision code is running every frame (since the ball's z-velocity is constantly pushing it a collision with the floor below it). The ball is not technically stuck, I can move it around still, but the movement is really goofy because the velocity and position keep getting affected adversely by the above snippet. I was experimenting with an idea to clamp the z-velocity to zero if it was "close to zero", but this didn't do what I think... probably because the very next frame the ball gets a new gravity acceleration applied to its velocity regardless (which I think is good, right?). Collisions with walls are as they used to be and work very well. It's just this last bit of "stickiness" to deal with. The camera is constantly jittering up and down by extremely small fractions too when the ball is "at rest". I'll keep playing with it... I like puzzles like this, especially when I think I'm close. Any final ideas on what I could be doing wrong here? UPDATE 2 Good news - I discovered I should be subtracting the intersection.diff from the m_position (position prior to collision). The intersection.diff is my calculation of the difference in the vector of position to destPosition from the intersection point to the position. In this case, adding it was causing my ball to always go "up" just a little bit, causing the jitter. By subtracting it, and moving that clamper for the velocity.z when close to zero to being above the dot product (and changing the test from <= 0 to < 0), I now have the following: // Clamp z-velocity to zero if we are within a certain threshold float diff = 0.2f - abs(m_velocity.z); if (diff > 0.0f && diff <= 0.2f) { m_velocity.z = 0.0f; } // if we are moving in the direction of the plane (against the normal)... float dotprod = m_velocity.dot(intersection.plane.normal); if (dotprod < 0.0f) { float dampeningForce = 1.8f; // eventually create this value based on mass and acceleration? // Calculate the projection velocity PVRTVec3 actingVelocity = m_velocity.project(intersection.plane.normal); m_velocity -= actingVelocity * dampeningForce; } // Take this object to its new destination position based on... // -- our pre-collision position + vector to the collision point + our new velocity after collision * time // -- remaining after the collision to finish the movement m_destPosition = m_position - intersection.diff + (m_velocity * intersection.tRemaining * GAMESTATE->dt); UpdateWorldMatrix(m_destWorldMatrix, m_destOBB, m_destPosition, false); This is MUCH better. No jitter, and the ball now "rests" at the floor, while still bouncing off the floor and walls. The ONLY thing left is that the ball is now virtually "stuck". He can move but at a much slower rate, likely because the else of my dot product test is only letting the ball move at a rate multiplied against the tRemaining... I think this is a better solution than I had previously, but still somehow not the right idea. BTW, I'm trying to journal my progress through this problem for anyone else with a similar situation - hopefully it will serve as some help, as many similar posts have for me over the years.

    Read the article

  • Is there such thing as a "theory of system integration"?

    - by Jeff
    There is a plethora of different programs, servers, and in general technologies in use in organizations today. We, programmers, have lots of different tools at our disposal to help solve various different data, and communication challenges in an organization. Does anyone know if anyone has done an serious thinking about how systems are integrated? Let me give an example: Hypothetically, let's say I own a company that makes specialized suits a'la Iron Man. In the area of production, I have CAD tools, machining tools, payroll, project management, and asset management tools to name a few. I also have nice design space, where designers show off their designs on big displays, some touch, some traditional. Oh, and I also have one of these new fangled LEED Platinum buildings and it has number of different computer controlled systems, like smart window shutters that close when people are in the room, a HVAC system that adjusts depending on the number of people in the building, etc. What I want to know is if anyone has done any scientific work on trying to figure out how to hook all these pieces together, so that say my access control system is hooked to my payroll system, and my phone system allowing my never to swipe a time card, and to have my phone follow me throughout the building. This problem is also more than a technology challenge. Every technology implementation enables certain human behaviours, so the human must also be considered as a part of the system. Has anyone done any work in how effectively weave these components together? FYI: I am not trying to build a system. I want to know if anyone has thoroughly studied the process of doing a large integration project, how they develop their requirements, how they studied the human behaviors, etc.

    Read the article

  • How to eager load in WCF Ria Services/Linq2SQLDomainModel

    - by Aggelos Mpimpoudis
    I have a databound grid at my view (XAML) and the Itemsource points to a ReportsCollection. The Reports entity has three primitives and some complex types. These three are shown as expected at datagrid. Additionally the Reports entity has a property of type Store. When loading Reports via GetReports domain method, I quickly figure out that only primitives are returned and not the whole graph of some depth. So, as I wanted to load the Store property too, I made this alteration at my domain service: public IQueryable<Report> GetReports() { return this.ObjectContext.Reports.Include("Store"); } From what I see at the immediate window, store is loaded as expected, but when returned to client is still pruned. How can this be fixed? Thank you!

    Read the article

  • How to draw a 3D donut chart in OpenGL?

    - by paulbeesley
    I would like to draw a chart in OpenGL similar to the donut graph at the bottom-right of this example. I have experience with drawing 2D charts such as the main chart in the example but what confuses me about the one I want to draw is the correct type of primitive to use when drawing the 3D chart. I have considered using GL_QUAD_STRIP and GL_POLYGON but neither seem quite right for the task. Where should I begin? I will be using JOGL with Java to draw the chart, if that helps at all. Also, I don't necessarily need to extrude certain slices of the chart as shown in the example.

    Read the article

  • How to convert an object into a double?

    - by george t.
    I am working on VS C# on the following code, which converts an user input math expression and computes it. MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl(); sc.Language = "VBScript"; sc.ExecuteStatement( "function pi\n" + "pi = 3.14159265\n" + "end function"); sc.ExecuteStatement( "function e\n" + "e = exp(1)\n" + "end function"); expression = textBox1.Text.ToString(); expression = expression.Replace("x", i.ToString()); object y = sc.Eval(expression); string k = y.ToString(); double result = double.Parse(k); While this outputs onto the console with the correct result, I want to use the values to make a graph of the function user inputs and it's not doing it correctly. Thank you for your help.

    Read the article

  • Facebook Canvas iFrame App - Authorizing users with new OAuth protocol

    - by Rick
    Hi, I'm developing a new Facebook Canvas application within an iFrame and trying to authorize users. The new OAuth api recommends I do a redirect to the following to authorize a user in my app: https://graph.facebook.com/oauth/authorize? client_id=...& redirect_uri=http://www.example.com/oauth_redirect However this produces a weird problem where a full Facebook page requesting permissions from the user is rendered within the iFrame itself (i.e. facebook within Facebook). Does anyone know how to solve this with the new OAuth API as I don't want to start using old REST API methods. Thanks, Rick

    Read the article

  • New Facebook FQL table vs. Grap API

    - by PanosJee
    Hello everyone I just read the new User fql table fields at http://developers.facebook.com/docs/reference/fql/user As I can see a lot of the fields have been deprecated such as work_history or books and movies. It is quite essential for my app to get all those fields for my user's friends in a single fql query. If i am not wrong the only way to do this is to get those extra fields using the Graph API by requesting them seperately for every friend of my user. Is there any way to do it in a more efficient way without so many calls? Can I subscribe to real time updates for the request fields for my user's friends (i do not care about the logged in user data)? Thank you a lot

    Read the article

  • How to get predecessor and successors from an adjacency matrix

    - by NickTFried
    Hi I am am trying to complete an assignment, where it is ok to consult the online community. I have to create a graph class that ultimately can do Breadth First Search and Depth First Search. I have been able to implement those algorithms successfully however another requirement is to be able to get the successors and predecessors and detect if two vertices are either predecessors or successors for each other. I'm having trouble thinking of a way to do this. I will post my code below, if anyone has any suggestions it would be greatly appreciated. import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; public class Graph<T> { public Vertex<T> root; public ArrayList<Vertex<T>> vertices=new ArrayList<Vertex<T>>(); public int[][] adjMatrix; int size; private ArrayList<Vertex<T>> dfsArrList; private ArrayList<Vertex<T>> bfsArrList; public void setRootVertex(Vertex<T> n) { this.root=n; } public Vertex<T> getRootVertex() { return this.root; } public void addVertex(Vertex<T> n) { vertices.add(n); } public void removeVertex(int loc){ vertices.remove(loc); } public void addEdge(Vertex<T> start,Vertex<T> end) { if(adjMatrix==null) { size=vertices.size(); adjMatrix=new int[size][size]; } int startIndex=vertices.indexOf(start); int endIndex=vertices.indexOf(end); adjMatrix[startIndex][endIndex]=1; adjMatrix[endIndex][startIndex]=1; } public void removeEdge(Vertex<T> v1, Vertex<T> v2){ int startIndex=vertices.indexOf(v1); int endIndex=vertices.indexOf(v2); adjMatrix[startIndex][endIndex]=1; adjMatrix[endIndex][startIndex]=1; } public int countVertices(){ int ver = vertices.size(); return ver; } /* public boolean isPredecessor( Vertex<T> a, Vertex<T> b){ for() return true; }*/ /* public boolean isSuccessor( Vertex<T> a, Vertex<T> b){ for() return true; }*/ public void getSuccessors(Vertex<T> v1){ } public void getPredessors(Vertex<T> v1){ } private Vertex<T> getUnvisitedChildNode(Vertex<T> n) { int index=vertices.indexOf(n); int j=0; while(j<size) { if(adjMatrix[index][j]==1 && vertices.get(j).visited==false) { return vertices.get(j); } j++; } return null; } public Iterator<Vertex<T>> bfs() { Queue<Vertex<T>> q=new LinkedList<Vertex<T>>(); q.add(this.root); printVertex(this.root); root.visited=true; while(!q.isEmpty()) { Vertex<T> n=q.remove(); Vertex<T> child=null; while((child=getUnvisitedChildNode(n))!=null) { child.visited=true; bfsArrList.add(child); q.add(child); } } clearVertices(); return bfsArrList.iterator(); } public Iterator<Vertex<T>> dfs() { Stack<Vertex<T>> s=new Stack<Vertex<T>>(); s.push(this.root); root.visited=true; printVertex(root); while(!s.isEmpty()) { Vertex<T> n=s.peek(); Vertex<T> child=getUnvisitedChildNode(n); if(child!=null) { child.visited=true; dfsArrList.add(child); s.push(child); } else { s.pop(); } } clearVertices(); return dfsArrList.iterator(); } private void clearVertices() { int i=0; while(i<size) { Vertex<T> n=vertices.get(i); n.visited=false; i++; } } private void printVertex(Vertex<T> n) { System.out.print(n.label+" "); } }

    Read the article

  • jgraph like component on vaadin framework

    - by vsp
    Hi, Currently I am working on a process manager kind application, which needs jgraph( http://www.jgraph.com ) kind of component. The process manager is a kind of process flow chart. I am currently using vaadin framework. Is there any such built in components available in vaadin or can i have any plugin to create a drag & drop graph for my app. Please let me know if any one has already done this. Thanks.

    Read the article

  • Drawing reflexive edges in State Machines

    - by reforged
    I have to draw a small finite state machine that has some reflexive transitions (meaning the start and the end state of the transition are equal. The problem is that rendering that in Graphviz has ugly results. digraph finite_state_machine { edge [fontsize=11]; S0 - S0 [label = "td=1\n-/e2"]; S0 - S1 [label = "td=3 \n-/e3" ]; S1 - S0 [label = "td=3\n-/-\nt=0"]; S0 - S2 [label = "P:i1/e4"]; S2 - S0 [label = "td=0\n-/-" ]; S0 - S0 [label = "i1/e1\ntd+=1"]; } Is there a way to make this look a little better? BTW: I tried head/tailport but they don't work on my version of Graphviz (1.13 on Mac OS X) I am not limited to the dot engine, I only want a nice looking graph and don't care about the renderer/language. Thanks a lot

    Read the article

  • shortest path search in a map represented as 2d shapes

    - by joe_shmoe
    Hi, I have a small library of a few shortest path search algorithms. They were developed for simple undirected graphs (the normal representation - vertices and edges). Now I'd like to somehow apply them on a bit different scenario - where the maps are represented as 2-dimensional shapes, connected by shared edges (edges of the polygons, that is). In this scenario, the search can start/end either at a map object or some point (x,y). What would be the best approach? Try to apply the algorithms onto shapes? or try to extract a 'normal' graph out of the shapes (I have preprocessing time available)? Any advice would be much appreciated, as I'm really not sure which way to go, and I don't have enough time (and skill) to explore many options... Thanks a lot

    Read the article

  • circuit/block-diagram drawing

    - by JCLL
    I'm looking for either algorithms or visualization tool for (nice) circuit/block-diagram drawing. I am also interested in a general formulation of the problem. By "circuit drawing", I mean the capability of exploring place & route for block-diagrams (rectangles) with I/O ports and their connections (wires). These block-diagrams can be hierarchical i.e some blocks may have some nested internal sub-structure etc. This topic is strongly related to classical graph-drawing, with the supplemental constraint of the need to take ports location into account, and possibly the shape of the blocks (rectangle of various sizes). Graphviz tools do not respond to the problem (at least my previous experiments have not been satisfactory). Force-directed algorithms retain my attention, but I have just found papers on classical directed graphs. Any hints ?

    Read the article

  • best way to get new access_token using PHP sdk

    - by randy
    I am getting the error "An active access token must be used to query information about the current user". There seems to be tons of articles and ideas, but am very confused and it seems that things are changing as well. A lot say to use offline-access but that appears to be going away. I did find this article. Does anyone have an example using the PHP SDK? I tried doing something like the below but it does not seem to work; $FBuser is still zero: $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . FB_APP_ID . "&client_secret=" . FB_APP_SECRET . "&grant_type=client_credentials"; list($name, $ACCESS_TOKEN) = explode("=", file_get_contents($token_url) ); $facebook->setAccessToken(ACCESS_TOKEN); $FBuser = $facebook->getUser();

    Read the article

  • Stream post URL security and wall post links

    - by Jeff Lee
    Our app's mobile client can create wall post links to our app's web-facing pages. Since this happens in the context of a mobile app, we do this on behalf of our user using the Graph API's feed/message endpoint. I noticed that the links showing up in the wall posts are being routed through our app's auth dialog, which is NOT what we want. We just want transparent links, without forcing the client to auth our app, similar to what happens when you share to FB in Path. I went ahead and disabled the "Stream post URL option" several hours ago, but we still seem to be getting the re-routed links for wall posts. The target URLs for these links are within the domain we've registered for our Facebook app. Is there anything else I need to do fix this?

    Read the article

  • Code jumps out of a jar and runs? What is causing this?

    - by Mike
    I am trying to get a sample program working with JUNG, a graphing tool in Java. I downloaded and referenced all the .jar files in eclipse so my project hierarchy looks like this: In Test.java I have the following code: public class Test { static public void main() { System.out.print("Hello"); }} For some reason though when I try to run it as a Java Application by right clicking on Jung test in the project hierarchy I am presented with a bunch of classes. My Test.java isn't on the list so if I just leave it as ** and press ok it starts running a program that is dynamically adding nodes and vertexes to a graph. I can't seem to figure out what code its actually executing. I know java but stuff like this with the jar files seems to be getting lost on me. Any ideas? Thanks

    Read the article

  • st-ordering library function?

    - by chang
    I'm in the search for an implementation of an ear-decomposition algorithm (http://www.ics.uci.edu/~eppstein/junkyard/euler/ear.html). I examined networkx and didn't find one. Although the algorithm layout is vaguely in my mind, I'd like to see some reference implementation, too. Side problem: First step could be an st-ordering of a graph. Are there any implementations for st-ordering algorithms you know? Thanks for your input. I'd really like to contribute e.g. to networkx by implementing the ear-decomposition algorithm in python.

    Read the article

  • Recommended Tutorials for php mysql and graphs

    - by Vinit Joshi
    I need help to find a tutorial or anything to help me create a comparison chart. The user is able to search for device names. The information about the device names is in a drop down box dynamically added from the database. I want the user to be able to select two separate devices and view the devices information plotted onto a graph. I'll be grateful for keywords that I can search for or any tutorials that will help me to carry on with this task. Currently on my screen I can see the data that has been inserted into the database. This data is placed inside a table. I have so far used xhtml, php and mysql. I've tried to make the question as clear as possible so sorry if it does confuse anyone.

    Read the article

  • core-plot and NSDate (iPhone)

    - by Urizen
    I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days. I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-plot distribution but have found it a little confusing. Does anyone know of a tutorial, or code sample, which might asist me in this regard? Thank you in advance.

    Read the article

  • Trust metrics and related algorithms

    - by Nick Gerakines
    I'm trying to learn more about trust metrics (including related algorithms) and how user voting, ranking and rating systems can be wired to stiffle abuse. I've read abstract articles and papers describing trust metrics but haven't seen any actual implementations. My goal is to create a system that allows users to vote on other users and the content of other users and with those votes and related meta-data, determine if those votes can be applied to a users level or popularity. Have you used or seen some sort of trust system within a social graph? How did it work and what were its areas of strength and weaknesses?

    Read the article

  • Why is image_hash empty for some ad_creatives? Is it because it is expired?

    - by Chris Conner
    I ran _"https://graph.facebook.com/act_47121778/adcreatives?access_token=_ and got the following results. Why are some creatives returning empty image hash? { "view_tag": "", "alt_view_tags": [ ], "creative_id": "6002716206572", "type": 1, "title": "Grow your fans!", "body": "Fan Page Owners! Grow your fanbase. Create quizzes for your page. Win $100 Weekly. Make money with our revenue share program.", "image_hash": "6ac30e43f21c8580361de92d3288ed68", "link_url": "http://www.facebook.com/quizwriter?sk=app_81434956828", "name": "Grow your fans!", "run_status": 1, "preview_url": "http://www.facebook.com/ads/api/creative_preview.php?cid=6002716206572", "count_current_adgroups": 1, "id": "6002716206572", "image_url": "http://creative.ak.fbcdn.net/v41818/flyers/109/44/1296329249810543669_1_31eb15ed.jpg" }, { "view_tag": "", "alt_view_tags": [ ], "creative_id": "6002444043572", "type": 1, "title": "Tennis Champs Social Game", "body": "Tennis Champ! Start with 5,000 dollars , beat out other players with your mad tennis skills and become the tennis champ! Socialize!", "image_hash": "", "link_url": "334886511760", "name": "Tennis Champs Social Game", "run_status": 1, "preview_url": "http://www.facebook.com/ads/api/creative_preview.php?cid=6002444043572", "count_current_adgroups": 2, "id": "6002444043572" },

    Read the article

  • Java: how to represent graphs?

    - by Rosarch
    I'm implementing some algorithms to teach myself about graphs and how to work with them. What would you recommend is the best way to do that in Java? I was thinking something like this: public class Vertex { private ArrayList<Vertex> outnodes; //Adjacency list. if I wanted to support edge weight, this would be a hash map. //methods to manipulate outnodes } public class Graph { private ArrayList<Vertex> nodes; //algorithms on graphs } But I basically just made this up. Is there a better way? Also, I want it to be able to support variations on vanilla graphs like digraphs, weighted edges, multigraphs, etc.

    Read the article

  • Neo4j+Gremlin : Trouble with T.gte and floating point node attributes

    - by letronje
    For a type of nodes in my graph, attribute values for an attribute(named 'some_count') is either missing or an integer or a float. I'm trying to write gremlin to filter these nodes based on minimum value for this attribute. I first verified that the values are indeed present by firing the following gremlin g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).some_count Next, I tried filtering by exact value and that works and show me the matching nodes or gives an empty array if there is no match g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).has('some_count', T.eq, 120000.0d) But the following query that uses the 'greater than or equal to' comparator doesn't work. g.v(XXX)._().in('category').hasNot('some_count', T.eq, null).back(1).has('some_count', T.gte, 1.0d) this returns nil (I'm querying via ruby/rails using Neo4j AR Adapter ) Instead of returning an empty array for no match, it returns a nil, which tells me something could be wrong with the query itself. I'm running neo4j community server 1.8. Is there a way I can ask Neo4j to log errors/queries, to see what could be going wrong ?

    Read the article

  • Optimising Androidplot

    - by Zammbi
    Seems Androidplot (androidplot.com) website/forums are down so I'll try asking this question here. I have multi touch zoom and scrolling. Similar code to http://mlepicki.com/2012/03/androidplot-multitouch-zoom-scroll/ except that I have a bar graph instead. However with 100 data points it has noticeable lag. Even with 10 bars are just showing. Sounds like its drawing/calculating/etc all bars. Any idea on how I could optimise this? I can't use hardware rendering as I want to support Android 2.1 and the library doesn't support it(it breaks).

    Read the article

  • Who owes who money optimisation problem

    - by Francis
    Say you have n people, each who owe each other money. In general it should be possible to reduce the amount of transactions that need to take place. i.e. if X owes Y £4 and Y owes X £8, then Y only needs to pay X £4 (1 transaction instead of 2). This becomes harder when X owes Y, but Y owes Z who owes X as well. I can see that you can easily calculate one particular cycle. It helps for me when I think of it as a fully connected graph, with the nodes being the amount each person owes. Problem seems to be NP-complete, but what kind of optimisation algorithm could I make, nevertheless, to reduce the total amount of transactions? Doesn't have to be that efficient, as N is quite small for me.

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >