Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Mathimatical Relationship
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
copthesaint




PostPosted: Thu Mar 15, 2012 1:33 am   Post subject: Mathimatical Relationship

Hello, Im currently trying to figure out the relationship of points to form triangles. I realize I am conveying my message wrong however I still would appreciate the help. I made this example program, What I want to do is create a mathematical equation to create triangles where appropriate. 1 line cannot cross through another however lines are allowed to be parallel. The Context of this task Im trying is to generate a random 3D Model.

if anyone has a good calculator maybe it can find a relationship? Atm Im stumped.

Turing:
View.Set ("Graphics:800;600,offscreenonly,nobuttonbar")
var font1 : int := Font.New ("Arial:12")
var quality : int := 3


loop

    for i : 0 .. (quality - 1)
        for j : 0 .. i * 2
            var pX : real := ((maxx / 2) + (75 * i) * cosd ((360 / ((i * 2) + 1)) * j))
            var pY : real := ((maxy / 2) + (75 * i) * sind ((360 / ((i * 2) + 1)) * j))
            drawfilloval (round (pX), round (pY), 10, 10, black)
            Font.Draw (intstr (j), round (pX - (Font.Width (intstr (j), font1) / 2)), round (pY - (Font.Width ("W", font1) / 3)), font1, white)
        end for
    end for
    View.Update
cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Thu Mar 15, 2012 11:16 am   Post subject: RE:Mathimatical Relationship

you could brute force it? There's obviously a better way but if your saving these random models, and do not need to generate them dynamically, then that would work.

You can easily test if two lines segments intersect, simply find the point of intersection between the lines, then see if that point lies on both line segments.
S_Grimm




PostPosted: Thu Mar 15, 2012 11:27 am   Post subject: RE:Mathimatical Relationship

Give a look at this article http://graphics.stanford.edu/~pmerrell/tvcg.pdf

i think that its something like what you are looking for. I'll keep digging and see if I find any other stuff for you.

Also let me know if that's along the lines of what you are looking for.
copthesaint




PostPosted: Thu Mar 15, 2012 2:40 pm   Post subject: Re: Mathimatical Relationship

mirhagk wrote:

you could brute force it? There's obviously a better way but if your saving these random models, and do not need to generate them dynamically, then that would work.

You can easily test if two lines segments intersect, simply find the point of intersection between the lines, then see if that point lies on both line segments.


I want to find an algorithm to solve my problem because the 3D model will not always have the same amount of inner points and outer points. I know how to accomplish my goal however I believe that it would be unprofessional to do specify each line, I would rather have an equation to shorten my code.

S_Grimm wrote:

Give a look at this article http//graphics.stanford.edu/~pmerrell/tvcg.pdf

i think that its something like what you are looking for. I'll keep digging and see if I find any other stuff for you.

Also let me know if that's along the lines of what you are looking for.


Ill read it and see if it might give me any insight to my problem.
copthesaint




PostPosted: Thu Mar 15, 2012 4:02 pm   Post subject: Re: Mathimatical Relationship

@ S_Grimm, I have read the article you have send me, and I was able to create an algorithm, Thank you for the link.
S_Grimm




PostPosted: Fri Mar 16, 2012 7:50 am   Post subject: RE:Mathimatical Relationship

no problem man.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: