Jump to content

Jeb Kerman Drawing!


zekes

Recommended Posts

I didn't realize that it was Zekes until I realized that it was Zekes... :P

Looks good. Better than what I could do, probably.

lol, thanks, I was just freehanding a picture i found of Jeb on the KSPwiki, but it still turned out great.

Link to comment
Share on other sites

Just drew this in Calculus BC today....

Yeah... I can relate to that.

If I could, I would be playing KSP or doing whatever in a few of my classes, namely Spanish and Honors Physics, the first because we hardly do anything and the second because... well, it's physics, and besides heat transfer and stuff like that I've already been introduced to or looked up out of self interest.

Link to comment
Share on other sites

Yeah... I can relate to that.

If I could, I would be playing KSP or doing whatever in a few of my classes, namely Spanish and Honors Physics, the first because we hardly do anything and the second because... well, it's physics, and besides heat transfer and stuff like that I've already been introduced to or looked up out of self interest.

we just took a test on heat transfer :P

Link to comment
Share on other sites

Would you like a time dilation calculator?

#Time Dilation Calculator

import math


c = 299792458 #Speed of light (m/s)

velMessage = "Input Ship Velocity (Percent of c): "
disMessage = "Input Distance (Light-Years): "
timeMessage = "Observer Time: "
shipMessage = "Ship Time: "


while True:

print(velMessage,end = "")
v = float(input())/100

print(disMessage,end = "")
d = float(input())

sTime = d / v
oTime = sTime * ((1-(((v*c)**2)/(c**2)))**(1/2))

print(timeMessage + str(sTime))
print(shipMessage + str(oTime))

ifQuit = input().lower()
if ifQuit == "q":
break

:D

I might try one of these things sometime. (Drawings, I mean.)

Probably going to be something like a plane or a rocket, rather than a Kerbal, because I suck at anything humanoid.

Perhaps based of of this? (It's from Nassault's new movie, Operation Emerald Sunrise [Which is an Eve mission :confused: but makes more sense when you see it.])

6JHHJz2.png

Really, though, how do you get shots like this with Kerbal Space Program?!?! (Probably a better processor than my laptop has :()

Link to comment
Share on other sites

It's programmed in Python. ATM, I have no clue how or if it is possible to convert something like this to a .exe file... but at the time being...

Python Download

Just copy-paste into a new window once you've got the IDLE GUI open.

When you run it it looks like this. Bold areas are inputs.

Input Ship Velocity (Percent of c): 99

Input Distance (Light-Years): 42

Observer Time: 42.42424242424242

Ship Time: 5.984675870161271

I also don't know how to set decimal precision :(

You can get real complicated with Python. Let me present a version of Asteroids:

import pygame, sys, time, math, random
from pygame.locals import *


pygame.init()

windowWidth = 500
windowHeight = 500

windowCenter = int(windowWidth/2),int(windowHeight/2)



##COLORS
BLACK = (0,0,0)
GRAY = (125,125,125)
WHITE = (255,255,255)

RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)

PURPLE = (255,0,255)
TEAL = (0,255,255)
YELLOW = (255,255,0)

LIGHTGREEN = (128,255,128)
font = pygame.font.SysFont('papyrus',20)



##CREATE WINDOW
def makeWindow(Fullscreen,Width,Height):
'''Makes a window'''
global Window1
if Fullscreen == 0:
Window1 = pygame.display.set_mode((Width,Height),0,32)

else:
Window1 = pygame.display.set_mode((Width,Height),pygame.FULLSCREEN)



##UPDATE DISPLAY
def update():
pygame.display.update()



##SURFACE FILL
def fill(Surface,Color):
'''Fills SURFACE with COLOR'''
Surface.fill(Color)


##TEXT DRAW FUNCTION
def drawText(text,font,color,surface,x,y):
textobj=font.render(text,1,color)
textrect=textobj.get_rect()
textrect.topleft=(x,y)
surface.blit(textobj,textrect)



##MOUSE CHECKS/SETS
def get_mousePos():
'''Returns XY Coordinates of the Mouse Cursor'''
x,y = pygame.mouse.get_pos()
return x,y

def set_mousePos(x,y):
'''Sets mouse at XY coordinates'''
pygame.mouse.set_pos(x,y)



##CHECK KEYBOARD/MOUSE
def checkEvents():
global rotating,thrusting,antiThrusting,firing,shipVelocity,rotatingType
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()

if event.key == K_UP:
thrusting = False

if event.key == K_DOWN:
rotatingType = not rotatingType

if event.key == K_LEFT and rotating != -1:
rotating = 2

if event.key == K_RIGHT and rotating != 1:
rotating = 2

if event.type == KEYDOWN:
if event.key == K_LEFT:
rotating = 1

if event.key == K_RIGHT:
rotating = -1

