# kubapl

Member

91

127 Neutral

• Rank
Member
1. ## Math Circle Help

I was under the impression that they were degrees. If I just initialize the angleStepSize to this double angleStepSize = Math.Acos( ( double ) ( texBrick.Width ) / ( double ) radius ); my number is 1.4580576603128359. Also if I just make the angle equal to the step size like this angle = 2 * Math.PI / Math.Floor( 2 * Math.PI / angleStepSize ); the app just hangs and then crashes with an error saying "An unhandled exeption of type "System.OutOfMemoryException" occurred in mscorlib.dll"
2. ## Math Circle Help

If you do this, re-assign angleStepSize to 2 * PI / floor(2 * PI / angleStepSize). Essential you are finding the most bricks you can fit (an integer) given their size, then dividing the arc evenly among them. [/quote] So I've tinkered with the numbers and did angle += ( 2 * Math.PI / Math.Floor( 2 * Math.PI / angleStepSize ) ); as you suggested but it appears as I lost all the width plus the distance in between the blocks by making this change If you look at the bottom left of the screen thats how big the block is its Width : 18 x Height 9 [attachment=1449:overlap.png]
3. ## Math Circle Help

I am trying to arrange bricks in a circular manner. I pretty much am taking the width of the brick image and dividing that by the hypo which is the radius of the circle and inverse cosining it. This give me the angle step that I need to use to figure out the x and y positions of the brick. I find that I still have some over lap in 1 spot. Heres a screenshot: [attachment=1447:overlap.png] I set the bricks alpha so you can better see the over lap Heres the code that I do the calculations: private void DrawCircle( int radius ) { float x = 0.0f; float y = 0.0f; double angle = 0.0f; double angleStepSize = Math.Acos( (double)( texBrick.Width ) / (double)radius ) * ( Math.PI / 180 ); while( angle < 2 * Math.PI ) { x = ( float ) ( radius * Math.Cos( angle ) ); y = ( float ) ( radius * Math.Sin( angle ) ); spriteBatch.Draw( texBrick, new Vector2( x + graphics.GraphicsDevice.Viewport.Width / 2, y + graphics.GraphicsDevice.Viewport.Height / 2 ), new Rectangle( 0, 0, texBrick.Width, texBrick.Height ), new Color( 0.1f, 0.1f, 0.1f, 0.1f ), ( float ) ( (float)angle + 90.0f * ( Math.PI / 180.0f ) ), new Vector2( texBrick.Width * 0.5f, texBrick.Height * 0.5f ), 1.0f, SpriteEffects.None, 1.0f ); angle += angleStepSize * ( 3 * Math.PI ); } } The final line I do angle += angleStepSize * (3 * Math.PI ) I'm not sure why I added the 3 * Math.PI ... in my mind the angleStepSize should be enough.
4. ## SharpSteer

Hey, has anyone ported this AI library to the new XNA 4.0? http://sharpsteer.codeplex.com/ If not are there any good AI libs that someone can recommend? Thanks
5. ## Dangling Pointers

The detector I am using is the std one I'm guessing..? I came across it on the msdn site. #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
6. ## Dangling Pointers

Yes I do use smart pointers but I have an interview coming up and thought it would be a good idea to brush up on doing things manually.
7. ## Dangling Pointers

Hey guys, Quick question about pointers in c++. Recently I was reviewing pointers in C++ and I stumbled on this website <http://www.codeguru.com/forum/showthread.php?t=312742> and the post has a example of a lost pointer: class Sample { int* val; public: Sample() { val = new int; *val = 44; } ~Sample() { delete val; } }; void foo() { Sample* a = new Sample; Sample* b = new Sample; a = b; delete a; //actually deletes b //delete b; //already deleted } I'm just wondering whats the best way to deal with this situation and how would you go about deleting a? Thanks
8. ## Calculus Help!

[font=verdana, arial, helvetica, sans-serif][size=2]Yeah we haven't covered L'Hopital's rule yet. I did attempt to simplify and cancel out both of these without any luck. My answers don't match with whats in the back of the textbook.[/font]
9. ## Calculus Help!

Hello, I'm taking a university level calculus course this semester. I haven't done math since collage 3 years ago. Anyways we are currently solving limit problems and I'm able to figure out a bunch in my homework but I'm stuck on these. 1) lim 1/x - 1/2 / x-2 x->2 2) lim (4+h)^3 -64 / h h->0 I guess my big thing is I'm not sure what to do in situations when I have fractions or when dividing with just 1 variable. Any help would be great!
10. ## GLSL Bytecode

EngineCode: I've compiled the shader as per your instructions and I get this error: vertexshader.glsl (0) : error C5052: gl_Vertex is not accessable in this profile (0) : error C5052: gl_MultiTexCoord0 is not accessable in this profile (0) : error C5052: gl_Position is not accessable in this profile this is my GLSL code varying vec2 vTexCoord; void main(void) { vTexCoord = gl_MultiTexCoord0.xy; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }
11. ## GLSL Bytecode

EngineCoder do you have an example.
12. ## GLSL Bytecode

Does CG toolkit have a GUI or is it just code that I add into my VS directory. Do you have a download?
13. ## GLSL Bytecode

Okay so maybe I wasn't to clear. I'm working on a project that does not support any high level shader languages. So what I am trying to do is write a GLSL shader and then have that translated to the equivalent ARB Assembly or Bytecode. Thanks
14. ## GLSL Bytecode

Right .. so what I want to do is write a GLSL shader and see the bytecode output.
15. ## GLSL Bytecode

Hey guys, I'm looking to write some GLSL but need to output into bytecode is this possible? thanks