Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pivot Point
#1
[Image: DIAGRAM.gif]

How would i ahev line 'A' pivot on point 'B' to touch semicircle 'C'?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
for loop use cirlce with radians. or draw part of a circle with cos and sin
Reply
#3
Quote:for loop use cirlce with radians. or draw part of a circle with cos and sin
huh?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#4
Code:
pi! = atn(1) * 4
cx! = 160 ' Center X
cy! = 100 ' Center Y
r! = 20 ' Radius
angle! = 180
theta! = angle! * pi! / 180

LINE (cx, cy)-(cos(theta!) * r! + cx!, sin(theta!) * r! + cy!)
in general:

when you have a radian (angle from 0 to the circumferance of a unit circle, a unit circle having a radius of one, 2 * pi), a cosine (cos) returns the x length of a line in that direction with a lenght of 1. the sine (sin) returns the y height of that line. So if you multiply that figure by the radius, you will get the x and y components for a line of r length (r being the radius).

oh yeah, and for pivoting, just thange angle!, which goes from 0 to 359 (starting from the right and going counter clockwise). Making this value higher will make the line move counter clockwise.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#5
thanks Smile
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
if you dint get that this may help
Code:
SCREEN 13
CONST rad = (3.141592654# / 180)
FOR i = 0 TO 360
x = (COS(i * rad) * 10) + 100
y = (SIN(i * rad) * 10) + 100
LINE (100, 100)-(x, y), 15
NEXT
Reply
#7
That example will draw a large amount of lines from (100,100) to a point on the circle.

Let's see:
Code:
'$DYNAMIC
DEFINT A-Z

SCREEN 13

' this draws:
'- Line B
'- Semicircle C
' r^2=x^2 + y^2
' r=50
' y = SQR(r^2-x^2)
oldY = 0
height = 0
FOR x = -50 TO 50
   y = -INT(SQR(r^2-x^2))
   IF x = 0 THEN height = y
   IF x > -50 THEN LINE (x - 1 + 160, oldY + 100) - (x + 160, y + 100), 1
   oldY = y
NEXT x
LINE (110,100)-(210,100), 2

' this draws:
'- Line A pivot on Line B and touching C
LINE (160,100)-(160,100+height), 3

Done by heart, hope there aren't any bugs in it. And I hope you can do something with it! Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)