Jump to content

  • Log In with Google      Sign In   
  • Create Account

sjhalayka

Member Since 10 Feb 2005
Offline Last Active Today, 11:31 AM

#5300625 how rsa works on texts and signals?

Posted by sjhalayka on 13 July 2016 - 07:15 PM

If you really want to know how to encrypt large data like an audio clip, get the book called Applied Cryptography 20th Anniversary Edition.

 

In the book, it gives an example how to break up the message (the data converted to an integer) into tiny pieces (3 digits each) and encrypt the lot of them. Of course, larger pieces can be used so long as each piece is less than p*q, where p and q are large prime numbers.




#5299702 how rsa works on texts and signals?

Posted by sjhalayka on 07 July 2016 - 05:39 PM

Here's my RSA code: http://www.gamedev.net/topic/677242-rsa-message-limitation-with-c-source-code/#entry5284537

 

See vector_of_bytes_to_biginteger() and biginteger_to_vector_of_bytes() in rsa.cpp... they convert a vector of ASCII chars to a single big integer, and back.




#5277790 Translate 2D mouse position to place an object in 3D space

Posted by sjhalayka on 23 February 2016 - 03:25 PM

Read: http://mathworld.wolfram.com/Tangent.html -- look for the big triangle. Remember SOHCAHTOA.

 

tan(theta), where theta = pi/8, gives you the rise over run. When the camera is 1 unit away from the origin, the run is 1. The rise goes on to give you half of the image plane width.




#5277206 Translate 2D mouse position to place an object in 3D space

Posted by sjhalayka on 20 February 2016 - 07:43 PM

Use printf or cout or NSLog or whatever to print out the values held by fx, fy, etc., to see what's going on during the calculations. Let me know how that goes.




#5277004 Translate 2D mouse position to place an object in 3D space

Posted by sjhalayka on 19 February 2016 - 11:56 AM

Thank you guys for your help!

 

I found the code on Stack Overflow a few months ago. If you like the code, then upvote me.




#5277003 Translate 2D mouse position to place an object in 3D space

Posted by sjhalayka on 19 February 2016 - 11:55 AM

Fun little snippet.

 

Many people try to turn a mouse's 2D position into a single location in a 3D world, forgetting that the projection results in a ray or a volume (the front of the volume is the area of a pixel).

 

Yeah, I use the concept of an image plane in my description of the code. Whether or not the code works for a raytracer is undecided as of yet. smile.png




#5276952 Translate 2D mouse position to place an object in 3D space

Posted by sjhalayka on 19 February 2016 - 09:14 AM

This code converts an x,y position into a 3D position (last_click_float_x, last_click_float_y). The eye position that I used is 0,0,1 and the image plane is at z = 0:

    void touch_up_pos(int x, int y)
    {
        const float pi = 4.0f*atanf(1.0f);
        const float aspect = (float)(m_renderbufferWidth) / (float)(m_renderbufferHeight);
            
        const float fx = 2.0f * ((float)(x) / (float)(m_renderbufferWidth - 1)) - 1.0f;
        const float fy = 2.0f * ((float)(y) / (float)(m_renderbufferHeight - 1)) - 1.0f;
        const float y_fov = pi/4; // pi/4 radians = 45 degrees
        const float tangent = tan(y_fov / 2.0f);
        last_click_float_x = aspect * tangent* fx;
        last_click_float_y = -tangent * fy;
        last_click_float_z = 0;
        
        // NSLog(@"touch up pos %f %f", last_click_float_x, last_click_float_y);
    }



#5272620 Which quaternion fractals are your favourite?

Posted by sjhalayka on 25 January 2016 - 03:30 PM

Some quaternion fractals that I've discovered/made...

 

https://www.shapeways.com/designer/shawn_halayka

 

There is a call for Saskatchewan artists to design 10 art awards, and I'm thinking of submitting the fractals as potential awards.

 

Which ones do you like best? I've printed a few out in plastic, and my favourite is 'Flower'.




#5271076 Developing an Ocean Shader for Unreal Engine 4

Posted by sjhalayka on 14 January 2016 - 11:33 AM

That's awesome.




#5267650 S-hull

Posted by sjhalayka on 23 December 2015 - 08:44 AM

Networks are sometimes modeled by graph theory. One of the next steps is to put in a hopping entity that travels through the network (graph).

 

About those last 4 images:

 

