Squares

General FreeBASIC programming questions.
caseih
Posts: 1198
Joined: Feb 26, 2007 5:32

Re: Squares

Postby caseih » May 08, 2018 2:48

albert wrote:There is no accretion disk!!
Just last year an accretion disk around a very young star was imaged for the first time. https://phys.org/news/2017-04-image-acc ... -star.html

This discovery seems to hold up the accretion disk theory very well.
dodicat
Posts: 4879
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » May 08, 2018 9:30

That (stuff in space) link by badidea was cheating IMHO, it only showed a glimpse of the actual orbits if the mouse hovered over a particular satellite.
It should have shown the actual orbits and not have them all orbiting the same way.
But maybe that would be a real clutter.
Anyway, in the same spirit, here is definitive proof that orbits can be around any axis in any direction.
This is a brief look at goings on a long time ago (many moons), in a remote part of the universe.

Code: Select all





Type AxialAngle
    As Single Sin,Cos
End Type

Type v3
    As Single x,y,z
    ' As Ulong colour'unused here
End Type

Type satellite
    As v3 position
    As Single speed
    As v3 axis
    As Long rad
    As Ulong colour
    as string name
End Type

declare function main() as long  ''RUN
end main

Function cross(v1 As v3,v2 As v3) As v3       'cross product
    Return Type<v3>(v1.y*v2.z-v2.y*v1.z,-(v1.x*v2.z-v2.x*v1.z),v1.x*v2.y-v2.x*v1.y)
End Function

Function shortline(fp As v3,p As v3,length As Long) As v3
    Dim As Single diffx=p.x-fp.x,diffy=p.y-fp.y,diffz=p.z-fp.z
    Dim As Single L=Sqr(diffx*diffx+diffy*diffy+diffz*diffz)
    Return Type<v3>(fp.x+length*diffx/L,fp.y+length*diffy/L,fp.z+length*diffz/L)
End Function

Function setAxialangle(angle As Single) As AxialAngle
    Return Type(Sin(angle),Cos(angle))
End Function

Function normalize(v As V3) As V3
    Dim As Single L= Sqr(v.x*v.x+v.y*v.y+v.z*v.z)
    Return Type(v.x/L,v.y/L,v.z/L)
End Function

Function AxialRotate(centre As v3,Pt As V3,Angle As AxialAngle,norm As v3,T As Single=1) Byref  As v3
    #define crossP(v1,v2,N) Type<v3>( N*(v1.y*v2.z-v2.y*v1.z),N*(-(v1.x*v2.z-v2.x*v1.z)),N*(v1.x*v2.y-v2.x*v1.y))
    #define plus(v1,v2) Type<v3>(v1.x+v2.x,v1.y+v2.y,v1.z+v2.z)
    #define dotP(v1,v2) (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z)
    #define mlt(f,v1) type<v3>(f*v1.x,f*v1.y,f*v1.z)
    Static As v3 result
    Dim As V3 V=Type(T*(Pt.x-centre.x),T*(Pt.y-centre.y),T*(Pt.z-centre.z))
    Dim As V3 T1=crossP(norm,V,Angle.sin)
    Dim As Single tmpS=dotP(Norm,V)
    Dim As V3 tmpV=mlt(tmpS,norm)
    tmpV=mlt((1-Angle.cos),tmpV)
    T1=plus(T1,tmpV)
    Dim As V3 tt=mlt(Angle.cos,V)
    result=plus(tt,T1)
    result=plus(result,centre)
    'result.colour=Pt.colour
    Return result
End Function

Function perspective(p As V3,eyepoint As V3) As V3
    Dim As Single   w=1+(p.z/eyepoint.z)
    Return Type((p.x-eyepoint.x)/w+eyepoint.x,_
    (p.y-eyepoint.y)/w+eyepoint.y,_
    (p.z-eyepoint.z)/w+eyepoint.z)
End Function

