Skip to content

Completed 2d Line Function for In Class Exercise #11

@aris134

Description

@aris134

def find_eqn_2d_line(input_coords):
# INPUT: [(x1, y1), (x2, y2)]
# OUTPUT: m = slope, b = y-intercept
m = (input_coords[1][1] - input_coords[0][1]) / (input_coords[1][0] - input_coords[0][0])
b = input_coords[0][1] - m * input_coords[0][0]
return (m, b)
def find_y_from_x(input_line_x):
# INPUT: m, b, x
# OUTPUT: y = m*x + b
y = input_line_x[0]*input_line_x[2] + input_line_x[1]
return y

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions