2019-03-23 00:58:47 +01:00
|
|
|
// ************************************************************************
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// Copyright (c) 1995-2002 Juniper Networks, Inc. All rights reserved.
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// Permission is hereby granted, without written agreement and without
|
|
|
|
|
// license or royalty fees, to use, copy, modify, and distribute this
|
|
|
|
|
// software and its documentation for any purpose, provided that the
|
|
|
|
|
// above copyright notice and the following three paragraphs appear in
|
|
|
|
|
// all copies of this software.
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// IN NO EVENT SHALL JUNIPER NETWORKS, INC. BE LIABLE TO ANY PARTY FOR
|
|
|
|
|
// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
|
|
|
|
|
// JUNIPER NETWORKS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
|
// DAMAGE.
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// JUNIPER NETWORKS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
|
|
|
|
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
|
|
|
|
// NON-INFRINGEMENT.
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND JUNIPER
|
|
|
|
|
// NETWORKS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
|
|
|
|
|
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
2020-05-23 23:13:14 +02:00
|
|
|
//
|
2019-03-23 00:58:47 +01:00
|
|
|
// ************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* bpUtils.c --
|
|
|
|
|
*
|
|
|
|
|
* shared low-level routines for this module.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "utils/utils.h"
|
|
|
|
|
#include "database/database.h"
|
|
|
|
|
#include "utils/geometry.h"
|
|
|
|
|
#include "bplane/bplaneInt.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
* bpRectDim --
|
|
|
|
|
*
|
|
|
|
|
* return dimension of rectangle in xDir
|
|
|
|
|
*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
2020-05-23 23:13:14 +02:00
|
|
|
*/
|
2019-03-23 00:58:47 +01:00
|
|
|
int bpRectDim(Rect *r, bool xDir)
|
|
|
|
|
{
|
|
|
|
|
return xDir ? r->r_xtop - r->r_xbot : r->r_ytop - r->r_ybot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
|
* bpBinIndices --
|
|
|
|
|
*
|
|
|
|
|
* compute bin indices corresponding to area.
|
|
|
|
|
*
|
|
|
|
|
* ----------------------------------------------------------------------------
|
2020-05-23 23:13:14 +02:00
|
|
|
*/
|
|
|
|
|
static __inline__ void
|
2019-03-23 00:58:47 +01:00
|
|
|
bpBinIndices(Rect area, /* area */
|
|
|
|
|
Rect binArea, /* lower left corner of bin system */
|
|
|
|
|
int indexBits,
|
|
|
|
|
int dim,
|
|
|
|
|
bool xDir, /* TRUE for x bin, FALSE for y bin */
|
|
|
|
|
int *min, /* results go here */
|
|
|
|
|
int *max)
|
|
|
|
|
{
|
2020-05-23 23:13:14 +02:00
|
|
|
int ref, coord;
|
2019-03-23 00:58:47 +01:00
|
|
|
int index;
|
|
|
|
|
|
|
|
|
|
}
|