Sub Qsort(array() As satellite,begin As Long,Finish As Long)
    Dim As Long i=begin,j=finish
    Dim As V3 x =array(((I+J)\2)).position
    While I <= J
        While array(I).position.z > X .z:I+=1:Wend
            While array(J).position.z < X .z:J-=1:Wend
                If I<=J Then Swap array(I),array(J): I+=1:J-=1
            Wend
            If J >begin Then Qsort(array(),begin,J)
            If I <Finish Then Qsort(array(),I,Finish)
        End Sub
       
        Sub setsatellites(s() As satellite,x As Long,y As Long)
            For n As Long= Lbound(s) To Ubound(s)
                With s(n)
                    .axis=Type(Rnd-Rnd,Rnd-Rnd,Rnd-Rnd)
                    .axis=normalize(.axis)
                    Dim As v3 c=cross(.axis,Type(0,1,0))
                    c.x=x/2+c.x:c.y=y/2+c.y
                    Var z=150+Rnd*200
                    Dim As v3 p=shortline(Type(x/2,y/2,0),Type(c.x,c.y,c.z),z)
                    .position=p
                    .speed=200/(z)
                    .rad=1
                    .colour=Rgb(100+Rnd*155,100+Rnd*155,100+Rnd*155)
                    .name="Orbit speed  " + str(int(.speed*100))
                End With
                s(Ubound(s)).position=Type(x/2,y/2,0)
                s(Ubound(s)).rad=100
                s(Ubound(s)).colour=Rgb(0,0,250)
                s(Ubound(s)).name="Planet Soylent Blue"
            Next n
        End Sub
       
        Sub ORB(cx As Long,_  'CENTRES
            cy As Long,_
            radius As Long,_
            c As Ulong,_  'COLOUR
            offsetX As Single=0,_ 'Bright spot (0 to about .9)
            offsetY As Single=0,_
            e As Single=0,_        'eccentricity
            resolution As Long=32,_  'number of circles drawn
            im As Any Pointer=0)
            #define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
            Dim As Single ox,oy,nx,ny
            ox=cx+offsetX*radius
            oy=cy+offsetY*radius
            Dim As Ubyte red=Cptr(Ubyte Ptr,@c)[2]
            Dim As Ubyte green=Cptr(Ubyte Ptr,@c)[1]
            Dim As Ubyte blue=Cptr(Ubyte Ptr,@c)[0]
            For d As Single = radius To 0 Step -radius/resolution
                nx=(cx-ox)*(d-radius)/radius + cx 'linear mappings for moving centre
                ny=(cy-oy)*(d-radius)/radius + cy
                Var f=map(radius,0,d,.3,1)
                Circle im,(nx,ny),d,Rgb(f*red,f*green,f*blue),,,e,F
            Next d
        End Sub
       
        Sub show(s As satellite,x As Long,y As Long,i As Any Ptr=0,E As Any Ptr)
            #define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
            Var rad=map(-300,300,s.position.z,12,3)
            orb(s.position.x,s.position.y,rad+s.rad,s.colour,0,0,0)
            Pset i,(s.position.x,s.position.y),Rgb(50,50,50)
            If s.position.z<0 Then  Pset E,(s.position.x,s.position.y),Rgb(50,50,50)
        End Sub
       
        Sub move(s As satellite,Byref rot As satellite,x As Long,y As Long)
            Static As Single a
            a+=.001
            rot=s
            Dim As AxialAngle Aa=setAxialAngle((s.speed*a)/1)
            rot.position=AxialRotate(Type(x/2,y/2,0),s.position,Aa,s.Axis)
        End Sub
       
        Function Regulate(Byval MyFps As Long,Byref fps As Long) As Long
            Static As Double timervalue,_lastsleeptime,t3,frames
            frames+=1
            If (Timer-t3)>=1 Then t3=Timer:fps=frames:frames=0
            Var sleeptime=_lastsleeptime+((1/myfps)-Timer+timervalue)*1000
            If sleeptime<1 Then sleeptime=1
            _lastsleeptime=sleeptime
            timervalue=Timer
            Return sleeptime
        End Function
   
      function main() as long 
           #define incircle(cx,cy,radius,x,y) (cx-x)*(cx-x) +(cy-y)*(cy-y)<= radius*radius
        Screen 20,32
       
        Dim As Integer x,y
        Screeninfo x,y
        Dim As Any Ptr im=Imagecreate(x,y),E =Imagecreate(x,y)
        Dim As satellite s(1 To 10)
        Dim As satellite rot(1 To 10)
        setsatellites(s(),x,y)
       
        Dim As Long fps
        dim as long mx,my
        Do
            getmouse mx,my
            For n As Long=Lbound(s) To Ubound(s)
                move(s(n),rot(n),x,y)
            Next
            Qsort(rot(),Lbound(rot),Ubound(rot))
            Screenlock
            Cls
            draw string (20,20),"FPS = " &fps
            Put(0,0),im,trans
            For n As Long=Lbound(s) To Ubound(s)
                rot(n).position=perspective(rot(n).position,Type(x/2,y/2,800))
                show(rot(n),x,y,im,E)
                if incircle( rot(n).position.x, rot(n).position.y,50,mx,my) then
                    draw string( rot(n).position.x, rot(n).position.y),rot(n).name
                    end if
            Next
            Put(0,0),E,trans
            Screenunlock
            Sleep regulate(60,fps),1
           
        Loop Until Len(Inkey)
        Imagedestroy im
        Imagedestroy E
        return 0
        end function
       
       
       
       
         
