Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.5K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Formula to return object area comprised of lines and radii?

Posted 7 years ago

At one time, I had a formula used in a FORTRAN program that provided the area of an object comprised of lines and radii. I provided an NC input file that contained x-y coordinates along with x-y offsets for a radius and it also indicated CW or CCW circular interpolation. The areas under the lines and radii would be summed when travelling left to right and subtracted when going right to left. I know that I can calculate the areas manually. Can someone point me to where I could find that formula? Thank you.

Attachments:
POSTED BY: Barry Frye
4 Replies
Posted 7 years ago
POSTED BY: Barry Frye

In Wolfram Language(Mathematica) only exact numbers have infinity precision.

A toy example:

     data = Polygon[{{0, 0}, {1, 1}, {1, 1/3}}];(* 1/3 exact value *)
     Graphics[data]
     Area[data, Method -> {"NIntegrate", WorkingPrecision -> 100}]
     (* 0.33333333333333333333333333333333333333333333333333333333333333333333\
     33333333333333333333333333333333 *)


      data = Polygon[{{0, 0}, {1, 1}, {1, 0.3}}];(* 0.3 a numeric value with "MachinePrecision" *)
      Graphics[data]
      Precision[0.3]
      (*  MachinePrecision *)
      Area[data, Method -> {"NIntegrate", WorkingPrecision -> 100}]
      ( *0.35 *)

      data = Polygon[{{0, 0}, {1, 1}, {1,0.33333}}];(* 0.33333 a numeric value with "MachinePrecision" *)
      Graphics[data]
      Precision[0.33333]
      (*  MachinePrecision *)
      Area[data, Method -> {"NIntegrate", WorkingPrecision -> 100}]
      ( *0.333335 *)
POSTED BY: Mariusz Iwaniuk
Posted 7 years ago

I would need the accuracy to be +/- 0.001 so the polygon solution would be approximate. Correct?

POSTED BY: Barry Frye

Another way:

data = Polygon[{{1, 1}, {2, 10}, {4, 10}, {4.15, 9.6}, {4.5, 9}, {5, 
    8.5}, {5.4, 8.3}, {6, 8.2}, {6, 8.6}, {6.1, 9}, {6.25, 9.3}, {6.5,
     9.5}, {9.5, 9}, {9.5, 3}, {7, 2.5}, {6.8, 2.2}, {6.4, 1.9}, {6, 
    1.8}, {5.4, 1.85}, {4.96, 2.2}, {4.8, 2.3}, {4.5, 2.35}, {4.4, 
    2.35}, {3.9, 2.2}, {3.5, 1.8}}];
Graphics[data]

enter image description here

Area[data]
(* 57.6415 *)
POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard