• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Tamschi;45779338]Yes, really. It's easily readable, avoids obsessing about perfect alignment, and puts a lot more characters on the screen horizontally than a monospace one. It also feels a bit like writing a novel :v: [editline]23rd August 2014[/editline] You should see my MonoDevelop config, with [I]beautiful italic comments[/I]. (I think that's the default there though, I just changed the font and text size.)[/QUOTE] Why is your screen so small though? 1920x1080 screens are really cheap these days, you should look at getting one or two.
I would assume it's a laptop.
[QUOTE=BackwardSpy;45780756]I would assume it's a laptop.[/QUOTE] I never thought about that. I also just remembered by friend bought a new computer which is really awesome but he has a 4:3 screen :v:
Anyone know of a good plugin for sublime text 3 for auto-formatting/indenting Ruby? Found one! [URL="https://github.com/CraigWilliams/BeautifyRuby"]BeautifyRuby[/URL] is pretty slick.
[QUOTE=Two-Bit;45747988]I just don't know where to begin, how to build the skeleton of the game so to speak, how to have a rough game then be able to add the features and all that in.[/QUOTE] If you know java, look up JFrame. JFrame is a library that allows you to use graphical elements, starting with the actual "Frame", or window (hence, JFrame) If you learn to initialize a JFrame window, you can learn a little bit more about graphics buffers and stuff and then start adding things into your Window, and then being able to move them around in the window. For basic input, for example, look at the following: Lets say you've got a box. It has an X value and a Y value, determining it's X and Y location on the screen. If you want it to move to the right when you press the right arrow key, you could put: [code] public class Player { int x = 200; /*starting position*/ int y = 200; public void act() { setLocation(x,y); /*put the player at the value of x and y. By default, the player is at 200,200. */ if(key_pressed()=="KEY_RIGHT") { x++; /*if the right key is pressed, then add 1 to the x value, moving the player one pixel to the right when setLocation(x,y) is recalled called earlier on in the act() method */ } } } [/code] The code will not be exact, since I don't know the methods for Java to detect key input, but you get the idea
Hi, I need to rotate a hyperellipsoid so that its main axis intersects two focal points (or rather calculate a rotation matrix to this transformation) and wikipedia is quite useless. Would anybody happen to know some resources? EDIT: To clarify. I have a unit hypersphere parameterized by 6 angles and the distance from center, and I need to calculate a transformation matrix so that the hypersphere's parameterization corresponds to said hyperellipsoid. Distorting isn't much of an issue, but I'm not really sure how to calculate the rotation matrix.
[QUOTE=G4MB!T;45780733]Why is your screen so small though? 1920x1080 screens are really cheap these days, you should look at getting one or two.[/QUOTE] It's actually 1920x1200, I'd be annoyed about a 16:9 monitor. I just cropped all the toolbars and other windows on all four sides. [editline]24th August 2014[/editline] [QUOTE=Phantoml994;45784041]Hi, I need to rotate a hyperellipsoid so that its main axis intersects two focal points (or rather calculate a rotation matrix to this transformation) and wikipedia is quite useless. Would anybody happen to know some resources? EDIT: To clarify. I have a unit hypersphere parameterized by 6 angles and the distance from center, and I need to calculate a transformation matrix so that the hypersphere's parameterization corresponds to said hyperellipsoid. Distorting isn't much of an issue, but I'm not really sure how to calculate the rotation matrix.[/QUOTE] I assume these are Euler angles, so you'd use 6 6x6 rotation matrices and concatenate them by multiplication. If I'm not mistaken the axis-aligned rotations should affect only two dimensions in local space, so you would construct it like in 2D and then fill the rest with the identity transformation for the other dimensions. [editline]24th August 2014[/editline] In the usual 3D case, the matrices are basically xy, xz, zy and r (for the distortion), and you'd multiply them xy * xz * zy * r to apply them in order from right to left. The xy matrix [code]a b c d[/code] is extended to [code]a b 0 c d 0 0 0 1[/code] by filling in the z dimension, the xz matrix [code]a b c d[/code] is extended with y to [code]a 0 b 0 1 0 c 0 d[/code] and so on. In your case you just have to insert more of those identity axes. [editline]24th August 2014[/editline] You can probably calculate/generate the general case once and make the algorithm a bit faster for your specific application, since there are so many 0s and 1s.
[QUOTE=Tamschi;45784638] I assume these are Euler angles, so you'd use 6 6x6 rotation matrices... [/QUOTE] I see, thank you very much. I'll definitely calculate this only once, since the said points are stationary throughout the computations. Just to be sure, suppose I have a unit vector "pointing" to [1,0,0,0,0,0] and I'd like to rotate it so that it would point to [1,1,1,90,90,90] (while preserving the length). Would you happen to know how the resulting matrix would look like? EDIT: In case somebody needs this, I achieved what I needed by using the Singular Value Decomposition and other magic from the Eigen library for C++ to actually get the final transformation matrix.
I'm confused about what is meant when it is said that a language is "strongly typed". For example, in this course that I am watching, it is said that "because C is a strongly typed language, a pointer will increment by the size of whatever it's pointing to when the increment operator is used." I understand what is going on, but I am confused as to what being "strongly typed" is.
[QUOTE=Phantoml994;45785044]I see, thank you very much. I'll definitely calculate this only once, since the said points are stationary throughout the computations. Just to be sure, suppose I have a unit vector "pointing" to [1,0,0,0,0,0] and I'd like to rotate it so that it would point to [1,1,1,90,90,90] (while preserving the length). Would you happen to know how the resulting matrix would look like?[/QUOTE] Whoops, seems like I misread your question a bit. You actually have a different amount of dimensions, right? The main strategy should still apply though. If I'm not mistaken you can consistently define turning directions from the cross product of the two dimensions you turn through even at higher orders, making sure you always look in the same way at the axis. I can't really help you with any exact formula since you need to have application order and turning directions to fully qualify Euler angles. (Even in 3D orientations with just 2 or 3 angles there exist incompatible standards.) [editline]24th August 2014[/editline] [QUOTE=Duskling;45785520]I'm confused about what is meant when it is said that a language is "strongly typed". For example, in this course that I am watching, it is said that "because C is a strongly typed language, a pointer will increment by the size of whatever it's pointing to when the increment operator is used." I understand what is going on, but I am confused as to what being "strongly typed" is.[/QUOTE] It usually means that the size/format/methods of any value are always* known, even at compile time. Through this the compiler can do a lot more error checking and optimisation than with a weakly typed language, in this case embedding instances of the same type sequentially in memory without padding** or additional pointers. * Typing strength is actually a gradient. Some languages that are weakly typed can still be compiled to a mostly strongly typed representation (e.g. when JITing JavaScript in a modern browser) and strongly typed languages can contain weakly typed features (e.g. unsafe (void*) casts in C++)). ** This isn't always completely true, some things are aligned for faster access for example. I'm not sure how much C++ does this by default though. It's afaik usually not done in arrays, for the most part.
[QUOTE=Tamschi;45785705]It usually means that the size/format/methods of any value are always* known, even at compile time. Through this the compiler can do a lot more error checking and optimisation than with a weakly typed language, in this case embedding instances of the same type sequentially in memory without padding** or additional pointers. * Typing strength is actually a gradient. Some languages that are weakly typed can still be compiled to a mostly strongly typed representation (e.g. when JITing JavaScript in a modern browser) and strongly typed languages can contain weakly typed features (e.g. unsafe (void*) casts in C++)). ** This isn't always completely true, some things are aligned for faster access for example. I'm not sure how much C++ does this by default though. It's afaik usually not done in arrays, for the most part.[/QUOTE] You're mixing up strong and static typing here. [editline]24th August 2014[/editline] And to answer the original question: there is no single agreed upon definition. However, the basic idea is that in a "strongly typed" language like Java you need to use some kind of "toString" method, but in a "weakly typed" language like JavaScript you don't and it's implicitly converted. [editline]24th August 2014[/editline] To further confuse matters, C is usually considered a weakly typed language. On other hand, C++ is generally considered strongly typed because it requires explicit casts in many cases where C may allow an implicit cast. For example, in both C and C++ you can implicitly convert any pointer into a void*. In C you can also implicitly convert [I]from[/I] a void*. In C++ you need an explicit cast (static_cast is recommended in this case).
Another java question: I'm making a program that is supposed to calculate the probability whether a family with 2 children would have 2 boys, 1 boy and 1 girl, or 2 girls. So far I have this: [code] import java.util.Scanner; import java.io.File; import java.io.IOException; public class Family { public static void main(String[] args) throws IOException { String token = ""; File fileName = new File("MaleFemaleInFamily.txt"); Scanner inFile = new Scanner(fileName); while (inFile.hasNext()) { token = inFile.next( ); System.out.println (token); } inFile.close(); }//end of main method }//end of class [/code] In the .txt file is a LOT of combinations like GG or BG or GB or BB, etc. Basically, I want to program to be able to read the .txt file and come out with the % of BG/GB, GG, and BB in the file. How would I do something like that? I would like the output of the program to be like this: [code] Sample size: Two Boys: One Boy One Girl: Two Girls: [/code] Thanks
Have a counter for each possibility and a counter for the total. In the while loop increment the counters depending on what the token is (use the equals method for Strings). The percent of each one is 100.0*counter/total. Note that 100.0 is a double, this will coerce the counters to doubles as well so there is no integer division. Everything else you have looks fine (though you don't have to initialize token to "").
What is the "best" way to name C++ variables? ex: foo_name fooName FooName fooname What will cause me the least trouble?
[QUOTE=rilez;45788333]What will cause me the least trouble?[/QUOTE] Consistency. One convention is as good as the other, as long as you stick to it.
I'm back again. So I updated my code with counters (as Fredo described) and it seems to somewhat work. [code] import java.util.Scanner; import java.io.File; import java.io.IOException; public class Family { public static void main(String[] args) throws IOException { String token = ""; int total = 0; int bb = 0; int gg = 0; int bg = 0; File fileName = new File("test1.txt"); Scanner inFile = new Scanner(fileName); while (inFile.hasNext()) { token = inFile.next(); //System.out.println (token); total++; if(token == "BB") { bb++; } else if(token == "GG") { gg++; } else if(token == "BG" || token == "GB") { bg++; } } inFile.close(); System.out.println("Sample Size: " + total); System.out.println("Two Boys: " + bb); System.out.println("One Boy One Girl: " + bg); System.out.println("Two Girls: " + gg); }//end of main method }//end of class [/code] The only problem is that for some reason the code does not stop to check the conditions of the if and the if else statements. My output only shows the Total Sample Size of the .txt file instead of calculating and adding to the counters. [IMG]http://puu.sh/b6qz6/a8b98191ea.png[/IMG] Anyone have any ideas why it's doing this?
The lighting of my object (Unity) is inverted. I've also noticed when I remove the normal map, the lighting issue goes away. I've even tried flipping the matrix of the normal, but that didn't seem to work (at least how I tried). I also changed lighting to real time, didn't work, neither did baked. The normal map is procedural. With a further investigation I found out it could be because the map has an alpha channel, but I haven't found a way to remove the alpha channel from a texture (C#). Hopefully somebody has an idea to my problem, or how to get rid of the alpha channel in C# (if it's even possible) if that's the problem. [img]http://i.imgur.com/EquPXku.jpg[/img]
Easy way to test if the alpha channel is the culprit -> save as jpg, apply as your material. If the problem persists, it's not the alpha channel :p
[QUOTE=joshuadim;45788575] Anyone have any ideas why it's doing this?[/QUOTE] use .equals() instead of == as in token.equals( "BB" )
[QUOTE=No_0ne;45789414]use .equals() instead of == as in token.equals( "BB" )[/QUOTE] Thanks man c:
[QUOTE=Arxae;45789302]Easy way to test if the alpha channel is the culprit -> save as jpg, apply as your material. If the problem persists, it's not the alpha channel :p[/QUOTE] A good idea, but I don't think I can save it. It's generating as a Texture2D then applying via the script. At least, I can't find a way to save it.
[QUOTE=James0roll;45789562]A good idea, but I don't think I can save it. It's generating as a Texture2D then applying via the script. At least, I can't find a way to save it.[/QUOTE] You could use this [url]http://docs.unity3d.com/ScriptReference/Texture2D.EncodeToPNG.html[/url] and then drop the bytes into a file and drag that into Unity.
In the midst of applying the texture, it asked something like, "Do you want to convert that to a normal?" So apparently I didn't really have it setup as a normal. Now if I could figure out how to do that with the code. Unity doesn't love me, so I can foresee it being difficult. Any ideas?
[QUOTE=ECrownofFire;45786252]You're mixing up strong and static typing here. [...][/QUOTE] And I've done it before :suicide: I'll try to remember this time around.
I've spent hours, trying to figure out how to edit Texture2D's "import settings." Basically, what Unity lets you modify when you create a bump map. I downloaded the texture, loaded it into Unity as a normal map, and now if I can figure out how to do that with some code. I've tried TextureImporter, TextureImporterSettings, among other things, but it never works. The image is what it should look like, but I have to download the texture, put it into the assets, and edit the import settings (which I can't figure out how to do via code), so doing all of that is out of the question for procedural generated textures. For the love of baby Jesus, please help me. [thumb]http://i.imgur.com/ZEbe3sv.jpg[/thumb]
What material shader are you using?
[QUOTE=Arxae;45792257]What material shader are you using?[/QUOTE] Custom, but I don't think that matters. I just need to figure out how to set my Texture2D I am creating to a normal map.
Hey guys. For those of you that have completed Computer Science courses or programming-related courses, just how much focus is there on maths? How advanced is the mathematics you use in programming?
Not completed but I'm in the process of doing one. There is some maths, at least in my degree, but if you can program, you can probably get through the math. I think in general there should be more practical things like logic and set operations.
Can anyone vouch for RIT as a Computer Science school?
Sorry, you need to Log In to post a reply to this thread.