lizard
Posts: 380
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Squares

Postby lizard » May 08, 2018 12:20

dodicat wrote:That (stuff in space) link by badidea was cheating IMHO, it only showed a glimpse of the actual orbits if the mouse hovered over a particular satellite.
It should have shown the actual orbits and not have them all orbiting the same way.

Again a wonderful demo!
albert
Posts: 4235
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » May 08, 2018 15:28

@caseih

That "accretion disk" picture is made with the GIMP , it's not a photo-graph ...
albert
Posts: 4235
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » May 08, 2018 16:27

@Dodicat

Nice orbit animation!!

You should be able to get zero g's , inside of earths atmosphere , but you'd need to go over 50 miles a second.
You have to get up to the speed of the ether at a certain altitude.

The formula = (moons distance (in miles) x moons speed (in MPH) ) / ( circumference of altitude (in miles) ) = MPH , you need to go to get zero g's
caseih
Posts: 1198
Joined: Feb 26, 2007 5:32

Re: Squares

Postby caseih » May 08, 2018 17:25

albert wrote:@caseih

That "accretion disk" picture is made with the GIMP , it's not a photo-graph ...

Nope. You obviously didn't get past the first teaser picture, which was merely an artist's representation, and frankly not a good one at that. And clearly didn't read anything that was written in that article because you dismissed the entire thing out of hand, which is unfortunate. Nor do you seem to understand what "imaging" means. Data was collected on a variety of wavelengths from several different telescopes, and combined and analyzed in various ways to give us a pretty unmistakable and very real view of what's going on around this star.
albert
Posts: 4235
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » May 08, 2018 18:33

@caseih

Yeah I read the article...
The picture was created with the GIMP ( "G"NU "I"mage "M"anipulation "P"rogram) , I recognize the artwork...

A star has no mantle layer, so it can't exhaust molecules, only protons and neutrons and particles created in the outer core.
It might be possible for the protons and neutrons coming out of a solar explosion , to bond into heavier atoms than hydrogen.

The article seemed to say:
The accretion disk just happened , and the core became a sun , and the orbital soup around it , would or had formed into planets and moons.

I don't see how the orbital soup around the sun, would start to spin , and wind up to become a core??
Unless theres an ether and the ethers spirals , begin the winding up process.
caseih
Posts: 1198
Joined: Feb 26, 2007 5:32

Re: Squares

Postby caseih » May 08, 2018 18:47

albert wrote:The picture was created with the GIMP ( "G"NU "I"mage "M"anipulation "P"rogram) , I recognize the artwork...
Are you sure it wasn't Photoshop, or more likely Adobe Illustrator? Like I said the first image was created as a work of art. The actual image was below, and was a composite of different wavelengths and false colors. That was certainly not "made" by Gimp or Photoshop!
dodicat
Posts: 4879
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » May 08, 2018 21:06

I really think that physicists should not be adding their names to these -- another star is born fantasies.
They are diluting their chosen field with fiction, and physics is supposed to be one of the most exact empirical sciences.
Photoshop being used as a tool in physics is the thin edge of some inclined plane IMO.
There are astronomers and astrologers to tackle the cosmos, let them make their bloomers and fodder for movies and documentaries.
Let the physicists and engineers design and build the vessels for exploration, as the marine architects and shipbuilders did the last time round.
I cannot imagine a shipbuilder of old banging rivets into some mighty hull, and daydreaming about sea serpents and gigantic squid. But I could be wrong of course.
albert
Posts: 4235
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » May 09, 2018 17:10

