[RESOLVED] Dividing a circle
Hi there!
I’m having big trouble trying to design some stimuli for a visual experiment. Mainly because programming (and maths) is not my strong point, plus I’m not even sure if VB can do what I need…
Anyways, I’ve managed to draw a centred circle with specific parameters and a fixation point in the middle, but what I now need is to divide it into 6 equal parts by passing a line through each equally spaced point and the centre. While I know how to do that with a protractor on a piece of paper, I have no clue how to do it in code :confused: And it pains me to think this is just the simplest manipulation I need to do in order to draw this stimulus. I’m trying to take it one step at a time and figure out as much as I can on my own, but unfortunately time is against me :cry:. I’d appreciate any help, suggestions, advice… Thank you all!
PS: I’m using VB 6.0 and only have basic beginner knowledge.
Re: [RESOLVED] Dividing a circle
Ok, here I am some time later to continue my potentially annoying monologue... I realised my mistake is in declaring variables as Integers when clearly they are NOT whole numbers... duh! When I switch to Double it all works fine :bigyello:
I'm really sorry and kind of ashamed :blush:, I promise next time I'll give it at least 24 hours before I post something :P
:wave:
Re: [RESOLVED] Dividing a circle
If you don't want to bother with the trig-functions, the coordinates for the regular unit-hexagon with center (0, 0) are:
{ (1, 0), (0.5, sqrt(3/4)), (-0.5, sqrt(3/4)), (-1, 0), (-0.5, -sqrt(3/4)), (0.5, -sqrt(3/4)) }
Re: [RESOLVED] Dividing a circle
Ah, yes! That would be quite helpful because although I've managed to centre the circles, they're still not equally spaced :(
However... I'm not sure how to draw a hexagon... I mean, what kind of argument do you use to input these coordinates? I'd be great if there was a Me.Hexagon option, but I sense it's bound to be more to it and I don't seem to be able to figure it out :o
Oh! And of course, thank you very much for the suggestion!
Re: [RESOLVED] Dividing a circle
Quote:
Originally Posted by
Pine_Apple
......they're still not equally spaced :(
As I see it, the coordinates you are using are correct, you are already using the same coordinates as Pine_Apple suggested, although you do compute them using Cos and Sin.
Your point x;y uses Cos(2Pi) and Sin(2Pi) which are 1 and 0
your point x1;y1 uses Cos(Pi/3) and Sin(Pi/3) which are 0.5 and Sqrt(3/4) or better 0.86666..
etc...
So, why do you think your points (which form a hexagon, although "you can't draw it") are not equally spaced?
Re: [RESOLVED] Dividing a circle
Quote:
Originally Posted by
opus
So, why do you think your points (which form a hexagon, although "you can't draw it") are not equally spaced?
Yeah... it makes no sense for them to not be spaced equally cause the coordinates are correct, I'm sure of that! However, they aren't! In the end I actually measured them manually by placing a protractor on the monitor (oh yes, I went there!) and it turned out the first angle was 62 instead of 60, and then next proportion was 58 :ehh: So everything was off by approximately 2 degrees. No idea why... so I 'cheated' by centering the small circles at 59, 121, 239 and 301 degrees. This almost corrected for it. It seems fine now...
Re: [RESOLVED] Dividing a circle
As I see it, the only place that the error can arise is due to your approximation of Pi with 3.142.
Pi represented as a double is actually 3,14159265358979.
Re: [RESOLVED] Dividing a circle
Yeah, I thought so too! But it didn't make any difference :sick: There must be something fundamentally wrong with the scales because I also just noticed that the centimetre measurements are not accurate either... e.g. I set diameters of 1.28 and and 7.02, instead it generates them as 1.6 and 8.7 (approximately). Well... I don't think I can do anything about that but bite the bullet and somehow try to work around it :(
Thanks for the help and tips!
Edition: Oups.. I messed up those values a bit, that's not exactly how they turned out, but it doesn't matter cause the fact is that the centimetre measurements are not accurate.
Re: [RESOLVED] Dividing a circle
Rrrright! As embarrassing as this is... I have finally realised what the issue is... :blush: The resolution of the screen!!! :eek2: It's fixed now and everything corresponds to the correct measurements as it should have on the first place! What a relief!! :p