See the top rated post in this thread. Click here

Results 1 to 9 of 9

Thread: Triangle calculation

  1. #1
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    1

    Question Triangle calculation

    I'm working on a routine to draw two lines at equal lengths. The two lines represent the midpoint between a line and an arc along a second line, which may or may not be perpendicular to the first line. The line coming from the arc is radial from the center point of the arc.

    Does anyone have any ideas on how to determine the lengths of the two equal length lines?
    Attached Images Attached Images
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    1

    Default Re: Triangle calculation

    You have the point where the horizontal line hits the angle line so can work out a 90deg line, ok so do a loop stepping a distance for a new point then do a closestpointto the circle when the two values offset and new distance are within a fudge value that is the answer.

  3. #3
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    1

    Default Re: Triangle calculation

    The problem in fact consists in determining the position of the point P. Solution is simple. See below image.
    New Picture.png

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Triangle calculation

    Thanks. I went with more of a fudge by traversing down the green line and testing distance from the center point less the radius. If the two distances were within a margin of error, it was close enough. I would like a more exact algorithm, but I am comfortable with my current solution.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: Triangle calculation

    Quote Originally Posted by Opie View Post
    Thanks. I went with more of a fudge by traversing down the green line and testing distance from the center point less the radius. If the two distances were within a margin of error, it was close enough. I would like a more exact algorithm, but I am comfortable with my current solution.
    Considering the notations in the previous message, try this:
    Code:
    (defun bepe (pointO pointA pointB AD / pointD pointQ)
      (setq pointD (polar pointO (angle pointO pointA) (+ (distance pointO pointA) AD))
    ;;pointQ = (d) intersected with BD
            pointQ (polar pointB (angle pointB pointD) (/ (distance pointB pointD) 2.))
      )
    ;;Distance between point B and point P
      (distance pointB (inters pointQ (polar pointQ (+ (angle pointB pointD) (/ pi 2)) 100.) pointO pointB nil))
    )

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Triangle calculation

    Quote Originally Posted by LiDo View Post
    Considering the notations in the previous message, try this:
    Code:
    (defun bepe (pointO pointA pointB AD / pointD pointQ)
      (setq pointD (polar pointO (angle pointO pointA) (+ (distance pointO pointA) AD))
    ;;pointQ = (d) intersected with BD
            pointQ (polar pointB (angle pointB pointD) (/ (distance pointB pointD) 2.))
      )
    ;;Distance between point B and point P
      (distance pointB (inters pointQ (polar pointQ (+ (angle pointB pointD) (/ pi 2)) 100.) pointO pointB nil))
    )
    Unfortunately, the location of Point B is not known. I know it falls on the arc ... somewhere. If I knew the location of Point B, I could calculate Point P's location.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: Triangle calculation

    Quote Originally Posted by Opie View Post
    Unfortunately, the location of Point B is not known. I know it falls on the arc ... somewhere. If I knew the location of Point B, I could calculate Point P's location.
    In this case the problem is undetermined. With a little effort could write the equation of the curve on which point P moves, considering that point B moves on the circle.
    On the other hand, if the angle ODP is given (on your sketch the value is 26.593 deg), then the problem has one solution but my approach needs to be slightly changed.

  8. #8
    Login to Give a bone
    3

    Default Re: Triangle calculation

    use the cosine formula to find value of 'c'
    in the triangle OPD (a+c)^2 = c^2 + (a+b)^2 - 2c(a+ b)cosD
    if u need angle at 'O' use the sine formula
    sinO/c=sinD/(a+c)


    (defun TC (a b D / c)
    (setq D (/ (* D pi) 180.0)) ;; convert D to radians
    (setq c (/ (+ (* b b)(* 2 a b))(* 2 (+ a (* (cos D)(+ a b)))))) ) )


    ;;; (setq D 26.593)
    ;;; (setq a 25.0)
    ;;; (setq b 5.0


    (TC 25.0 5.0 26.593)


    HTH
    Attached Images Attached Images

  9. #9
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Triangle calculation

    That is exactly what I was looking for. Thanks.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. hypotenuse of a right triangle
    By PEWAUKEEJOHN in forum Revit Architecture - General
    Replies: 6
    Last Post: 2007-05-30, 07:16 PM
  2. Conventional surface Texture Symbol (Triangle)
    By design.sstp in forum Inventor - General
    Replies: 1
    Last Post: 2007-01-10, 02:17 PM
  3. Pentagon and Triangle Windows
    By noah in forum Revit Architecture - Families
    Replies: 2
    Last Post: 2005-04-12, 05:55 PM
  4. The impossible triangle made possible
    By Patriiick in forum AutoCAD 3D (2006 or below)
    Replies: 1
    Last Post: 2004-08-16, 09:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •