Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
O

oobimoo

@oobimoo
About
Posts
30
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • how can i save the images,circles,rectangle,lines or etc together..
    O oobimoo

    Use GraphicsPath. Unfortunately you can't serialize a GraphicsPath oblect, but you can save the PathPoints[^] array, PathTypes[^] array and the FillMode[^], and then restore the GraphicsPath by the GraphicsPath Constructor (Point[], Byte[], FillMode)[^]. Also keep extra info for the colors of pens or brushes etc, that you use to draw or fill a GraphicsPath.

    C# graphics question

  • How to marshal string array from C# to VB?
    O oobimoo

    As far as i know, vb uses the SafeArray (UnmanagedType enumeration[^])

    C# help csharp com data-structures tutorial

  • Marshal.Copy
    O oobimoo

    You dont have problem with existing languages like c++.net or vb.net. But someone may develop a language that uses .net components, without support for unsigned integers. For such senarios stands the CLS.

    C# question

  • Marshal.Copy
    O oobimoo

    Perhaps because uint type is not CLS[^]-compliant.

    C# question

  • Binary Tree from preorder traversal
    O oobimoo

    aksgh wrote:

    Its a huffman tree.

    Yes didnt see that, you are right. So, for a huffman tree you could the following

    typedef struct _node_info {
    int is_leaf;
    char value;
    }node_info;

    typedef struct _node {
    node_info inf;
    node* l;
    node* r;
    } node;

    // returns the root of the tree, from an array of node_info's structs, that
    // represents the preorder traversal of the huffman tree. we assume a global stack s
    // initially empty
    node* built_tree(node_info* preorder_array, int preorder_array_size)
    {
    node *root, *n;
    int i;
    root = malloc(sizeof(node));
    stack_push(s, root);
    for (i = 0; i < preorder_array_size; i++) {
    assert(!stack_empty(s));
    n = stack_pop(s);
    n->inf = preorder_array[i];
    if (!n->inf.is_leaf) {
    n->r = malloc(sizeof(node));
    stack_push(s, n->r);
    n->l = malloc(sizeof(node));
    stack_push(s, n->l);
    }
    }
    assert(stack_empty(s));
    return root;
    }

    * i dont set r,l members to zero when i create a node, in order to save some space, but it is something you must do

    modified on Friday, September 19, 2008 8:09 AM

    C / C++ / MFC data-structures

  • Binary Tree from preorder traversal
    O oobimoo

    You may get the same sequence from different binary trees. So its not possible.

    C / C++ / MFC data-structures

  • brush problem in c#...
    O oobimoo

    You can use a pen instead. First adjust the width of your pen. Then set StartCap and EndCap of the pen to LineCap.Round. Finally draw lines, instead of 'points', from the previous point to the current point, in the mouse move event.

    Graphics question csharp data-structures help tutorial

  • Huffman coding Issue
    O oobimoo

    First four bytes of the header -> size of header

    C / C++ / MFC question data-structures help announcement

  • Callback with meber functions
    O oobimoo

    Member Function Pointers and the Fastest Possible C++ Delegates[^]

    C / C++ / MFC question c++ data-structures tutorial

  • How can I get the ISO-Language identifier of the current user?
    O oobimoo

    If you scroll down at the list[^] youll see the LOCALE_SISO639LANGNAME2 which is for the three letter iso, but its only for >=Vista. The xp compatible LOCALE_SISO639LANGNAME its the two letter version.

    C / C++ / MFC question csharp c++

  • My sound stops playing when the form loses focus
    O oobimoo

    Set BufferDescription's GlobalFocus property to true

    C# question help

  • Drawing a big image to real coordinates
    O oobimoo

    Use the following class

    using System;
    using System.Drawing;
    using System.Drawing.Drawing2D;

    namespace some_namespace
    {
    class Transformation
    {
    // world: the real world your bitmap represents
    // bitmap: your (unscaled) bitmap
    // screen: the portion of the screen that you display the image (a picture box maybe)

        Matrix matrix\_world;       // bitmap to world
        Matrix inv\_matrix\_world;   // world to bitmap
        Matrix matrix\_bitmap;      // screen to bitmap
        Matrix inv\_matrix\_bitmap;  // bitmap to screen
    
        Size bitmap\_size;
        Size screen\_size;
    
    
        public Transformation(PointF worldOrigin, SizeF worldSize, 
            Size bitmapSize, Size screenSize)
        {
            matrix\_world = new Matrix();
            matrix\_bitmap = new Matrix();
            bitmap\_size = bitmapSize;
            screen\_size = screenSize;
    
            // if you want the native y-points up coord system for the world, uncomment '-' and
            // '+ worldSize.Height' below
            matrix\_world.Scale(worldSize.Width / (float)bitmap\_size.Width, 
               /\* - \*/ worldSize.Height / (float)bitmap\_size.Height);                 
            matrix\_world.Translate(worldOrigin.X, 
                worldOrigin.Y /\* + worldSize.Height \*/, MatrixOrder.Append);
            inv\_matrix\_world = matrix\_world.Clone();
            inv\_matrix\_world.Invert();
            Reset();
        }
    
        // Reset transformation to the 'screen portion displays entire bitmap'
        public void Reset()
        {
            matrix\_bitmap.Reset();
            matrix\_bitmap.Scale((float)bitmap\_size.Width / (float)screen\_size.Width, 
                (float)bitmap\_size.Height / (float)screen\_size.Height);
            inv\_matrix\_bitmap = matrix\_bitmap.Clone();
            inv\_matrix\_bitmap.Invert();
        }
    
        // transform to 'screen portion displays the rectangular portion of the bitmap 
        // defined by the displayOrigin point and the displaySize'
        public void Transform(PointF displayOrigin, SizeF displaySize)
        {
            matrix\_bitmap.Reset();
            matrix\_bitmap.Scale(displaySize.Width / (float)screen\_size.Width, 
                displaySize.Height / (float)screen\_size.Height);
            matrix\_bitmap.Translate(displayOrigin.X, displayOrigin.Y, MatrixOrder.Append);
            inv\_matrix\_bitmap = matrix\_bitmap.Clone();
            inv\_matrix\_bitmap.Invert();
        }
    
    C# graphics help

  • Drawing a big image to real coordinates
    O oobimoo

    You want to fit a 25000x25000 bitmap in a 1000x1000 bitmap without losing precision? :wtf:

    C# graphics help

  • How do I draw a single color transparently?
    O oobimoo

    How to: Draw Images with Transparency[^]

    C# question

  • how to define global const class variable [modified]
    O oobimoo

    You must declare extern the g_Info in the MyInfoArrayClass.h header, under the declaration of the class (or add a forward declaration of your class above the const extern CMyInfoArrayClass g_Info;).

    C / C++ / MFC c++ help visual-studio data-structures tutorial

  • create a plane thru 3 points (c++)
    O oobimoo

    Googling 'plane equation three points' ... 1st result : Equation of a plane[^] Googling 'projection point plane' ... 3rd result : Projection of a point on a plane[^] You could do this, dont you?

    C / C++ / MFC c++ help tutorial

  • Having problem in figuring out the logic (c++)
    O oobimoo

    raesa wrote:

    If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.

    What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX)). So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms. my intuition: linear programming problem

    modified on Thursday, August 28, 2008 1:56 PM

    C / C++ / MFC help c++ algorithms data-structures question

  • How to freeze an application?
    O oobimoo

    1. With a System.Timers.Timer just use the Stop() method to stop the timer. 2. With a System.Threading.Timer, just don't use this timer (why? read documentation). Replace with a System.Timers.Timer 3. For good performance forget timers. Force rendering into app's main loop (as Greeeg mentioned)

    modified on Wednesday, August 27, 2008 8:03 AM

    C# tutorial question

  • Clear Text Into BMP
    O oobimoo

    What are you trying to do? (probably double buffering is the answer to your problem)

    C / C++ / MFC json

  • Sending a String using SendMessage
    O oobimoo

    Your are welcome From the msdn (WM_COPYDATA) : "The receiving application should consider the data read-only. The lParam parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by lParam. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer. " From the msdn (SendMessage) : "The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message. "

    modified on Monday, August 25, 2008 1:08 PM

    C# csharp c++ json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups