# greggles

Member

125

347 Neutral

• Rank
Member
1. ## Bezier Triangles

The first thing to understand is that B (a bernstein polynomial) determines how much each point contributes to the final p(u, v) point. The value it returns is between 0 and 1, with 0 meaning that the point won't affect the final output and 1 meaning that it completely determines the output.   The "simplified" equation you give is just that... a simplified version of B when n = 3. You can do the math yourself if you want to take the time. Just take the equation for B, make n always 3, and compute the result for every valid i, j, k combination. Then with a bit of algebraic manipulation you could get the same equation. But the way this equation is written is only true for n=3. Breaking down the case of seven control points into a single equation is going to be too unwieldy. Instead, I would suggest trying to understand how to use: which works for any n, before trying to simplify it.   Let's look at how this will be used:   Let's say that we have a triangle patch with n = 5 and are trying to determine how much point p301 will contribute to the output point at (u,v). We would use the "big B" to determine this. B of 3,1,1 at u,v. The equation would be:   ( 5! / (3! * 1! * 1!) )   * (ui) * (vj) * (1 - u - v)k = (5*4 *3*2*1) / (3 * 2 * 1 * 1 * 1)  * u3 * v * (1 - u -v) = 20*(u3) * v * (1 - u - v)   This means that when u = 0.1 and v = 0.5), the point p301 would contribute to the point: 20*(0.001) *0.1 * 1 * (1 - 0.1 - 0.5) = 20*(0.0001)*(0.4) = 0.0008   Then back in the for-loop I had talked about before, p(3, 0, 1) would be multiplied by 0.0008 and added to the output point.   Note that B can be created as a function in code somewhat easily once you have a factorial function (something that can also be created easily) and a power function (should be available in your favorite programming language's standard library). All that it needs to do is take in multiple parameters (n, u, v, i, j, and k) and output a double value.   ...well, that was a long explanation. I probably got something in there wrong :) Let me know if something needs to be clarified.
2. ## Bezier Triangles

First of all, the bold vs. not bold: Anything bold is a point, anything not bold is a number. So when you see p(u, v), it means the Point at the barycentric coordinates u, v.   Secondly, the sigma notation used in the article means "sum together all of the values where this equation is true." So, for example, the equation i+j+k=n could be true when 1+0+6=7 or when 0+3+4=7, and so on.    Let's look at the first equation you have posted:   When determining how to create the loops, I found the picture of the triangle very helpful. Lets assume that each digit in the point corresponds to the variables i, j, and k in order. Thus, the lower left point of the triangle p003 means i=0, j=0, and k=3.    The first thing that I notice is that i increases from 0 to 3 from bottom to top of the image. This is a basic for loop that we can easily handle.   Next, I notice that for any i, the j value starts at 0 on the left and increases until i+j=n on the right. This is another loop we can handle.   Finally, the original equation gives us k via algebra: i+j+k=n can be rearranged to k = n - (i+j). That is the final value we need to know.   This gives us our final form: Point p; for (int i = 0; i <= n; ++i) { for (int j = 0; i+j <= n; ++j) { int k = n - (i + j); p += B(i, j, k, u, v, n) * p(i, j, k); //Probably not quite what you want here, but this is an example of what this might look like. } }   Now, the B() function refers to the function on the Gamasutra page and the p function here means "give me the point with i, j, k index." For example, p(0, 6, 1) means p061.    Does this help? The partial derivatives would then be created in a very similar way.

4. ## Problem computing GJK support points

[quote name='BobXIV' timestamp='1352385937' post='4998874'] [quote name='greggles' timestamp='1352084345' post='4997410'] Maybe I'm missing something, but what is wrong with (0, 20)? Although it is not one of the vertices, it [i]is[/i] on the bounds of the minkowski difference. My understanding of the GJK algorithm is that it should still work correctly. [/quote] Greggles maybe I'm misunderstanding you, what you say is correct but the vertex (0,20) or any support point is indeed one of the vertices... if you mean the vertices of the Minkowski difference. [/quote] I think you may have misunderstood me. Let me clarify the calculations: The original shapes are define by vertices (-5, 5), (5, 5), (5, 15), (-5, 15) and (-5, -5), (5, -5), (5, 5), (-5, 5) We know (intuitively, but this can be determined algorithmically with more calculation) that the resultant diffence will be a square, so finding the four vertices of the difference: (-5, 5) - (5, 5) = (-10, 0) (5, 5) - (-5, 5) = (10, 0) (5, 15) - (-5, -5) = (10, 20) (-5, 15) - (5, -5) = (-10, 20) So there is an edge from (10, 20) to (-10, 20). (0, 20) lies in the middle of this edge instead of one of its endpoints; thus it is not a vertex.
5. ## Problem computing GJK support points

Maybe I'm missing something, but what is wrong with (0, 20)? Although it is not one of the vertices, it [i]is[/i] on the bounds of the minkowski difference. My understanding of the GJK algorithm is that it should still work correctly.
6. ## IDE most comparable to VS

