I will interpret an equal zoom value as meaning the shape will appear to be the same size in each zoom mode. Since, in perspective, the apparent size of the portions of the shape will depend on their distance from the camera, this "equal zoom" can only be achieved at a particular depth within the shape.
Let's assume you want the portion of the shape closest to the camera to appear equal in the two view modes.
To produce an equivalent orthographic view from the perspective view, first calculate the width and height of the view frustum at the closest point of the shape.
width = tan(fovX) * distance
height = tan (fovY) * distance
where distance
is the distance from the camera to the closest point on the shape and fovX, fovY
are the horizontal and vertical angles of the field of view in perspective mode.
You can then set the orthographic view rectangle to 0,0,width,height
, assuming you center the camera on the shape.
To produce an equivalent perspective view from an orthographic view, just invert the equation:
distance = width / tan(fovX)
or
distance = height / tan(fovY)
Then set the z value of your camera to the closest point on the object - distance
, assuming you are looking down the positive z axis. If your camera is always at the origin, you can set the z value of the object such that its closest point's z value is equal to distance.