if event.key == K_UP:
thrusting = True

if event.key == K_SPACE:
makeShot(shipVerts,shipCenter,shipRotation,shipVelocity)
#makeNewAsteroid(2,0,shipVerts[0],shipVelocity)






##DELAY FUNCTIONS
def delayS(seconds):
'''Stops program for x seconds'''
time.sleep(seconds)

def delayMS(milliSeconds):
'''Stops program for x milliseconds'''
time.sleep(milliSeconds/1000)



##PYTHON/PYGAME TERMINATION
def terminate():
print("Terminating Pygame and SYS")
pygame.quit()
sys.exit()



##LINE FUNCTIONS
def drawLines(Surface,lineColor,closed,pointlist,thickness):
pygame.draw.lines(Surface,lineColor,closed,pointlist,thickness)

def drawLine(Surface,lineColor,startPoint,endPoint,thickness):
pygame.draw.line(Surface,lineColor,startPoint,endPoint,thickness)



##POLYGON FUNCTION
def drawPolygon(Surface,color,pointlist,width):
pygame.draw.polygon(Surface,color,pointlist,width)

def drawCircle(Surface,color,point,radius,width):
pygame.draw.circle(Surface,color,point,radius,width)

##TRIGONOMETRIC COORDINATES
def trigCoords(centerPoint,angle,radius):
angle *= (math.pi / 180)
XCoord = (centerPoint[0] + (radius*math.cos(angle)))
YCoord = (centerPoint[1] + (radius*math.sin(angle)))
return XCoord,YCoord



##VECTOR FUNCTIONS
def findAngle(vector):
mag = findMag(vector)
if mag > 0:
angle = math.acos(vector[1]/mag)
angle = math.degrees(angle)
return angle
else:
return 0

def findMag(vector):
mag = math.sqrt((vector[0]**2+vector[1]**2))
return mag



##MATRIX FUNCTIONS
def movePoints(pointList,pos):
pointList2 = []
for point in pointList:
point = point[0]+pos[0],point[1]+pos[1]
point = int(point[0]),int(point[1])
pointList2.append(point)

return pointList2

def scalePoints(pointList,scale):
pointList2 = []
for point in pointList:
point = point[0]*scale,point[1]*scale
point = int(point[0]),int(point[1])
pointList2.append(point)

return pointList2


def rotatePoints(pointList,centerPoint,rotation):
pointList2 = []
for point in pointList:
mag = findMag(point)
angle = findAngle(point)

print(point)
print(mag)
print(angle)
print()

newPoint = trigCoords(centerPoint,angle,mag)
print(newPoint)
print()
return pointList2




##ASTEROID DECLARATIONS/FUNCTIONS
asteroidList = []
asteroid_Large00 = [(0,0),(9,-5),(4,-6),(3,-7),(-5,3),(-2,5)]

def makeNewAsteroid(size,ID,pos,vector):
if size == 0: ##Small Asteroids
if ID == 0:
pass
elif ID == 1:
pass
elif ID == 2:
pass

if size == 1: ##Medium Asteroids
if ID == 0:
pass
elif ID == 1:
pass
elif ID == 2:
pass

if size == 2: ##Large Asteroids
if ID == 0:
pointList = asteroid_Large00
elif ID == 1:
pass
elif ID == 2:
pass

newAsteroid = {'Point' : pos,
'Vector' : vector,
'Verts' : pointList
}
asteroidList.append(newAsteroid)

##SHIP DECLARATIONS/FUNCTIONS
shipPoints = [(0,6),(5,-9),(4,-6),(-4,-6),(-5,-9)]
shipCenter = windowCenter
shipRotation = 90
shipRotationRate = 0
shipSize = 15

shipThickness = 2
shipVelocity = 0,0
SHIPCOLOR = WHITE
maxAccel = 0.06
vectorScale = 10 ##FOR DISPLAYING VECTORS!!
thrusting = False
firing = False
rotating = 0
rotatingType = True
rotationRate = 0.075
secondaryRotRate = 3


def findShipVerts(Center,shipRotation,Velocity):
global shipVelocity,shipCenter,shipVerts
if thrusting == True:
makeExaust(shipVerts,shipCenter,shipRotation,0,0)
newVelocity = trigCoords((0,0),shipRotation,maxAccel)
shipVelocity = newVelocity[0]+Velocity[0],Velocity[1]+newVelocity[1]
else:
shipVelocity = Velocity
shipCenter = Center[0] + shipVelocity[0],Center[1]+shipVelocity[1]

shipPoint = trigCoords(shipCenter,shipRotation,shipSize)
shipRight = trigCoords(shipCenter,shipRotation+135,shipSize)
shipLeft = trigCoords(shipCenter,shipRotation+225,shipSize)

shipVerts = [shipPoint,shipRight,shipLeft]
return shipVerts



