Points of Graphic Oval

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Points of Graphic Oval

** Clarence P Martin ** via use-livecode
1) draw graphic  oval  name:  "moveClue1"
2) create small image "word_1"

move image "word_1" to the points of grc "moveClue1" in 2 seconds

test:

point the points of graphic "moveClue1"

result: empty

check dictionary: yep, oval are not among the objects with points ☹

OK, so how can we generate the points of  a perfect oval?

BR


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
On 07/30/2017 09:06 PM, Sannyasin Brahmanathaswami via use-livecode wrote:

> OK, so how can we generate the points of  a perfect oval?

How many points would you guess are in an oval?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
You can use the effectivePoints to get the points of any graphic shape, but depending on the size, your oval may produce too many points.

In any event, your source oval doesn't need to be perfect. If you reference a "decent" number of points along the shape of the oval, your image will have the appearance of moving along an elliptical path.

Regards,

Scott Rossi

> On Jul 30, 2017, at 9:06 PM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> 1) draw graphic  oval  name:  "moveClue1"
> 2) create small image "word_1"
>
> move image "word_1" to the points of grc "moveClue1" in 2 seconds
>
> test:
>
> point the points of graphic "moveClue1"
>
> result: empty
>
> check dictionary: yep, oval are not among the objects with points ☹
>
> OK, so how can we generate the points of  a perfect oval?
>
> BR
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
> BR wrote:
> 1) draw graphic  oval  name:  "moveClue1"
> 2) create small image "word_1"
> move image "word_1" to the points of grc "moveClue1" in 2 seconds
> OK, so how can we generate the points of a perfect oval?

> > Scott wrote:
> > You can use the effectivePoints to get the points of any graphic shape,
> > but depending on the size, your oval may produce too many points.
> > In any event, your source oval doesn't need to be perfect. If you
> > a "decent" number of points along the shape of the oval, your image
> > will have the appearance of moving along an elliptical path.

You don't need to create a graphic for that, a ("decent") list of points
is enough:

on mouseUp
  put 200 into x0
  put 200 into y0
  put 100 into rx
  put 100 into ry
  put 36 into n0 #<-- usually enough vertices for 1.5 seconds
  move image 1 to ellipticalPoints(n0,rx,ry,x0,y0) in 1500 millisecs
end mouseUp

### yields points of a elliptical n-sided polygon
### circular: set rx=ry
-- n0 is the number of vertices (= n+1 points as closed polygon)
-- rx is the horizontal radius
-- ry is the vertical radius
-- x0 is the x-coord of the center
-- y0 is the x-coord of the center
function ellipticalPoints n0,rx,ry,x0,y0
  put 2*pi/n0 into cn
  -- n0 vertices --> n0+1 points as we want a 'closed' polygon
  -- This is here true as sin(0)=sin(2*pi) and cos(0)=cos(2*pi)
  put empty into pts
  repeat with j= 0 to n0
    put CR & (round(rx*sin(j*cn)+x0),round(-ry*cos(j*cn)+y0)) after pts
  end repeat
  return char 2 to -1 of of pts
end ellipticalPoints


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
[Once again, without typos (although it works correctly with the typos)]

The following runs in LC 6/7/8/9.

### yields points of an 'elliptical' n0-sided polygon,
### for a 'circular' shape set rx=ry.
-- n0 is the number of vertices (= n0+1 points for a closed polygon)
-- rx is the horizontal radius
-- ry is the vertical radius
-- x0 is the horizontal coord of the shape's center
-- y0 is the vertical coord of the shape's center
function ellipticalPoints n0,rx,ry,x0,y0
  put 2*pi/n0 into cn
  -- n0 vertices --> n0+1 points as we want a closed polygon (start=end)
  -- This is here true as sin(0)=sin(2*pi) and cos(0)=cos(2*pi)
  put empty into pts
  repeat with j= 0 to n0
    put CR & (round(rx*sin(j*cn)+x0),round(-ry*cos(j*cn)+y0)) after pts
  end repeat
  return char 2 to -1 of pts
end ellipticalPoints


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
Personally I would do something I learnt to do in about 1976 in FORTRAN:

make yourself an 800 x 800 stack, and a lineField called "POYNTS",
and an irregular polygon called "POLLY"

