Loading...
  1. Dismiss Notice
  2. Dismiss Notice
  3. Dismiss Notice
  4. Dismiss Notice
  5. If this is your first visit, you may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

C# programing.

Discussion in 'Programming Lounge' started by tigrutza, Jan 14, 2016.

  1. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    Well , i know i sayd i ussually don't ask for help , but now is there no much time left!
    I have this project for University and ..i have to do a Geometrical transalation in 2D graphics , for trapezoid , in c# , visual basic studio..
    I made already for rectangle and triangle , but...maybe my brain stopped and cannot make it for trapezoid , so. if it's anybody here that knows c# programming and computer graphic..or is an IT student , please do share with me your knowledge about this...or at least give some advice .
    I did googled it , if you kinda will ask me to do this , but worthless...
    Ty in advance..!
     
  2. Daniel

    Daniel Håx

    Joined:
    May 23, 2014
    Messages:
    470
    Likes Received:
    238
    Trophy Points:
    298
    Is it required to use 2x2 on your project? Can't you use a 3x3 matrix for it? Because even if you use a rectangle. It cannot be transformed into trapezoid with the use of 2x2 matrix.
     
  3. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    He didn't specified ...he just sayd to do that..jerk teacher.
     
  4. Daniel

    Daniel Håx

    Joined:
    May 23, 2014
    Messages:
    470
    Likes Received:
    238
    Trophy Points:
    298
    So far i don't see any posibility to make that happen q.q
    If you are looking for a transformation determined by multiplication with a 2x2 matrix, then I'm afraid this cannot be done. Such a transformation is linear, so maps a vector to the same vector irrespective of its starting points. In other words, if A,B,C,DA,B,C,D are points on the plane such that AB→=CD→AB→=CD→, and A′,B′,C′,D′A′,B′,C′,D′ are their respective images under this transformation, then we also have A′B′→=C′D′→A′B′→=C′D′→.

    So a linear transformation will map any parallelogram to another parallelogram, because the opposite sides of a parallelogram form the same vector. As that does not hold for a trapezoid, a linear transformation cannot turn a rectangle (= special case of a parallelogram) into such a trapezoid that is not also a parallelogram.
     
  5. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    Well maybe he gived me a tricky one...don't know what to say , i also thinked like that , and wasn't quite a solution..that's why i started to think its tricky, because i managed to do this for rectangle and triangle.
     
  6. Daniel

    Daniel Håx

    Joined:
    May 23, 2014
    Messages:
    470
    Likes Received:
    238
    Trophy Points:
    298
    I'll pm you some other ways that could help you make it.
     
    tigrutza likes this.
  7. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    Thank you!
     
  8. Bai

    Bai ѕιѕιω

    Joined:
    Oct 16, 2014
    Messages:
    1,160
    Likes Received:
    1,716
    Trophy Points:
    378
    Location:
    ғʀᴏᴍ ᴄʜɪᴄᴋᴇɴ ᴛᴏ ᴇɢɢ
    Oh my god!

    I'm still at the starter line of programming, we're currently discussing Basic c# :3
     
  9. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    Well i'm in the final year now..and they started to ask silly things...really i will not use this.. when im gonna work.
     
  10. Crit

    Crit Noli Me Tangere

    Joined:
    Jun 2, 2013
    Messages:
    299
    Likes Received:
    195
    Trophy Points:
    308
    Location:
    Planet of the Apes
    I'm a Computer Science i can help you with that :) just pm me the question clear question :)
     
  11. Qty

    Qty ⬛⬛⬛SPIRITMASTER⬛⬛⬛

    Joined:
    Nov 29, 2015
    Messages:
    410
    Likes Received:
    190
    Trophy Points:
    298
    Location:
    Everywhere
    I am an IT but im still in C hehe.
     
  12. Razor

    Razor Master of Disguise Forum Legend

    Joined:
    Oct 14, 2010
    Messages:
    3,356
    Likes Received:
    2,072
    Trophy Points:
    463
    Location:
    Sofia, Bulgaria
    wasn't translation just moving all the points of an object with the same vector?
     
  13. tigrutza

    tigrutza Lysse

    Joined:
    Jun 16, 2012
    Messages:
    121
    Likes Received:
    211
    Trophy Points:
    308
    Location:
    Bucharest
    The trapezoid just have to move , translation = moving in geometry , whitout rotating / resizing , and it must have the same direction and the same distance.
    So.For rectangle is like this (Made a windows form application, needed PaintEventArgs e and Paint event objects)
    Quick example:
    public void TranslateExample(PaintEventArgs e)
    {
    Pen myPen = new Pen(Color.Blue, 1); Here will draw a rectangle ,before applying the transformation
    Pen myPen2 = new Pen(Color.Red, 1);

    e.Graphics.DrawRectangle(myPen, 20, 20, 100, 50);

    Matrix myMatrix = new Matrix(); Here will create the matrix and then will translate it.
    myMatrix.Translate(100, 100, MatrixOrder.Append);

    e.Graphics.Transform = myMatrix; And..here will draw the points to the screen after its applyed the transformation.
    e.Graphics.DrawRectangle(myPen2, 20, 20, 100, 50);
    }
     

Share This Page