Search Results

Search found 5176 results on 208 pages for 'max fraser'.

Page 51/208 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • 2D SAT Collision Detection not working when using certain polygons (With example)

    - by sFuller
    My SAT algorithm falsely reports that collision is occurring when using certain polygons. I believe this happens when using a polygon that does not contain a right angle. Here is a simple diagram of what is going wrong: Here is the problematic code: std::vector<vec2> axesB = polygonB->GetAxes(); //loop over axes B for(int i = 0; i < axesB.size(); i++) { float minA,minB,maxA,maxB; polygonA->Project(axesB[i],&minA,&maxA); polygonB->Project(axesB[i],&minB,&maxB); float intervalDistance = polygonA->GetIntervalDistance(minA, maxA, minB, maxB); if(intervalDistance >= 0) return false; //Collision not occurring } This function retrieves axes from the polygon: std::vector<vec2> Polygon::GetAxes() { std::vector<vec2> axes; for(int i = 0; i < verts.size(); i++) { vec2 a = verts[i]; vec2 b = verts[(i+1)%verts.size()]; vec2 edge = b-a; axes.push_back(vec2(-edge.y,edge.x).GetNormailzed()); } return axes; } This function returns the normalized vector: vec2 vec2::GetNormailzed() { float mag = sqrt( x*x + y*y ); return *this/mag; } This function projects a polygon onto an axis: void Polygon::Project(vec2* axis, float* min, float* max) { float d = axis->DotProduct(&verts[0]); float _min = d; float _max = d; for(int i = 1; i < verts.size(); i++) { d = axis->DotProduct(&verts[i]); _min = std::min(_min,d); _max = std::max(_max,d); } *min = _min; *max = _max; } This function returns the dot product of the vector with another vector. float vec2::DotProduct(vec2* other) { return (x*other->x + y*other->y); } Could anyone give me a pointer in the right direction to what could be causing this bug? Edit: I forgot this function, which gives me the interval distance: float Polygon::GetIntervalDistance(float minA, float maxA, float minB, float maxB) { float intervalDistance; if (minA < minB) { intervalDistance = minB - maxA; } else { intervalDistance = minA - maxB; } return intervalDistance; //A positive value indicates this axis can be separated. } Edit 2: I have recreated the problem in HTML5/Javascript: Demo

    Read the article

  • Sql query - how to construct

    - by Max Malmgren
    Hi. I am working to implement a dataconnection between my C# application and an Sql Express database. Please bear in mind I have not worked with Sql queries before. I have the following relevant tables: ArticlesCommon ArticlesLocalized CategoryCommon CategoryLocalized where ArticlesCommon holds language independent information such as price, weight etc. This is the statement for now: SELECT * FROM ArticlesCommon INNER JOIN ArticlesLocalized ON ArticlesCommon.ID = ArticlesLocalized.ID WHERE ArticlesLocalized.Language = @language ORDER BY ArticlesCommon.DateAdded ArticlesCommon contains a category id for each row. Now, I want to use this to look up the localized information in CategoryLocalized and add it to the result, something like SELECT *, CategoryLocalized.Name as CategoryName. If I have gotten my point across, is this doable? Thank you.

    Read the article

  • 2D isometric picking

    - by Bikonja
    I'm trying to implement picking in my isometric 2D game, however, I am failing. First of all, I've searched for a solution and came to several, different equations and even a solution using matrices. I tried implementing every single one, but none of them seem to work for me. The idea is that I have an array of tiles, with each tile having it's x and y coordinates specified (in this simplified example it's by it's position in the array). I'm thinking that the tile (0, 0) should be on the left, (max, 0) on top, (0, max) on the bottom and (max, max) on the right. I came up with this loop for drawing, which googling seems to have verified as the correct solution, as has the rendered scene (ofcourse, it could still be wrong, also, forgive the messy names and stuff, it's just a WIP proof of concept code) // Draw code int col = 0; int row = 0; for (int i = 0; i < nrOfTiles; ++i) { // XOffset and YOffset are currently hardcoded values, but will represent camera offset combined with HUD offset Point tile = IsoToScreen(col, row, TileWidth / 2, TileHeight / 2, XOffset, YOffset); int x = tile.X; int y = tile.Y; spriteBatch.Draw(_tiles[i], new Rectangle(tile.X, tile.Y, TileWidth, TileHeight), Color.White); col++; if (col >= Columns) // Columns is the number of tiles in a single row { col = 0; row++; } } // Get selection overlay location (removed check if selection exists for simplicity sake) Point tile = IsoToScreen(_selectedTile.X, _selectedTile.Y, TileWidth / 2, TileHeight / 2, XOffset, YOffset); spriteBatch.Draw(_selectionTexture, new Rectangle(tile.X, tile.Y, TileWidth, TileHeight), Color.White); // End of draw code public Point IsoToScreen(int isoX, int isoY, int widthHalf, int heightHalf, int xOffset, int yOffset) { Point newPoint = new Point(); newPoint.X = widthHalf * (isoX + isoY) + xOffset; newPoint.Y = heightHalf * (-isoX + isoY) + yOffset; return newPoint; } This code draws the tiles correctly. Now I wanted to do picking to select the tiles. For this, I tried coming up with equations of my own (including reversing the drawing equation) and I tried multiple solutions I found on the internet and none of these solutions worked. Trying out lots of solutions, I came upon one that didn't work, but it seemed like an axis was just inverted. I fiddled around with the equations and somehow managed to get it to actually work (but have no idea why it works), but while it's close, it still doesn't work. I'm not really sure how to describe the behaviour, but it changes the selection at wrong places, while being fairly close (sometimes spot on, sometimes a tile off, I believe never more off than the adjacent tile). This is the code I have for getting which tile coordinates are selected: public Point? ScreenToIso(int screenX, int screenY, int tileHeight, int offsetX, int offsetY) { Point? newPoint = null; int nX = -1; int nY = -1; int tX = screenX - offsetX; int tY = screenY - offsetY; nX = -(tY - tX / 2) / tileHeight; nY = (tY + tX / 2) / tileHeight; newPoint = new Point(nX, nY); return newPoint; } I have no idea why this code is so close, especially considering it doesn't even use the tile width and all my attempts to write an equation myself or use a solution I googled failed. Also, I don't think this code accounts for the area outside the "tile" (the transparent part of the tile image), for which I intend to add a color map, but even if that's true, it's not the problem as the selection sometimes switches on approx 25% or 75% of width or height. I'm thinking I've stumbled upon a wrong path and need to backtrack, but at this point, I'm not sure what to do so I hope someone can shed some light on my error or point me to the right path. It may be worth mentioning that my goal is to not only pick the tile. Each main tile will be divided into 5x5 smaller tiles which won't be drawn seperately from the whole main tile, but they will need to be picked out. I think a color map of a main tile with different colors for different coordinates within the main tile should take care of that though, which would fall within using a color map for the main tile (for the transparent parts of the tile, meaning parts that possibly belong to other tiles).

    Read the article

  • Headless build of eclipse features - PDE Tools or Buckminster?

    - by Max
    I am trying to set up a headless build for a big eclipse feature, containing other features and plugins. As some needed plugins are generated using GMF and EMF, the build workflow must be something like this: SVN Check-out Invoke Generation Run Tests Build all Publish update-site Over the last couple of weeks, i played around with PDE Headless Build and Buckminster. Anyhow i still got problems with both and can't decide on which i should spent my effort. So what would you prefer? What experience you made? Anybody out there who needed to set up a similiar workflow before? Thank you for all answers :)

    Read the article

  • Open source C program with little requirements and at least 2MB binary size.

    - by max
    Hi, I'm developing a operating system and I need a test program (function of any kind) to test certain internal features. I cannot find any appropriate program to do this job. Probably one of you knows one. The program should be open source, written in C with very little user library usage (only file IO, pthreads, stdio, stdlib preferred) and must have a binary size of at least 2MB. Thanks for any suggestions.

    Read the article

  • How to display SUM fields from a detailed table in a master table

    - by max
    What is the best approach to display the summery of DETAILED.Fields in its master table? E.g. I have a master table called 'BILL' with all the bill related data and a detailed table ('BILL_DETAIL') with the bill detailed related data, like NAME, PRICE, TAX, ... Now I want to list all BILLS, without the details, but with the sum of the PRICE and TAX stored in the detail table. Here is a simplified schema of that tables: TABLE BILL ---------- - ID - NAME - ADDRESS - ... TABLE BILL_DETAIL ----------------- - ID - BILLID - PORDUCT_NAME - PRICE - TAX - ... The retrieved table row should look like this: BILL.CUSTOMER_NAME, BILL.CUSTOMER_ADDRESS, sum(BILL_DETAIL.PRICE), sum(BILL.DETAIL.TAX), ... Any sugguestions?

    Read the article

  • Convert NSString to fetch synthesized information.

    - by Max
    //COPY THIS CODE IN A FRESH PROJECT!!! //THIS 2 LINES ARE JUST EXAMPLES, IN REAL THEY ARE NOT STATIC! NSString *messagelevel1 = @"45"; NSString *messagelevel = @"1"; NSString *HuidigLevel = messagelevel; NSDecimalNumber *huidigleveldec = [[NSDecimalNumber alloc] initWithString: HuidigLevel]; float HuidigLevelRek = [huidigleveldec floatValue]; //HERE IS THE PROBLEM NSString* LevelTotaal=[[NSString alloc] initWithFormat:@"messagelevel%.f",HuidigLevelRek]; NSString*result = LevelTotaal; NSLog(@"%@",result); // THIS RESULT SHOULD RETURN THE SAME VALUE AS THE LINE UNDER THIS LINE! NSLog(@"%@",messagelevel1); I want the *result string behaves like the *huidiglevel string and fetch some information, but because the LevelTotaal is a NSString, It doesn't fetch this information. I really got no idea where to google for this problem, searching the Developer docs didn't helped either . Maybe you guys can help me out? Actually the second NSLog returns the value and to first NSLog just returns messagelevel1. To tell you in short ;) I hope you guys get what I'm saying!

    Read the article

  • Style, set to Qt application, vanishes, when QDockWindow or QToolBar is being unattached.

    - by Max
    Style, set to Qt application, vanishes, when QDockWindow or QToolBar is being unattached. Application is designed to work in Windows XP environment, most of users use it's 'classic' scheme, and application's style is Cleanlooks. It looks fine, until one want to undock dockable window or move toolbar. CLeanlooks vanishes, and it is rather ugly. Is there any workaround to handle this?

    Read the article

  • send email to single ExactTarget subscriber without TriggeredSend

    - by Max Gontar
    There is an email service ExactTarget with web service API. There are samples (in php though) for sending email to whole list instantly, or to single subscriber by triggered action. It's pretty hard to get in it's documentation, and I couldn't find explanation how to send email to a single subscriber instantly without having some triggering actions. Any help or advice will be great.

    Read the article

  • Ready to use TSP library

    - by Max
    Hi, I'm currently doing a project that requires some fast TSP solving (about 50-100 nodes in 2 seconds). There are a lots of approximation algorithms out there, but I don't have time nor will to analyze them and code them myself. Are there any free libraries that can solve TSP problem (approximation will do too)? Something like sortedNodes = solveTspPrettyPlease(nodes, 2sec) would be just great. Thanks in advance.

    Read the article

  • Queue-like data structure with fast search and insertion

    - by Max
    I need a datastructure with the following properties: It contains integer numbers, no duplicates. After it reaches the maximal size the first element is removed. So if the capacity is 3, then this is how it would look when putting in it sequential numbers: {}, {1}, {1, 2}, {1, 2, 3}, {2, 3, 4}, {3, 4, 5} etc. Only two operations are needed: inserting a number into this container (INSERT) and checking if the number is already in the container (EXISTS). The number of EXISTS operations is expected to be approximately 2 * number of INSERT operations. I need these operations to be as fast as possible. What would be the fastest data structure or combination of data structures for this scenario?

    Read the article

  • Duplicate ping response when running Ubuntu as virtual machine (VMWare)

    - by Stonerain
    I have the following setup: My router - 192.168.0.1 My host computer (Windows 7) - 192.168.0.3 And Ubuntu is running as virtual machine on the host. VMWare network settings is Bridged mode. I've modified Ubuntu network settings in /etc/netowrk/interfaces, set the following config: iface eth0 inet static address 192.168.0.220 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 Internet works correctly, I can install packages. But it gets weird if I try to ping something I get this: PING belpak.by (193.232.248.80) 56(84) bytes of data. From 192.168.0.1 icmp_seq=1 Time to live exceeded From 192.168.0.1 icmp_seq=1 Time to live exceeded From 192.168.0.1 icmp_seq=1 Time to live exceeded From 192.168.0.1 icmp_seq=1 Time to live exceeded From 192.168.0.1 icmp_seq=1 Time to live exceeded 64 bytes from belhost.by (193.232.248.80): icmp_seq=1 ttl=250 time=17.0 ms 64 bytes from belhost.by (193.232.248.80): icmp_seq=1 ttl=249 time=17.0 ms (DUP! ) 64 bytes from belhost.by (193.232.248.80): icmp_seq=1 ttl=248 time=17.0 ms (DUP! ) 64 bytes from belhost.by (193.232.248.80): icmp_seq=1 ttl=247 time=17.0 ms (DUP! ) 64 bytes from belhost.by (193.232.248.80): icmp_seq=1 ttl=246 time=17.0 ms (DUP! ) ^CFrom 192.168.0.1 icmp_seq=2 Time to live exceeded --- belpak.by ping statistics --- 2 packets transmitted, 1 received, +4 duplicates, +6 errors, 50% packet loss, ti me 999ms rtt min/avg/max/mdev = 17.023/17.041/17.048/0.117 ms I think even more interesting are the results of pinging the router itself: stonerain@ubuntu:~$ ping 192.168.0.1 -c 1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. From 192.168.0.3: icmp_seq=1 Redirect Network(New nexthop: 192.168.0.1) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=254 time=6.64 ms --- 192.168.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 6.644/6.644/6.644/0.000 ms But if I set -c 2: ... 64 bytes from 192.168.0.1: icmp_seq=1 ttl=252 time=13.5 ms (DUP!) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=251 time=13.5 ms (DUP!) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=254 time=13.5 ms (DUP!) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=253 time=13.5 ms (DUP!) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=252 time=13.5 ms (DUP!) 64 bytes from 192.168.0.1: icmp_seq=1 ttl=251 time=13.5 ms (DUP!) From 192.168.0.3: icmp_seq=2 Redirect Network(New nexthop: 192.168.0.1) 64 bytes from 192.168.0.1: icmp_seq=2 ttl=254 time=7.87 ms --- 192.168.0.1 ping statistics --- 2 packets transmitted, 2 received, +256 duplicates, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 6.666/10.141/13.556/2.410 ms Pinging host machine on the other hand works absolutely correctly: no DUPs, no errors. What seems to be the problem and how can I fix it? Thank you.

    Read the article

  • Google Analytics Export API - nextPagePath data

    - by Btibert3
    I am probably missing something obvious, but I do not understand when I query: start.date = DATE_START, end.date = DATE_END, dimensions = c("ga:pagePath","ga:previousPagePath"), metrics = c("ga:pageviews"), filters = mypageofinterest, table.id = "ga:mytable", max.results=RESULTS my data return as expected, all of the previous pages including (entrance). However, when I modify the code to be nextPagePath start.date = DATE_START, end.date = DATE_END, dimensions = c("ga:pagePath","ga:nextPagePath"), metrics = c("ga:pageviews"), filters = mypageofinterest, table.id = "ga:mytable", max.results=RESULTS only one line of data are returned; the pagepath and nextpagepath are identical with itself. I replicated this result using the Query Explorer. What am I missing or doing wrong? I was expecting to see a large number of "next" pages, including (exit). Thanks in advance.

    Read the article

  • Howto save AlsaMixer settings ?

    - by Pablo
    Hello I have tryed out the programm "EarCandy", now I had/have a lot of problems. At first I did not get any sound and now it is very low volume. PS Earcandy is now deleted from my harddisk. When Im opening the Alsamixer with: alsamixer I see that the volume for the speakers is zero. Now I push it to the max volume. But after every restart, I have to open alsamixer again and have to set the volume to max again. Can I save the settings for alsamixer or is there any other way to fix the problem ?

    Read the article

  • Adobe Air: Read and Write MP3 or JPG from local directory and switch bytes

    - by Max
    I would like to make my local jpg and mp3 files kind of unreadable (without encoding) by just putting the first 100 bytes from the beginning of the file to the end and then saving the file with a .dat extension. I know I have to use the byte array but can't get it work. I would also need then a small function to read that file and put the 100bytes back to the front so that I can play/display the file. It would be great if you could post the whole function because I am quite new to Air so that I fully understand. Thank You!!!!

    Read the article

  • Running daemon through rsh

    - by Max
    I want to run program as daemon in remote machine in Unix. I have rsh connection and I want the program to be running after disconnection. Suppose I have two programs: util.cpp and forker.cpp. util.cpp is some utility, for our purpose let it be just infinite root. util.cpp int main() { while (true) {}; return 0; } forker.cpp takes some program and run it in separe process through fork() and execve(): forker.cpp #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char** argv) { if (argc != 2) { printf("./a.out <program_to_fork>\n"); exit(1); } pid_t pid; if ((pid = fork()) < 0) { perror("fork error."); exit(1); } else if (!pid) { // Child. if (execve(argv[1], &(argv[1]), NULL) == -1) { perror("execve error."); exit(1); } } else { // Parent: do nothing. } return 0; } If I run: ./forker util forker is finished very quickly, and bash 'is not paused', and util is running as daemon. But if I run: scp forker remote_server://some_path/ scp program remote_server://some_path/ rsh remote_server 'cd /some_path; ./forker program' then it is all the same (i.e. at the remote_sever forker is finishing quickly, util is running) but my bash in local machine is paused. It is waiting for util stopping (I checked it. If util.cpp is returning than it is ok.), but I don't understand why?! There are two questions: 1) Why is it paused when I run it through rsh? I am sure that I chose some stupid way to run daemon. So 2) How to run some program as daemon in C/C++ in unix-like platforms. Tnx!

    Read the article

  • Handling Session ID with Spring

    - by Max
    Hi, I'm trying to build a Spring server for GWT (you can think of it as of Javascript AJAX client). But I can't decide on one point of architecture. How should session be created and used? The obvious easiest way - is to use HTTP sessions (cookies and stuff). Looks fine, but I think that sending session ID separate from the headers would be better (SOAP style). So, what is better: getMyPetsName(String sessionID, int petID) or getMyPetsName(int petID) + session ID through HTTP header (cookies or something). Another question is, if I use the first way (which I like more) - how do I handle session in Spring? I'm really newbie in Spring, and googling did not help. What I mean is: String getMyPetsName(String sessionID, int petID) { Session s = someWayToGetItById(sessionID); } Thanks in advance.

    Read the article

  • What are good words for defining multiples?

    - by Scott Langham
    In databases you might take about one-to-many. This means there's one thing that maps to zero or more others. In this kind of style I'm looking for words that define min/max amounts of things. So far, I have: min max one 1 1 many 0 infinite optional 0 1 ??? 1 infinite Is there a single word that fits '???' to mean more than one? Do you have better alternatives for 'optional'? I'm wondering if there are any conventional names for those concepts?

    Read the article

  • A* how make natural look path?

    - by user11177
    I've been reading this: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html But there are some things I don't understand, for example the article says to use something like this for pathfinding with diagonal movement: function heuristic(node) = dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) I don't know how do set D to get a natural looking path like in the article, I set D to the lowest cost between adjacent squares like it said, and I don't know what they meant by the stuff about the heuristic should be 4*D, that does not seem to change any thing. This is my heuristic function and move function: def heuristic(self, node, goal): D = 10 dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) def move_cost(self, current, node): cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1 return 19 if cross else 10 Result: The smooth sailing path we want to happen: The rest of my code: http://pastebin.com/TL2cEkeX

    Read the article

  • How to make natural-looking paths with A* on a grid?

    - by user11177
    I've been reading this: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html But there are some things I don't understand, for example the article says to use something like this for pathfinding with diagonal movement: function heuristic(node) = dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) I don't know how do set D to get a natural looking path like in the article, I set D to the lowest cost between adjacent squares like it said, and I don't know what they meant by the stuff about the heuristic should be 4*D, that does not seem to change any thing. This is my heuristic function and move function: def heuristic(self, node, goal): D = 10 dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) def move_cost(self, current, node): cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1 return 19 if cross else 10 Result: The smooth sailing path we want to happen: The rest of my code: http://pastebin.com/TL2cEkeX

    Read the article

  • Android Nexus One - Can I save energy with color scheme?

    - by Max Gontar
    Hi! I'm wondering what color-scheme is more energy-saving for AMOLED display? I've already decided to manage c-scheme according to ambient light, thanks to this post: Somewhat-proof, the link posted by nickf: Ironic Sans: Ow My Eyes. If you read that in a well lit room, the black-on-white will be the most pleasant to read. If you read it in a dark room, the white-on-black will be nicer. But if I want to save battery power, should I use bright content with light background or vice versa? Is it possible anyway (they say it's not)? Thanks!

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >