Search


15 Responses to Search

  1. kader says:

    How can I modify a vertex position in MeshGeometry at Run-time ?
    Is there a way to add interactively a triangle to Mesh?
    Another question concern: is there a way to modify a model lighting WPF from Phong Shading to Gouraud Shanding since WPF implement only Phong .I think that a class Material need to be overriden .How to override this class ?
    Thanks in advance !!!

    • RodStephens says:

      I haven’t worked on this stuff lately, so I’m not completely sure of these answers.

      • How can I modify a vertex position in MeshGeometry at Run-time?

      If the program keeps a reference to the mesh in a global variable, I think you can just modify it and the program will update the picture. For example, this post shows how to change a model’s material at run time.

      Let the user select and deselect 3D objects using WPF and C

      • Is there a way to add interactively a triangle to Mesh?

      That should work, too. If you keep a reference to the mesh in a global variable, you should be able to add triangles to it at run time. (Of course you’ll have to write the code to do it. There’s no interactive tool to do it in Visual Studio.)

      WPF is pretty easy going about these sorts of changes. You build an object model and it displays the model. If you make changes, it updates the display.

      • Another question concern: is there a way to modify a model lighting WPF from Phong Shading to Gouraud Shanding since WPF implement only Phong .I think that a class Material need to be overriden .How to override this class ?

      Isn’t it the other way around? I think WPF uses Gouraud shading, but Phong shading works better if you have specular highlights in a large polygon.

      I’m not sure about this one. You might look at geometry shaders, but I’m not sure they’re supported by WPF 3D. You would think this would be an option provided by the Direct3D library or even the hardware.

      For now I just use more polygons. Not an ideal solution but simple.

  2. Nitin Kumar Tygai says:

    Hi Stephan,

    I was Referring your Book “C# 5.0 Programmer’s Reference” from last 1 Months.So, the Content and the Examples are good enough to make me understand the deep knowledge in C# Programming.
    As, From Lat 2 to 3 weeks i am facing some Issues in Solving the exercise content. As not able to check whether my solution is right or wrong. So i Just Need to know is there is any solution book available for the exercises part???

    Please, Do reply ASAP as i can’t stop myself to go forward without clearing exorcises. 🙂

    Thanks,
    Nitin Tyagi

  3. eric says:

    Hi Mister stephens first of all i would like to say thak’s for your book Essentiel Algorithm . I would like to ask you if you can help me i want to solve the towers of hanoi problem iteratively but it’s too difficult.

    • RodStephens says:

      I’m glad you’re finding the book interesting. Post a review when you have a chance.

      This is a naturally recursive problem so a recursive solution will be easier to understand, debug, and maintain. If you just want to remove the recursion to avoid deep levels of recursion and using up stack space, you could add a Stack to the program and simulate the recursion yourself.

      But if you really want a purely iterative solution, see this GeeksforGeeks post:

      Iterative Tower of Hanoi

  4. Bardia says:

    I try to use stack class for paint bucket function ,but when running and clicking on selected area in picture box to be filled with selected color,nothing happens and cpu usage goes up to %100 and system hangs! here is the code,first, picture box code for selecting this function and call fill function after clicking:

    private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
    {

    if (act == “color”)
    {

    fill(bmp ,e.X, e.Y, bmp.GetPixel(e.X, e.Y));
    pictureBox1.Image = bmp;

    }

    }

    ============================and fill fuction which deosn’t work!

    private void fill(Bitmap picture, int x, int y, Color bcolor)
    {

    if (x > 0 && x 0 && y < picture.Height)
    {

    Point p = new Point(x, y);
    Stack s = new Stack();
    s.Push(p);
    while (s.Count != 0)
    {
    p = s.Pop();
    Color currentcolor = picture.GetPixel(p.X, p.Y);
    if (currentcolor == bcolor)
    {

    picture.SetPixel(p.X, p.Y, currentcolor);
    s.Push(new Point(p.X – 1, p.Y));
    s.Push(new Point(p.X + 1, p.Y));
    s.Push(new Point(p.X, p.Y – 1));
    s.Push(new Point(p.X, p.Y + 1));
    }

    }
    }

    }

    any idea to fix this issue?

    — So ,any other suggestions or a better code for paint bucket?
    thanks

  5. RodStephens says:

    When the system hangs and nothing seems to happen, that’s often a symptom of an infinite loop.

    In this example the code gets the pixel’s current color and then compares it to the target color. If they match, it sets the pixel’s color to its current color so it isn’t changed. It then adds the neighbors to the stack and continues. Because the target pixel’s color wasn’t changed, when the code later look at it again it again thinks it needs to color that pixel. What you get is the same pixels being added to the stack again and again.

    You can fix it by changing this statement:

    picture.SetPixel(p.X, p.Y, currentcolor);

    so it sets the pixel to the desired fill color. For example, add a new fill_color parameter to the method and set the pixel’s color to that. When the method starts, you might also check that the target color bcolor and fill_color are different. Otherwise you’ll get the same sort of infinite loop.

    You can also see this post for an example:

    Write a graphical floodfill method in C#

  6. Victor says:

    Hi Rod

    I am following your Learning Data Structures and Algorithms video series. First I must say it is one of the simplest explanation of hardest stuff in comp science.
    Unfortunately I dont see any working files after lesson 6, here http://examples.oreilly.com/0636920039884/

    Is there any other place where I should look? Thanks and keep up the great stuff publishing.

    • RodStephens says:

      I’m so sorry about that! I think I failed to upload all of the examples correctly so it’s my fault not O’Reilly’s. I’ve told them about it and they will hopefully fix it quickly.

      Meanwhile if you email me at RodStephens@CSharpHelper.com I’ll send you the missing files or put them somewhere so you can download them.

  7. Hi Rod,

    Can you please create a example desktop application or console to extract youtube video data from URL or keyword like a tag and description?

    I am playing using HtmlAgilityPack, but i only able to extract URL from keyword, i don’t really understand how to extract description and tags of youtube videos. Hope you can help me Rod,

    Thank you in advance

  8. MrJay says:

    Hi,
    A new comer from java to C-sharp i just had a simple form that have save,update, delete, clear button how than will i display it on data-grid on a separate form and it make program accessible on the network.
    Thanks.
    Best Regard,
    MrJay.

    • RodStephens says:

      You should look at ASP.NET if you want it accessible on the internet.

      If you want it to run locally on multiple machines on an internal network, you could use SQL Server or some other database product that runs across a network.

  9. MrJay says:

    Thanks for this MIND BLOWING BOOK TITLE “Beginning Software Engineering” By Mr Rod Steve.

Leave a Reply

Your email address will not be published. Required fields are marked *