put 0 into KOUNT
repeat until KOUNT > 6.29
put (KOUNT * 100) + 1 into LYNE
put (400 +((sin(KOUNT))*300)) into LR
put (400 +((cos(KOUNT))*300)) into UP
put LR,UP into line LYNE of fld "POYNTS"
add 0.01 to KOUNT
end repeat
set the points of grc "POLLY" to the lines of fld "POYNTS"

I wrote this "straight off" into the e-mail client without checking it
in LC: it SHOULD
generate a CIRCLE with points; you can them squish the thing to get the
Oval you require.

Richmond.



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
By strict geometry, an infinite amount. Using Bezier, 4. :-)

Bob S


> On Jul 30, 2017, at 21:46 , Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 07/30/2017 09:06 PM, Sannyasin Brahmanathaswami via use-livecode wrote:
>
>> OK, so how can we generate the points of  a perfect oval?
>
> How many points would you guess are in an oval?
>
> --
> Mark Wieder


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
On 07/31/2017 07:55 AM, Bob Sneidar via use-livecode wrote:

> By strict geometry, an infinite amount. Using Bezier, 4. :-)

Hey, no fair. Using Bezier curves is cheating. <g>

But yeah, thus my rather snarky reply which should have had a smiley
thing anyway. When I wrote the effective points code I made ovals have
360 points because that seemed logical. Nobody's complained yet, but I'm
guessing that Brahmanathaswami is the first one who's tried this.

--
  Mark Wieder
  [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
> Bob S. wrote:
> By strict geometry, an infinite amount. Using Bezier, 4. :-)

Just because I am curious which part of your statement is the joke:

How do you define "strict geometry"?
And what is an "infinite amount"?

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
On 07/31/2017 08:34 AM, hh via use-livecode wrote:
>> Bob S. wrote:
>> By strict geometry, an infinite amount. Using Bezier, 4. :-)
>
> Just because I am curious which part of your statement is the joke:
>
> How do you define "strict geometry"?

That would be my seventh-grade math teacher <g>

> And what is an "infinite amount"?

For points in an oval, that would be Aleph-one, no?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
> Mark wrote:
>> How do you define "strict geometry"?
> That would be my seventh-grade math teacher <g>
>> And what is an "infinite amount"?
> For points in an oval, that would be Aleph-one, no?

I see. When you selected to return 360 points for the effective
points of an oval (what is, TMHO, a 'natural' choice) you did
indeed ask HAL, thinking of aleph1.
You couldn't accept the answer. And now Scott has to convince BR
that a "decent" number [= trunc(27*pi/2)] of points are usually
good enough for "move to <points>" ...

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
The obvious method for generating the points of an oval—use a loop that generates sin(x) & cos(x) coördinate-pairs—has already been mentioned. What's *not* so obvious, is that the points generated by that method are not evenly spaced! Not unless you're working with a perfect circle, anyway. For non-circle ovals, the distance between any two consecutive points will rise with the distance between those points and the origin. So if you're using those points in a "move [whatever] to the points of"-type command, the thing you're moving will not move at a constant speed… well, not unless your 'oval' is a circle, in which case the distance to the origin will be constant, hence the resulting speed of motion will also be constant.

The closer your 'oval' is to a perfect circle, the less obvious the deviations from constant speed will be, of course. You'll have to decide for yourself whether those deviations are of great-enough magnitude to be worth worrying about.

If deviations from constant speed *are* worth worrying about? Depending on what you're actually doing, you may actually want to have the oval-path-constrained motion vary in speed, and the particular mode of variance you end up with may be exactly the mode of variance you get from using the obvious method. But in any other case, you may want to look into a different method for generating the set of oval-points you use.

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
   
Read the webcomic at [ http://www.atarmslength.net ]!
   
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
Both are part of the joke. I shouldn't explain it because that is like disecting a frog. The frog dies and nobody cares. :-)

But geometrically in any line there are an infinite number of points, because a point is an infinitely small coordinate. That's if by point you mean literally points in the geometrical sense. But if you mean how many pixels on a given display to create a visually smooth curve, well that is another matter. And if by points you meant anchors in a vector based drawing program, why typically 4 points, although 3 will do, I just don't know how perfect the circle can be and I thing an oval would require 4.

See? The frog died and nobody cares!

Bob S


> On Jul 31, 2017, at 08:34 , hh via use-livecode <[hidden email]> wrote:
>
>> Bob S. wrote:
>> By strict geometry, an infinite amount. Using Bezier, 4. :-)
>
> Just because I am curious which part of your statement is the joke:
>
> How do you define "strict geometry"?
> And what is an "infinite amount"?


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
Sequently found "effectivePoints" and used that and it works fine on Mobile.

