Author Topic: change direction to start and arc LWPOLYLINE  (Read 5266 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
Re: change direction to start and arc LWPOLYLINE
« Reply #15 on: July 30, 2014, 04:39:22 PM »
ronjonp , god, that simple, thank you for your wisdom.
Thanks for help

ronjonp

  • Needs a day job
  • Posts: 7529
Re: change direction to start and arc LWPOLYLINE
« Reply #16 on: July 30, 2014, 04:57:28 PM »
Glad to help  :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

LE3

  • Guest
Re: change direction to start and arc LWPOLYLINE
« Reply #17 on: July 30, 2014, 05:12:03 PM »
Hi Ron,
I think that will return the area of the sector no? - sorry no idea if that's what the OP wants... got the impression he is looking for the area of a segment... if not ignore my comment.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: change direction to start and arc LWPOLYLINE
« Reply #18 on: July 30, 2014, 06:43:14 PM »
You are correct Luis ... let's see if the OP responds :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

TopoWAR

  • Newt
  • Posts: 135
Re: change direction to start and arc LWPOLYLINE
« Reply #19 on: July 30, 2014, 08:54:57 PM »
ronjonp , hello, LE is right, the area that I occupy is that of a circular segment!
I know it's more complicated, but there if I can help with this, thanks
Thanks for help

LE3

  • Guest
Re: change direction to start and arc LWPOLYLINE
« Reply #20 on: July 30, 2014, 09:25:15 PM »
^ then that will be easy, Ron gave to you the solution for the sector, simple you know the cord length and radius, create a triangle from those sides, calculate the area and subtract it from the area of the sector. HTH.

TopoWAR

  • Newt
  • Posts: 135
Re: change direction to start and arc LWPOLYLINE
« Reply #21 on: July 30, 2014, 09:44:09 PM »
LE , I fail to understand how, maybe with an example you can do
Thanks for help

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: change direction to start and arc LWPOLYLINE
« Reply #22 on: July 30, 2014, 09:48:53 PM »
LE , I fail to understand how, maybe with an example you can do

Area of Segment = ½ × (θ - sin θ) × r2   (when θ is in radians)

http://www.mathsisfun.com/geometry/circle-sector-segment.html

Have fun.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

TopoWAR

  • Newt
  • Posts: 135
Re: change direction to start and arc LWPOLYLINE
« Reply #23 on: July 30, 2014, 09:59:54 PM »
Kerry , hello, thank you, I've seen several formulas out there, it's just that not be interpreted, I searched the meaning of the signs but I did not understand, maybe I translate the formula simple mathematics to pass a lisp I thank .
Thanks for help

TopoWAR

  • Newt
  • Posts: 135
Re: change direction to start and arc LWPOLYLINE
« Reply #24 on: July 30, 2014, 10:08:08 PM »
LE, you're right, it is a matter of creating a triangle and go.
The area of ​​the circle segment is equal to the circular sector area minus the area of ​​the triangular portion.
Thanks for help

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: change direction to start and arc LWPOLYLINE
« Reply #25 on: July 31, 2014, 04:18:12 PM »
Area of triangle = 1/2 x base x height

For your sector, you have:

base = r
height = r sin(a)
[Where 'a' is the included angle]

Therfore, the triangle area is:

1/2 x r x r sin(a) = r2/2(sin(a))

The area of the entire sector is the proportion that the sector constitutes of the area of the circle, i.e.:

a/2π x πr2 = ar2/2

a/2π gives the proportion of the circle occupied by the sector
πr2 obviously gives the area of the entire circle

Therefore, the area of the sector minus the area of the triangle is:

(ar2/2) - (r2/2(sin(a)))

We can take out a factor of r2/2 giving:

r2/2(a - sin(a))

Now, the only quantities we require from the polyline arc is the included angle & the arc radius.

The polyarc bulge is the tangent of 1/4 of the included angle, therefore, the inverse of this operation gives the included angle from the bulge value:

a = 4 x atan(b)

As for the bulge radius, there are various ways to acquire this value - here is one example:

Code - Auto/Visual Lisp: [Select]
  1. ;; Bulge Radius  -  Lee Mac
  2. ;; p1 - start vertex
  3. ;; p2 - end vertex
  4. ;; b  - bulge
  5. ;; Returns the radius of the arc described by the given bulge and vertices
  6.  
  7. (defun LM:BulgeRadius ( p1 p2 b )
  8.     (/ (* (distance p1 p2) (1+ (* b b))) 4 (abs b))
  9. )

Now you have all the tools & information you require to calculate the required area  :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: change direction to start and arc LWPOLYLINE
« Reply #26 on: July 31, 2014, 07:24:02 PM »
LE, you're right, it is a matter of creating a triangle and go.
The area of ​​the circle segment is equal to the circular sector area minus the area of ​​the triangular portion.

TopoWAR,
I'd like to see the complete code you design to resolve this problem.
It will be educational for anyone following along.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.