3 Replies - 1059 Views - Last Post: 01 December 2011 - 08:08 AM Rate Topic: -----

#1 rapo  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 64
  • Joined: 27-November 08

How to find if three lines can form a triangle

Posted 01 December 2011 - 06:57 AM

I have a problem and I can't find an algoritm. I have an area[Workspace] (a square for example), in this area I'm drawing objects(squares or triangle), after the drawing of objects ( i'm calling them obstacles), I want the rest of the area to divide it in triangles. My algoritm is in this stage:
  • I have the coordinates of the area (Workspace)
  • I have the coordinates of the obstacles(Every point of outline of every obstacle)
  • I'm drawing lines to join each point (obstacles extremities and area extremities)
  • I have the coordinates of the lines between obstacles and between obstacles and workspace


I need an I idea of an algorithm to form valid traingles. I will attach two pictures to be more exact.
I'm in the situation of the first picture, I have the draw,coordinates, but I can't find an algorithm to find which 3 lines can form a triangle.
The coordinates of points are keept in generic lists List<Point> and lines of obstacles,workspaces and lines are separated kept in List<Line>

Thanks

Attached image(s)

  • Attached Image
  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: How to find if three lines can form a triangle

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5480
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: How to find if three lines can form a triangle

Posted 01 December 2011 - 07:03 AM

Please read this:

I don't want code, just some ideas/help on the logic because I'm lost.

What you're really asking is for someone else to do all the heavy lifting of figuring out how your application should work: To do the actual engineering part of the software. Hence the job title Software Engineer.

Quote

but I can't find an algorithm to find which 3 lines can form a triangle.


Its not about *finding* an algorithm. Its about you developing one. Creating one, not plagiarizing one someone else put out on the net.
Was This Post Helpful? 0
  • +
  • -

#3 rapo  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 64
  • Joined: 27-November 08

Re: How to find if three lines can form a triangle

Posted 01 December 2011 - 07:09 AM

I don't need code, an idea, or a clue
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5480
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: How to find if three lines can form a triangle

Posted 01 December 2011 - 08:08 AM

Hence I gave you a link to the article "I don't need code, just an idea"


View PosttlhIn`toq, on 01 December 2011 - 08:03 AM, said:



Did you read the article? The gist of it is that you at least need to make an effort of your own first. Just like when you need *help* with code.

The logic is the important part. The tough part. Once you have a plan in place the rest is just typing.

When you took on this project you must have had at least one plan in mind for how you were going to do it. To look at a project and say to yourself "I have no fraking clue. Sure I'll do it." would be idiotic.

We have all taken on tasks with a plan in mind, then had that plan fail us. It happens to everyone. Either the idea didn't work with the data... we didn't realize our original plan was going to require 18 hours of processing for every 6 hours of incoming data... After the plan was coded the boss then added on something else that was unknown to us and totally incompatible with the original logic. Etc. etc. But we all at least tried first before throwing up our hands and asking for help.

What I'm saying here is that you don't seem to have tried anything other than what you admit to: Trying to *find* a plan. Which I interpret as Googling for algorithm that someone else has given out.

If I'm wrong, then show it. What was your first couple ideas of how to approach this problem? How did those ideas fail in getting the job done.

I'm just trying to get you to make a good faith effort to devise a plan to do this before asking others to do your thinking for you.

This post has been edited by tlhIn`toq: 01 December 2011 - 08:08 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1