vpWindowPHIGS(3)

๐Ÿ“ฆ version 1.0c7, in fedora 43, fedora 44

๐Ÿ’– vpWindowPHIGS ๐Ÿ’–

okay bestie, so this is a page from the VolPack library functions manual โ€” that's the VolPack(3) manual, section 3, library functions. pull up a chair ๐Ÿซถ


โœจ NAME โœจ

vpWindowPHIGS โ€” multiply the projection matrix by a PHIGS viewing matrix

it's giving "glow up your projection matrix with a whole PHIGS viewing model" and honestly? iconic ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <volpack.h>

vpResult
vpWindowPHIGS(vpc, vrp, vpn, vup, prp, umin, umax, vmin, vmax, front,
        back, projection_type)
    vpContext *vpc;
    vpVector3 vrp, vpn, vup;
    vpVector3 prp;
    double umin, umax, vmin, vmax, front, back;
    int projection_type;

๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • vpc โ€” the VolPack context, and yes it comes straight from vpCreateContext. no context, no vibes ๐Ÿ˜Œ
  • vrp โ€” point that specifies the view reference point.
  • vpn โ€” vector specifying the view plane normal.
  • vup โ€” vector specifying the view up vector.
  • prp โ€” point specifying the projection reference point, and it lives in view reference coordinates.
  • umin โ€” left coordinate of the clipping window (in view reference coordinates).
  • umax โ€” right coordinate of the clipping window (in view reference coordinates).
  • vmin โ€” bottom coordinate of the clipping window (in view reference coordinates).
  • vmax โ€” top coordinate of the clipping window (in view reference coordinates).
  • front โ€” coordinate of the near depth clipping plane (in view reference coordinates).
  • back โ€” coordinate of the far depth clipping plane (in view reference coordinates).
  • projection_type โ€” the projection type code. and listen, currently it must be VP_PARALLEL. that's the whole menu, bestie ๐Ÿ“

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

so vpWindowPHIGS takes your current projection matrix and multiplies it by a viewing-and-projection matrix that you spec out using the PHIGS viewing model. that model bundles the viewpoint, the projection and the clipping parameters all into one glow-up โœจ the resulting matrix gets stored in the projection transformation matrix.

and here's the thing โ€” since the view and the projection both live in this one single matrix, you'd normally not use the view transformation matrix alongside vpWindowPHIGS. set it to the identity, periodt. right now only parallel projections are allowed. if you want a different view specification model, go see vpWindow(3).

okay so assuming the view transformation matrix is the identity, the matrix vpWindowPHIGS spits out should transform world coordinates into clip coordinates. here's how that transformation gets specified:

first, the projection plane (aka the view plane) is defined by a point on the plane โ€” that's the view reference point, vrp โ€” and a vector normal to the plane, which is the view plane normal, vpn. ๐Ÿฆ‹

next, a coordinate system called the view reference coordinate (VRC) system is specified using the view plane normal and the view up vector, vup. the origin of VRC coordinates is the view reference point. and the basis vectors of VRC coordinates are:

u = v cross n
v = the projection of vup parallel to vpn onto the view plane
n = vpn

this coordinate system is what you use to specify the direction of projection and the clipping window. ๐Ÿ“

the clipping window bounds in the projection plane are given by umin, umax, vmin and vmax. the direction of projection is the vector going from the center of the clipping window to the projection reference point (prp) โ€” and prp is also specified in VRC coordinates. finally, the front and back clipping planes are given by n=front and n=back in VRC coordinates. ๐Ÿ’€ it's a lot but you're doing amazing, keep going.

for a more detailed explanation of this view specification model, go read Computer Graphics: Principles and Practice by Foley, vanDam, Feiner and Hughes. study material, bestie ๐Ÿ“š

๐Ÿ”ฎ STATE VARIABLES ๐Ÿ”ฎ

you can retrieve the current matrix concatenation parameters with the following state variable codes (peep vpGeti(3)):

  • VP_CONCAT_MODE

๐Ÿšจ ERRORS ๐Ÿšจ

the normal return value is VP_OK. ๐Ÿ’š the following error return values are possible though, so brace yourself:

  • VPERROR_BAD_VALUE โ€” the clipping plane coordinates are invalid (umin >= umax, etc.). the math said no ๐Ÿ™ˆ
  • VPERROR_BAD_OPTION โ€” the type argument is invalid.
  • VPERROR_SINGULAR โ€” the vectors defining view reference coordinates are not mutually orthogonal, or the projection reference point lies in the view plane. it's giving collapse ๐Ÿ˜ญ

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


and that's the whole page, bestie ๐Ÿซถ this came out of the VolPack library manual, vpWindowPHIGS(3), and yeah โ€” that's the source and the version right there. no date on this one, so we're just repping VolPack itself ๐Ÿ’– go forth and multiply those matrices, you absolute legend โญ๐Ÿงš๐Ÿ’œ

๐Ÿ“ฆ where this page comes from