Please review algorithm for filling in quads

This is a discussion on Please review algorithm for filling in quads within the Game Programming forums, part of the General Programming Boards category; I am trying to create a function that can calculate the triangle coordinates that must be used in order to ...

  1. #1
    Shadow12345
    Guest

    Please review algorithm for filling in quads

    I am trying to create a function that can calculate the triangle coordinates that must be used in order to fill in a quad on a plane. I have it already type out and I am using the function but it obviously doesn't work (Jagged protruding shapes form around my little spaceship and they extend twice the distance of the entire model, its weird).

    I didn't want to post the source because it is confusing, I just want to review the steps I took to make sure I have the correct idea. As a side note I already spoke with a math teacher but I cannot go back to him at this time

    Algorithm:
    -Read coordinates from file
    -Divides each coordinate by ScaleSize, store in float[3] array
    -Finds which vector is longest (this is hypotenuse)
    -Find midpoint of hypotenuse
    -Find length from midpoint of hypotenuse to other the coordinate in the triangle, store in scalarvalue
    -multiply this by 2
    -subtract scalarvalue from other vertex to get last coordinate of triangle

    for example:
    if AB is the longest, find the midpoint of a to b, find the length from midpoint[ab] to c, find the length of the vector that goes from midpoint[ab] to c. multiply that length by 2 to get vertex c in the mirror triangle. verticies a and b will be the same in both triangles.

    I hope that made sense, please ask me questions if you have no clue what i am talking about and i will try to explain myself a little bit better.

    -Thanks if you can help me

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  3. Please review algorithm for filling in quads
    By Shadow12345 in forum C++ Programming
    Replies: 5
    Last Post: 10-17-2002, 04:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21