[quote name='MattProductions' timestamp='1349715613' post='4988038'] Thanks guys, but now another question. What is the difference between Java SE/FX/EE/ME/... I have to choose a version of Netbeans to download What's the best one for game development? [/quote] SE = Standard Edition ([url="http://en.wikipedia.org/wiki/Java_Platform,_Standard_Edition"]http://en.wikipedia.org/wiki/Java_Platform,_Standard_Edition[/url]) FX = Java FX ([url="http://en.wikipedia.org/wiki/JavaFX"]http://en.wikipedia.org/wiki/JavaFX[/url]) EE = Enterprise Edition ([url="http://en.wikipedia.org/wiki/Java_EE"]http://en.wikipedia.org/wiki/Java_EE[/url]) ME = Micro Edition ([url="http://en.wikipedia.org/wiki/Java_ME"]http://en.wikipedia.org/wiki/Java_ME[/url]) I suggest the standard edition.
7. ## Help me name my game!

Looks good. I really liked the education level of the janitor: Sweeping 101, Advanced Sweeping, and Sweeping with a Passion. The first name I thought of when I saw the game is Big Huge Evil Company Inc. Another idea is to play off of telephone/telemarket, like using Telemagnate, Telemogul, or Telemarketeer. Or maybe stick with a basic name like Com Command or Call Center Command.
8. ## Java .GIF to Image Array

It's been a while since I used it, but I believe the javax.imageio package should have what you need. There is a function in the class ImageIO called [url="http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#getImageReadersByFormatName(java.lang.String)"]getImageReadersByFormatName[/url] that returns an Iterator of [url="http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageReader.html"]ImageReader[/url]s. The ImageReader class appears to contain some functions that allow you to read multiple Images from a file.
9. ## Seattle Area

[quote name='way2lazy2care' timestamp='1335683599' post='4935773'] Get fish thrown at/over you and go to the glass museum in Tacoma and watch them blow glass. Those were my two favorite things when I lived there. At least things that are very seattle-y. [/quote] I think it is awesome that a well known attriction in a town could be seeing people throw fish [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]. [quote name='blueEbola' timestamp='1335749098' post='4935958'] I've lived in the PNW all of my life and just recently moved up to Seattle to start a new web developer position up here.. and it rocks! [/quote] First of all, congrats on the new position! [quote name='blueEbola' timestamp='1335749098' post='4935958'] Seattle is split up into several districts (sometimes called neighborhoods): Fremont, Ballard, Magnolia, Queen Anne, U-distict, Belltown, West Seattle, Green lake.. and the list goes on. Each district kind of has its own vibe. I live in northern Magnolia just south of Ballard, and it's got some amazing views and a "residential" kind of feel. Works for me because I came from kind of a country town and living on a busy street in downtown Seattle probably would've been a bit too hectic for me. Ballard is the condo part of town, there's tons of development going on up there and lots of young professionals living in that area. [/quote] I'll be working in the South Lake Union district (at Amazon.com), but I've heard it's not the best area in which to live. I don't think I'd mind a busy street, but I'm probably looking for an area that is (relatively) close to work and has a decent number of young professionals. From the sounds of it, Magnolia sounds like a good place to include in my search. [quote name='blueEbola' timestamp='1335749098' post='4935958'] There are several music venues and big acts roll through all the time. I've gone to 4 concerts in the past month so far [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [/quote] I've heard good things about the music scene, which is exciting. As for sports in the area, how difficult is it to get tickets? Having lived near Pittsburgh, PA for several years, it has always been hard for me to get good, cheap tickets for football and hockey games, but baseball is pretty easy + the Pirates have a beautiful stadium.
10. ## Seattle Area

After much work, college is finally coming to a close: in just a few weeks I will be graduating! I am looking forward to starting a job in the Seattle, WA area this July, and I, as someone who grew up on the East coast and doesn't know much about Seattle, was wondering if anyone from the area would be willing to share their wisdom. I would like to get suggestions on things like: good areas to live, fun hangouts, interesting places to visit, gamedev groups, game jams, etc.
11. ## aggregate initialization list in class definition

Static variables must be initialized outside of the class definition, like this: [code]#include <iostream> using namespace std; class A { public: static const int i[]; }; const int A::i[] = {1, 2, 3, 4}; int main() { cout << A::i[0] << endl; return 0; }[/code]
12. ## [C++]problem with getline

The extraction (>>) operator will not read in the \n after date. So when getline is called, it reads in an empty string. An example (with endlines shown as \n instead of whitespace): John \n 300 \n 3/3/2011 \n Ed \n 300 \n 3/4/2011 \n Your code will read in the first set of data correctly, but this is what the file looks like after it is done: \n Ed \n 300 \n 3/4/2011 \n So the next name will be "", the next score will be "Ed", and the next date will be "300". Obviously this isn't correct and will cause an error.