Hacky, but in a different way
This commit is contained in:
parent
1cb8875053
commit
253a25499b
1 changed files with 12 additions and 6 deletions
|
@ -18,7 +18,7 @@ TEMP_MIN = -40
|
||||||
TEMP_RANGE = TEMP_MAX - TEMP_MIN
|
TEMP_RANGE = TEMP_MAX - TEMP_MIN
|
||||||
TEMP_CENTER = 0 # degrees C
|
TEMP_CENTER = 0 # degrees C
|
||||||
TEMP_STEP = 5
|
TEMP_STEP = 5
|
||||||
TEMP_STEP_COUNT = 16
|
TEMP_STEP_COUNT = math.ceil(TEMP_RANGE / TEMP_STEP)
|
||||||
|
|
||||||
def clamp(value, lowest, highest):
|
def clamp(value, lowest, highest):
|
||||||
if value < lowest:
|
if value < lowest:
|
||||||
|
@ -58,11 +58,6 @@ class SkewT():
|
||||||
cr.rel_line_to(self.width, 0)
|
cr.rel_line_to(self.width, 0)
|
||||||
cr.stroke()
|
cr.stroke()
|
||||||
|
|
||||||
def draw_isotherms(self, cr: cairo.Context, x: float, y: float):
|
|
||||||
cr.set_source_rgba(0.1, 0.5, 0.1, 0.8)
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def skew_t_to_graph(self, x: float, y: float):
|
def skew_t_to_graph(self, x: float, y: float):
|
||||||
return (x+y, y)
|
return (x+y, y)
|
||||||
|
|
||||||
|
@ -72,6 +67,17 @@ class SkewT():
|
||||||
|
|
||||||
return self.skew_t_to_graph(x, y)
|
return self.skew_t_to_graph(x, y)
|
||||||
|
|
||||||
|
def draw_isotherms(self, cr: cairo.Context, x: float, y: float):
|
||||||
|
cr.set_source_rgb(0.99, 0.99, 0.99)
|
||||||
|
|
||||||
|
for temp in range(-150, TEMP_MAX+1, TEMP_STEP):
|
||||||
|
x1, y1 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MAX))
|
||||||
|
x2, y2 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MIN))
|
||||||
|
|
||||||
|
cr.move_to(x1, y1)
|
||||||
|
cr.line_to(x2, y2)
|
||||||
|
cr.stroke()
|
||||||
|
|
||||||
def draw_samples(self,
|
def draw_samples(self,
|
||||||
cr: cairo.Context,
|
cr: cairo.Context,
|
||||||
x: float,
|
x: float,
|
||||||
|
|
Loading…
Add table
Reference in a new issue