Woodstock94
Woodstock94

Reputation: 196

Python: given a plane equation draw a subset of points that belong to it

As the title say, let's assume I have a plane equation:

ax+by+cz=d (e.g. -4x + 5y + 9z = -9)

I want to draw n random points (let's say 500) that belong to that plane. Can somebody help me with that?

I saw that from mpl_toolkits import mplot3d has the function plot_surface(x,y,z) but (as it says) it plots the surface equation and this is not what I need.

Any help is really appreciated.

Upvotes: 1

Views: 800

Answers (1)

6502
6502

Reputation: 114599

For a plane a simple approach that would work is

  1. pick a coefficient that's not 0 (let's suppose is c)
  2. pick random values for the other two coordinates (x and y in this case)
  3. compute z with (d - ax - by)/c

Upvotes: 1

Related Questions