public static void RenderPlane(this WorldView world, Vector3 position, Vector3 normal, MatterHackers.Agg.Color color, bool doDepthTest, double rectSize, double lineWidth) { var clipping = world.GetClippingFrustum(); // get any perpendicular to the normal (we call it x to make it clear where to apply it) var perpendicularX = normal.GetPerpendicular().GetNormal() * rectSize; // get a second perpendicular that is perpendicular to both var perpendicularY = Vector3.GetPerpendicular(normal, perpendicularX).GetNormal() * rectSize; // the top line world.Render3DLine(clipping, position - perpendicularX + perpendicularY, position + perpendicularX + perpendicularY, color, doDepthTest, lineWidth); // the bottom line world.Render3DLine(clipping, position - perpendicularX - perpendicularY, position + perpendicularX - perpendicularY, color, doDepthTest, lineWidth); // the left line world.Render3DLine(clipping, position - perpendicularX - perpendicularY, position - perpendicularX + perpendicularY, color, doDepthTest, lineWidth); // the right line world.Render3DLine(clipping, position + perpendicularX - perpendicularY, position + perpendicularX + perpendicularY, color, doDepthTest, lineWidth); }