##PROJECTILE DECLARATIONS/FUNCTIONS
shotList = []
shotSize = 2
shotLife = 90
shotSpeed = 5
shotColor = WHITE

exaustList = []
exaustLife = 7.5
exaustScaleRate = 0.9
exaustSize = 6
exaustSpeed = 1
exaustColor1 = GRAY
exaustInnerColor = WHITE

def makeShot(shipVerts,shipCenter,shipRotation,Velocity):
global shipVelocity
shipPoint = shipVerts[0]
shipPoint = int(shipPoint[0]),int(shipPoint[1])
vector = trigCoords(shipCenter,shipRotation,shotSpeed)
vector = vector[0]-shipCenter[0],vector[1]-shipCenter[1]
newShot = {
'Point': shipPoint,
'Vector': vector,
'Size': shotSize,
'Color': shotColor,
'Life': shotLife
}
shotList.append(newShot)

#shipVelocity = Velocity[0]-(vector[0]/20),Velocity[1]-(vector[1]/20)

def makeExaust(shipVerts,shipCenter,shipRotation,Noise,Type):
exaustPoint = ((shipVerts[1][0]+shipVerts[2][0])/2,(shipVerts[1][1]+shipVerts[2][1])/2)
exaustPoint = int(exaustPoint[0]),int(exaustPoint[1])

vector = trigCoords(shipCenter,180+shipRotation,exaustSpeed)
vector = vector[0]-shipCenter[0]+random.randint(-Noise,Noise),vector[1]-shipCenter[1]+random.randint(-Noise,Noise)

vector1 = trigCoords(shipCenter,90+shipRotation,exaustSpeed)
vector1 = vector1[0]-shipCenter[0]+random.randint(-Noise,Noise),vector1[1]-shipCenter[1]+random.randint(-Noise,Noise)
vector2 = trigCoords(shipCenter,270+shipRotation,exaustSpeed)
vector2 = vector2[0]-shipCenter[0]+random.randint(-Noise,Noise),vector2[1]-shipCenter[1]+random.randint(-Noise,Noise)

if Type == 0:
newShot = {
'Point': exaustPoint,
'Vector': vector,
'Size': exaustSize,
'Color': exaustColor1,
'Color2': exaustInnerColor,
'Life': exaustLife,
'ScaleRate': exaustScaleRate
}
elif Type == 1:
newShot = {
'Point': shipVerts[1],
'Vector': vector1,
'Size': exaustSize/2,
'Color': exaustColor1,
'Color2': exaustInnerColor,
'Life': exaustLife,
'ScaleRate': exaustScaleRate
}
elif Type == 2:
newShot = {
'Point': shipVerts[2],
'Vector': vector2,
'Size': exaustSize/2,
'Color': exaustColor1,
'Color2': exaustInnerColor,
'Life': exaustLife,
'ScaleRate': exaustScaleRate
}
exaustList.append(newShot)

def shipRotate(shipRotationRate,rotatingType,rotating,rotationRate,secondaryRotRate):
if rotatingType == False:
if rotating == 1:
makeExaust(shipVerts,shipCenter,shipRotation,1,2)
shipRotationRate -= rotationRate

elif rotating == -1:
shipRotationRate += rotationRate
makeExaust(shipVerts,shipCenter,shipRotation,1,1)

else:
shipRotationRate /= 1.05

elif rotatingType == True:
if rotating == 1:
shipRotationRate = -secondaryRotRate
makeExaust(shipVerts,shipCenter,shipRotation,1,2)
elif rotating == -1:
shipRotationRate = secondaryRotRate
makeExaust(shipVerts,shipCenter,shipRotation,1,1)
else:
shipRotationRate = 0

return shipRotationRate



def ship_StayWithinBounds(shipCenter):
if shipCenter[0] >= windowWidth:
shipCenter = 5,shipCenter[1]

if shipCenter[0] <= 0:
shipCenter = windowWidth-5,shipCenter[1]

if shipCenter[1] >= windowHeight:
shipCenter = shipCenter[0],5

if shipCenter[1] <= 0:
shipCenter = shipCenter[0],windowHeight-5

return shipCenter



def doShots(shotList):
for shot in shotList:
shot['Life'] -= 1
point = shot['Point']
vector = shot['Vector']
point = point[0]+vector[0],point[1]+vector[1]
point2 = point[0]+vector[0],point[1]+vector[1]
shot['Point'] = point

if shot['Point'][0] >= windowWidth:
shot['Point'] = 5,shot['Point'][1]

if shot['Point'][0] <= 0:
shot['Point'] = windowWidth-5,shot['Point'][1]

if shot['Point'][1] >= windowWidth:
shot['Point'] = shot['Point'][0],5

if shot['Point'][1] <= 0:
shot['Point'] =shot['Point'][0],windowWidth-5