Since the pointing outward value for all 4 solutions doesn't ever get to 0.5 and beyond (red lines don't ever become as prevalent as blue lines), the black hole's exterior network produces attraction via spatial curvature.

 

The average dot product value shows that the blue and red lines are almost always pointing nearly orthogonal to the corresponding outward pointing normals (not shown)... like there are layers of rotation.

 

The red lines along the black hole surface should actually be pointing inward when the black hole interior is modelled by a complete network (not shown). Ignore those red lines, they should be blue.




#5263837 Create a polygon from a texture (2d)

Posted by sjhalayka on 27 November 2015 - 09:40 AM

One way to do this is to use Marching Squares to convert a grayscale image into triangles.

 

http://www.gamedev.net/topic/624733-converting-a-bitmap-image-to-a-meshed-approximation/




#5262484 Works on AMD GPU in Windows, doesn't work on Intel GPU in Mac OS X

Posted by sjhalayka on 17 November 2015 - 04:38 PM

The problem was solved by adding GLUT_DEPTH to the glutInitDIsplayMode call. Thank you everyone for helping out! I should have figured that out sooner. 

 

With detailed mesh:

Attached Thumbnails

  • Screen Shot 2015-11-17 at 6.57.00 PM.png



#5262468 Works on AMD GPU in Windows, doesn't work on Intel GPU in Mac OS X

Posted by sjhalayka on 17 November 2015 - 03:23 PM

It also seems to me like a depth test precision issue, what can be aid by projection matrix. But back to original issue of not running on ios.

 

You might check theese things that are prone to errors between less flexible operation systems:

 

- back buffer and off screen render targets formats, as well resolutions

- ios, I have never coded for, can demand some sort of " frame draw enclosing", since ogl misses explicit presentation call, it can be some begin/end pair of entire gpu calls

 

cannot think of some other things to check.

 

Thanks for the ideas. I tried changing the near and far plane distances, but to no effect. I also switched to using glutSwapBuffers(), to no effect.

 

I also tried glFrontFace(GL_CCW) on the Mac to no effect -- will try it on the Windows machine later tonight.




#5262310 Works on AMD GPU in Windows, doesn't work on Intel GPU in Mac OS X

Posted by sjhalayka on 16 November 2015 - 02:38 PM

Thank you: I changed the header to OpenGL/gl3.h and removed the APPLE suffix from the two function calls and it works. I also changed the vertex and fragment shaders to #version 330, not sure if that makes a difference.

 

However, I have a new problem with the rendering not working properly. If you use the left mouse button to rotate the camera, things get wonky when the backside of the model is shown. Any ideas?




#5260942 Camera not working as expected

Posted by sjhalayka on 07 November 2015 - 04:23 PM

The problem existed in my matrix_utils.cpp file, I changed it to the following code and it works now:

 

void get_look_at_matrix(float eyex, float eyey, float eyez, float centrex, float centrey, float centrez, float upx, float upy, float upz, float (&mat)[16])
{
    // https://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml
    // http://www.cs.virginia.edu/~gfx/Courses/1999/intro.fall99.html/lookat.html
    vertex_3 f, up, s, u;
    
    f.x = centrex - eyex;
    f.y = centrey - eyey;
    f.z = centrez - eyez;
    f.normalize();
    
    up.x = upx;
    up.y = upy;
    up.z = upz;
    up.normalize();
    
    s = f.cross(up);
    s.normalize();
    
    u = s.cross(f);
    u.normalize();
    
    mat[0] = s.x;  mat[4] = s.y;  mat[8] = s.z;   mat[12] = 0;
    mat[1] = u.x;  mat[5] = u.y;  mat[9] = u.z;   mat[13] = 0;
    mat[2] = -f.x; mat[6] = -f.y; mat[10] = -f.z; mat[14] = 0;
    mat[3] = 0;    mat[7] = 0;    mat[11] = 0;    mat[15] = 1;


    float translate[16];

    translate[0] = 1; translate[4] = 0; translate[8] = 0;  translate[12] = -eyex;
    translate[1] = 0; translate[5] = 1; translate[9] = 0;  translate[13] = -eyey;
    translate[2] = 0; translate[6] = 0; translate[10] = 1; translate[14] = -eyez;
    translate[3] = 0; translate[7] = 0; translate[11] = 0; translate[15] = 1;

    float temp[16];

    multiply_4x4_matrices(mat, translate, temp);

    for(size_t i = 0; i < 16; i++)
        mat[i] = temp[i];
}
 





PARTNERS