But this thread became something more, it became about generating a polygon object that "looks like" an oval.

But is an oval such an object at all?

Mark Wieder via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    How many points would you guess are in an oval?

BR Ahhh, programmatically perhaps it has no "points" as such… being a single continuous line shaped only by its changing arc-radius values.?
i.e.  a mystic conundrum: "infinite number of points and not points at all"

SCOTT  Rossi wrote:

You can use the effectivePoints to get the points of any graphic shape, but depending on the size, your oval may produce too many points.

In any event, your source oval doesn't need to be perfect. If you reference a "decent" number of points along the shape of the oval, your image will have the appearance of moving along an elliptical path.


BR: But using "The effectivePoints" seems to work as if there were no points (as such), but only a contiguous line…

Which takes us back to Marks first question…"how many points in an oval"   which I will re cast as:

At the depths of the LC engine imaging algorithms… is a circle or oval made up of points at all?

br





_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
The effective points of an oval (circle) are the 360 points of a regular
polygon with 360 vertices (if it's closed). You could look at stack #2 of
the Raspi-Collection, runs on Mac/Win/linux using LC 6/7/8/9:

http://forums.livecode.com/viewtopic.php?p=98716#p98716
(in LC 8/9 add a semicolon after "origin" in line 66 of the card script).

Change there the number of vertices N to 24,32,64 or 360 and you will
understand, why Scott said, a "decent" number is enough.

A circle is, just like a Bezier curve, a mathematical model, for thinking,
doing mathematics. Not realizable in our virtual world.
What you can have and what you see are (more or less good) approximations
to that model, here nothing more than simple polygons.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
HH wrote:

    A circle is, just like a Bezier curve, a mathematical model, for thinking,
    doing mathematics. Not realizable in our virtual world.
    What you can have and what you see are (more or less good) approximations
    to that model, here nothing more than simple polygons.

But then, as the circle/oval got bigger one would see 360 "sides" but we don't. So, how is it a "simple polygon"



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
It's simple because all the angles are obtuse.

Bob S


> On Aug 2, 2017, at 08:44 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> But then, as the circle/oval got bigger one would see 360 "sides" but we don't. So, how is it a "simple polygon"


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
WHOOPS! I mean none of the lines intersect.

Bob S


> On Aug 2, 2017, at 08:47 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> It's simple because all the angles are obtuse.
>
> Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
> BR wrote:
>> HH wrote:
>>  A circle is, just like a Bezier curve, a mathematical model, for thinking,
>>  doing mathematics. Not realizable in our virtual world.
>>  What you can have and what you see are (more or less good) approximations
>>  to that model, here nothing more than simple polygons.
>
> But then, as the circle/oval got bigger one would see 360 "sides" but we don't.
> So, how is it a "simple polygon"

Create a new stack and an oval (=circle) of radius 68 or larger and get
the effective points of it (you need to use LC > 6 for that).
Then create a polygon with these points and increase the width and
height of that graphic to card's size. Then you'll see the 360 sides ...

... IF, yes IF the width and height of the circle is 136 or larger.
ELSE the number of lines of the effective points is less than 360.
Probably because Mark is filtering without duplicate lines --- to your
advantage in case you are going to move along these points list.

on mouseUp
  if there is no grc "demo1" then create grc "demo1"
  set style of grc "demo1" to "oval"
  set width of grc "demo1" to 68
  set height of grc "demo1" to 68
  set loc of grc "demo1" to the loc of this card
  if there is no grc "demo2" then create grc "demo2"
  set style of grc "demo2" to the "Polygon"
  put the effective points of grc "demo1" into ep
  put the number of lines of ep
  set the points of grc "demo2" to ep
  set loc of grc "demo2" to the loc of this card
  set width of grc "demo2" to -100+the width of this card
  set height of grc "demo2" to -100+the height of this card
end mouseUp

Of course the graphics library increases the number of points to draw
an oval whenever the width and height increases, also uses antialiasing
to create the "optical illusion" of a circle.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Points of Graphic Oval

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
Actually you don't see "sides" of a regular 360-gon because the engine
uses "trunc()" differing from my "round()" used earlier in this thread.
So the approximation using "round" may be better in case you are scaling
such points lists.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12
Loading...