ftp.nice.ch/pub/next/graphics/3d/geomview.1.4.1.s.tar.gz#/Geomview/src/lib/gprim/bbox/bboxcreate.c

This is bboxcreate.c in view mode; [Download] [Up]

/* Copyright (c) 1992 The Geometry Center; University of Minnesota
   1300 South Second Street;  Minneapolis, MN  55454, USA;
   
This file is part of geomview/OOGL. geomview/OOGL is free software;
you can redistribute it and/or modify it only under the terms given in
the file COPYING, which you should have received along with this file.
This and other related software may be obtained via anonymous ftp from
geom.umn.edu; email: software@geom.umn.edu. */
static char *copyright = "Copyright (C) 1992 The Geometry Center";

/* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */

#include "bboxP.h"
#include "appearance.h"

/*--------------------------------------------------------------------------
 * Function:	BBoxCreate
 * Description: creates or edits a bounding box
 * Args:	BBox *exist: existing bbox to be edited, if using editing.
 *				NULL otherwise.
 *		GeomClass *classp: 
 *		a_list: List of option type - option pairs.  Option types
 *			are specified by integers, with 0 signifying end of
 *			list.
 * Returns:	Pointer to BBox created or edited.
 */

BBox *
BBoxCreate (exist, classp, a_list)
BBox *exist;
GeomClass *classp;
va_list a_list;
{
    register BBox *bbox;
    int attr, copy = 1, fourd = 0;

    if (exist == NULL) {
	bbox = OOGLNewE(BBox, "BBoxCreate BBox");
	bbox->flag = BBOX_P;
        GGeomInit (bbox, classp, BBOXMAGIC, NULL);
    } else {
	/* Check that exist is in fact a BBox. */
	bbox = exist;
    }

    while (attr = va_arg (a_list, int)) switch (attr) {
	case CR_FLAG:
	    bbox->flag = va_arg (a_list, int );
	    break;
	case CR_MIN:
	    Pt3ToPt4(va_arg(a_list, Point3 *), &bbox->min, 1);
	    break;
	case CR_MAX:
	    Pt3ToPt4(va_arg(a_list, Point3 *), &bbox->max, 1);
	    break;
	case CR_4MIN:
	    bbox->min = *va_arg(a_list, HPoint3 *);
	    bbox->geomflags |= VERT_4D;
	    break;
	case CR_4MAX:
	    bbox->max = *va_arg(a_list, HPoint3 *);
	    bbox->geomflags |= VERT_4D;
	    break;
	default:
	    if (GeomDecorate (bbox, &copy, attr, &a_list)) {
		OOGLError (0, "BBoxCreate: Undefined attribute: %d", attr);
		OOGLFree (bbox);
		return NULL;
	    }
    }

    if (exist != NULL) return exist;
    
    return (bbox);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.