@caseih

My ether theory:

The ether spiraling into the star would spawn particles in the various radius's ,
but the spawned particles forming into atoms and molecules would be cool, not glowing hot. ( like the asteroid belt.)

I didn't see anything in the article about the temps of the accretion disk.

I suppose that a big enough , volcano like explosion , could exhaust solar atoms out to great distances , that then become a glowing hot accretion disk?
caseih
Posts: 1198
Joined: Feb 26, 2007 5:32

Re: Squares

Postby caseih » May 10, 2018 2:23

albert wrote:I didn't see anything in the article about the temps of the accretion disk.
That's funny because one of the graphics was a 3d plot of temperature.
dodicat
Posts: 4879
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » May 10, 2018 11:27

The phys.org site is actually very interesting.
Not the starry eyed stuff for me, but a browse through the site has some good topics.
albert
Posts: 4235
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » May 12, 2018 0:01

Richard wrote:
Albert wrote:Just the fact that you can't orbit backwards should be proof of an ether.
You have to orbit going to the east. you can't orbit going to the west..( unless you power through the entire orbit.)
Same way with the sun, you have to orbit the way the planets all orbit.
Now you are just being silly.
Even without the ether it is still cheaper to launch towards the East as you get a 1000 mph advantage due to Earth rotation. If you launch West you do not get the first 1000 mph for free, you have to buy fuel for that extra 1000 mph, then you must buy another 1000 mph to get to the orbital speed you would have with an Easterly launch. That makes a launch to the West 2000 mph more expensive than a launch to the East. You still orbit the Earth at the same speed relative to the Sun and Stars, but the satellite appears to travel much faster when viewed from the rotating Earth's surface, and so it is more difficult to track, just when you need tracking most, because;


With gravity? ,
How does rotation of a body affect its gravity, which is caused by mass alone..
The body rotating at 1000 rpm , should have the same gravity as that same body rotating a 1 rpm..
Unless theres an ether and the bodies spin creates the gravity. Then the two bodies gravities would differ..
caseih
Posts: 1198
Joined: Feb 26, 2007 5:32

Re: Squares

Postby caseih » May 12, 2018 4:24

The gravitational attraction of a mass is not affected at all by it's rotation. But when launching into orbit from the surface of the Earth one has to take rotation into account because it's a part of the velocity needed to achieve orbit. If you were launching from the center of the Earth's point mass, or if the earth were not spinning, it wouldn't matter what direction you launched: you'd have to provide 100% of the velocity for orbit from your own fuel. But at the earth's surface we have a certain speed imparted to us because we're standing on the spinning surface of the earth, and we can borrow that energy (from the Earth's momentum) to help us attain orbit at a slightly lower cost if we aim to the east.
Richard
Posts: 2816
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Postby Richard » May 12, 2018 5:55

I agree with caseih. Here is my reasoning.

Once a satellite is in orbit, rotation of the body it orbits is not relevant. The satellite orbital velocity is measured about the centre of mass of the body it orbits, referenced to a frame locked to the fixed stars.

Low down, the atmosphere is thick and prohibits high speeds, so the first move must be to lift upwards into thinner atmosphere before beginning to accelerate more in the orbital direction.

In low orbit, a satellite must travel very fast. The orbital speed needed to remain in orbit is lower for higher orbits, because as the distance from the centre of the Earth increases the gravitational attraction falls.

A rocket must lift a satellite to a height where the horizontal component of the rocket velocity matches the orbital velocity required at that height. The satellite can then be released while the rocket and empty fuel tanks can be abandoned.

So to reach orbit you must go from a point on a rotating Earth reference frame, to orbit Earth with a velocity measured relative to a reference frame fixed to the stars.

Because Earth is rotating, a rocket standing on the Equator before a launch, is already travelling towards the East at over 1000 mph about the centre of the Earth, referenced to the stars. So you save most fuel if you take advantage of your initial 1000 mph velocity by launching towards the East, from near the Equator.

You have then invested your fuel energy and are committed to remain in an orbit towards the East.

Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests