Mathimatical Relationship
Author |
Message |
copthesaint
![](http://compsci.ca/v3/uploads/user_avatars/15853548854c9c056fda48d.jpg)
|
Posted: 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 |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
mirhagk
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
S_Grimm
![](http://compsci.ca/v3/uploads/user_avatars/18926424384e6d86e5cf4d6.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
copthesaint
![](http://compsci.ca/v3/uploads/user_avatars/15853548854c9c056fda48d.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
copthesaint
![](http://compsci.ca/v3/uploads/user_avatars/15853548854c9c056fda48d.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
S_Grimm
![](http://compsci.ca/v3/uploads/user_avatars/18926424384e6d86e5cf4d6.jpg)
|
Posted: Fri Mar 16, 2012 7:50 am Post subject: RE:Mathimatical Relationship |
|
|
no problem man. |
|
|
|
|
![](images/spacer.gif) |
|
|