예제 #1
0
const ValueVector & 
htmInterface::domainCmd( char *str ) {

  cmd_ = str;
  if(t_ != NULL)delete t_;
  t_ = new VarStrToken(cmd_);

  cmdCode code = getCode();
  if(code != HTMDOMAIN)
    throw SpatialInterfaceError("htmInterface:domainCmd: missing keyword HTMDOMAIN");
  getDepth();

  int32 nx,nc;
  nx = getInteger();

  SpatialDomain dom;
  for(int32 i = 0 ; i < nx; i++ ) {

    RangeConvex convex;

    nc = getInteger();
    for(int32 j = 0; j < nc; j++ ) {
      float64 x = getFloat();
      float64 y = getFloat();
      float64 z = getFloat();
      float64 d = getFloat();
      SpatialConstraint c(SpatialVector(x,y,z),d);
      convex.add(c); // [ed:RangeConvex::add]
    }
    dom.add(convex);
  }
  dom.setOlevel(20); 		// [ed:olevel]
  return domain(dom);
}
예제 #2
0
const ValueVector &
htmInterface::doHull() {

	if(polyCorners_.size() < 3)
		throw SpatialInterfaceError("htmInterface:convexHull: empty hull: points on one line");

	SpatialVector v;

	RangeConvex cvx;

	SpatialDomain dom;

	// The constraint we have for each side is a 0-constraint (great circle)
	// passing through the 2 corners. Since we are in counterclockwise order,
	// the vector product of the two successive corners just gives the correct
	// constraint.
	size_t i, len = polyCorners_.size();
	for(i = 0; i < len; i++) {
		v = polyCorners_[i].c_ ^ polyCorners_[ i == len-1 ? 0 : i + 1].c_;
#ifdef DIAG
		cerr << "doHull:: " << v << " " << i << "," << i+1 << endl;
#endif
		v.normalize();
		SpatialConstraint c(v,0);
		cvx.add(c); // [ed:RangeConvex::add]
	}
	dom.add(cvx);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%
//	dom.convexes_[0].boundingCircle_.write(cout);
//	dom.write(cout);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%
	return domain(dom);
}
예제 #3
0
int
test4 (int flag) {

  int nfailed = 0;
  HtmRange hr;
  SpatialIndex  si (3,3);
  SpatialVector sx (0.,0.);
  SpatialVector sz (0.,90.);
  SpatialConstraint sd (sx, .98);
  SpatialConstraint sc (sz, .98);
  RangeConvex cc;
  RangeConvex cd;
  SpatialDomain sdm;

  // create two convexes, along x and z
  cc.add(sc);
  cd.add(sd);
	
  // add them to the domain
  sdm.add(cc);
  sdm.add(cd);

  sdm.intersect(&si, &hr);

  if (flag>=DBG_MORE) sdm.write(cout);
	
  nfailed = 0;
  // showlists("domain 1",flag,full,partial);

  return showtest("Test4 (domain)\t",nfailed,flag);
}
예제 #4
0
파일: HTMesh.cpp 프로젝트: Bugsbane/kstars
// CIRCLE
void HTMesh::intersect(double ra, double dec, double radius, BufNum bufNum)
{
    double d = cos(radius * degree2Rad);
    SpatialConstraint c(SpatialVector(ra, dec), d);
    RangeConvex convex;
    convex.add(c);                      // [ed:RangeConvex::add]

    if ( ! performIntersection(&convex, bufNum) )
        printf("In intersect(%f, %f, %f)\n", ra, dec, radius);
}
예제 #5
0
const ValueVector & 
htmInterface::circleRegion( float64 ra,
			    float64 dec,
			    float64 rad ) {

	SpatialDomain dom;

	RangeConvex cvx;

	float64 d = cos(gPi * rad/10800.0);
	SpatialConstraint c(SpatialVector(ra,dec),d);
	cvx.add(c); // [ed:RangeConvex::add]
	dom.add(cvx);
	return domain(dom);
}