if shot['Life'] <= 0:
shotList.remove(shot)
drawCircle(Window1,shot['Color'],(int(shot['Point'][0]),int(shot['Point'][1])),shot['Size'],shot['Size'])



def doExaust(exaustList):
for part in exaustList:
part['Size'] *= part['ScaleRate']
if part['Size'] <= 1:
part['Size'] = 1
part['Life'] -= 1

point = part['Point']
vector = part['Vector']
point = point[0]+vector[0],point[1]+vector[1]
part['Point'] = point

if part['Point'][0] > windowWidth or part['Point'][0] < 0 or part['Point'][1] < 0 or part['Point'][1] > windowWidth or part['Life'] <= 0:
exaustList.remove(part)


drawCircle(Window1,part['Color'],(int(part['Point'][0]),int(part['Point'][1])),int(part['Size']),int(part['Size']))
drawCircle(Window1,part['Color2'],(int(part['Point'][0]),int(part['Point'][1])),int(part['Size']-1),int(part['Size'])-1)



makeWindow(0,windowWidth,windowHeight)
fill(Window1,BLACK)

shipPoints2 = scalePoints(shipPoints,3)
print(shipPoints2)
shipPoints3 = rotatePoints(shipPoints2,(0,0),0)
print(shipPoints2)
shipPoints2 = movePoints(shipPoints2,windowCenter)

print(shipPoints2)
while True:
fill(Window1,BLACK)
checkEvents()

shipVelocity = shipVelocity[0] / 1.01, shipVelocity[1] / 1.01
shipRotationRate = shipRotate(shipRotationRate,rotatingType,rotating,rotationRate,secondaryRotRate)
shipRotation += shipRotationRate

shipVerts = findShipVerts(shipCenter,shipRotation,shipVelocity)

shipCenter = ship_StayWithinBounds(shipCenter)
doShots(shotList)
doExaust(exaustList)

drawLines(Window1,SHIPCOLOR,1,shipVerts,shipThickness) ##Draw SHIP
##drawLines(Window1,SHIPCOLOR,1,shipPoints2,shipThickness) ##Draw SHIP




## drawLine(Window1,GREEN,shipCenter,(shipCenter[0]+shipVelocity[0]*vectorScale,shipCenter[1]+shipVelocity[1]*vectorScale),2)
## drawLine(Window1,RED,shipCenter,(shipCenter[0]-shipVelocity[0]*vectorScale,shipCenter[1]-shipVelocity[1]*vectorScale),2)
## thrustVector = trigCoords(shipCenter,shipRotation,shipSize)
## drawLine(Window1,BLUE,shipCenter,thrustVector,2)



delayMS(10)
update()

It's still a big WIP, but I've got the vector logic down, and it behaves just like the ship in Asteroids does. Half of the functions don't even work. -_-

(It requires Pygame, which is a graphics library for Python.)

S5myHiq.png

Added some code to "pause" (Really a half-arsed solution which when activated simply stopped updating the screen :P) the display so I could get this screenshot.

Link to comment
Share on other sites

I'm doing orbits and space in physics at the moment so this would be very appropriate for me.

Hohmann transfer calculator for ju?

import math
gParam = (3.5316000) * (10**12)
bodyRadius = 600000


def findDeltaV1(periapsis,apoapsis):
periapsis += bodyRadius
apoapsis += bodyRadius
deltaV = math.sqrt( (gParam) / (periapsis) ) * (math.sqrt( (2 * apoapsis) / (periapsis + apoapsis) )-1)
return deltaV

def findDeltaV2(periapsis,apoapsis):
periapsis += bodyRadius
apoapsis += bodyRadius
deltaV = math.sqrt( (gParam) / (apoapsis) ) * (1 - math.sqrt( (2 * periapsis) / (periapsis + apoapsis) ))
return deltaV

def findVelocity(altitude,periapsis,apoapsis):
altitude += bodyRadius
periapsis += bodyRadius
apoapsis += bodyRadius
velocity = math.sqrt(gParam*((2/altitude)-(1/((periapsis+apoapsis)/2))))
return velocity

def calculateHohmannTransfer(initOrbit,finOrbit):
r1 = initOrbit + bodyRadius
r2 = finOrbit + bodyRadius

deltaV = findDeltaV1(r1,r2) + findDeltaV2(r1,r2)
return deltaV

print(calculateHohmannTransfer(-200000,85000))

print(calculateHohmannTransfer(-200000,85000))

The first parameter is the altitude of your initial orbit, the second is, well, the second altitude.

Right now it is tuned for Kerbin. Just adjust the bodyRadius and gParam variables to Earth's.

I never finished this one, but it works as-is good enough. Only the User Interface would need work. (In fact, it is literally nonexistent. :wink:)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...