Ejemplo n.º 1
0
int ProtHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) 
{
   if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}
	 
	 HitRegion hitRegion;
   DWORD savedLimits;
   int res;
   Matrix3 m;
   GraphicsWindow *gw = vpt->getGW();  
   Material *mtl = gw->getMaterial();
   MakeHitRegion(hitRegion,type,crossing,4,p);  
   gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
   GetMat(t,inode,*vpt,m);
   gw->setTransform(m);
   // if we get a hit on the mesh, we're done
   gw->clearHitCode();
   if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) 
      return TRUE;
   // if not, check the target line, and set the pair flag if it's hit
   gw->clearHitCode();
   res = DrawLines(t, inode, gw, 1);
   gw->setRndLimits(savedLimits);
   return res;
}
Ejemplo n.º 2
0
int
FogObject::HitTest(TimeValue t, INode *inode, int type, int crossing,
                          int flags, IPoint2 *p, ViewExp *vpt)
{
    if ( ! vpt || ! vpt->IsAlive() )
		{
			// why are we here?
			DbgAssert(!"Doing HitTest() on invalid view port!");
			return FALSE;
		}
		
		HitRegion hitRegion;
    DWORD	savedLimits;
    int res = FALSE;
    Matrix3 m;
    GraphicsWindow *gw = vpt->getGW();	
    Material *mtl = gw->getMaterial();
    MakeHitRegion(hitRegion,type,crossing,4,p);	
    gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
    GetMat(t,inode,*vpt,m);
    gw->setTransform(m);
    gw->clearHitCode();
    if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) 
        return TRUE;
    gw->setRndLimits(savedLimits);
    return res;
}
Ejemplo n.º 3
0
int SymmetryMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}


	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);
	gw->clearHitCode();
	DrawLineProc lp(gw);
	DrawGizmo(
		vpt->GetScreenScaleFactor(tm.GetTrans())*SCREEN_SCALE,lp);
	gw->setRndLimits(savedLimits);
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		return 1;
		}
	return 0;
}
Ejemplo n.º 4
0
int FExtrudeMod::HitTest(
		TimeValue t, INode* inode, int type, int crossing, 
		int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{	

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);

	gw->clearHitCode();
	base->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
	gw->marker(&pt,HOLLOW_BOX_MRKR);
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		res = 1;
		}			

	gw->setRndLimits(savedLimits);
	return res;
	}
Ejemplo n.º 5
0
int EditFaceDataMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {
	Interval valid;
	int savedLimits, res = 0;
	GraphicsWindow *gw = vpt->getGW();
	HitRegion hr;
	
	// Setup GW
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	Matrix3 mat = inode->GetObjectTM(t);
	gw->setTransform(mat);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();

	if (!mc->localData) return 0;
	EditFaceDataModData *md = (EditFaceDataModData*)mc->localData;
	Mesh *mesh = md->GetCacheMesh ();
	MNMesh *mnmesh = md->GetCacheMNMesh ();

	SubObjHitList hitList;
	if (mesh) {
		res = mesh->SubObjectHitTest(gw, gw->getMaterial(), &hr, flags|hitLevel[selLevel], hitList);
	} else if (mnmesh) {
		res = mnmesh->SubObjectHitTest (gw, gw->getMaterial(), &hr, flags|mnhitLevel[selLevel], hitList);
	}

	MeshSubHitRec *rec = hitList.First();
	while (rec) {
		vpt->LogHit(inode,mc,rec->dist,rec->index,NULL);
		rec = rec->Next();
	}

	gw->setRndLimits(savedLimits);	
	return res;	
}
void SnapPivot_Mode::DrawAxisLock(ViewExp *vpt, int axis, float size, bool hightLight, bool hitTest, float& dist)
{
	GraphicsWindow *gw = vpt->getGW();

	if (hitTest)
	{
		gw->setRndLimits(gw->getRndLimits() | GW_PICK);
		gw->clearHitCode();		
	}

	
	Point3 p(0, 0, 0);
	p[axis] = size+ size*0.1f;

	if (axis == mLockedAxis)
		gw->setColor(ColorType::LINE_COLOR, mLockedColor);
	else
		gw->setColor(ColorType::LINE_COLOR, mLockColor);
	gw->startMarkers();
	gw->marker(&p, MarkerType::CIRCLE_MRKR);
	gw->endMarkers();


	dist = -1.0f;
	if (hitTest)
	{
		if (gw->checkHitCode())
		{
			if (gw->getHitDistance())
				dist = gw->getHitDistance();
		}
	}


}
void SnapPivot_Mode::DrawCenter(ViewExp *vpt, float size, bool hightLight, bool hitTest, float& dist)
{
	GraphicsWindow *gw = vpt->getGW();
	if (hitTest)
	{
		gw->setRndLimits(gw->getRndLimits() | GW_PICK);
		gw->clearHitCode();		
	}

	
	Point3 p(0, 0, 0);
	gw->setColor(ColorType::LINE_COLOR, mCenterColor);
	gw->startMarkers();
	gw->marker(&p, MarkerType::BIG_BOX_MRKR);
	gw->endMarkers();

	dist = -1.0f;
	if (hitTest)
	{
		if (gw->checkHitCode()) 
		{
			if (gw->getHitDistance() )
				dist = gw->getHitDistance();
		}		
	}

}
Ejemplo n.º 8
0
// From BaseObject
int TargetObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) {
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}
	
	HitRegion hitRegion;
	DWORD savedLimits;
	Matrix3 m;
	GraphicsWindow *gw = vpt->getGW();	
	MakeHitRegion(hitRegion,type,crossing,4,p);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	GetMat(t,inode,*vpt,m);
	gw->setTransform(m);
	if(mesh.select( gw, gw->getMaterial(), &hitRegion, flags & HIT_ABORTONHIT ))
		return TRUE;
	gw->setRndLimits( savedLimits );
	return FALSE;

#if 0
	gw->setHitRegion(&hitRegion);
	gw->clearHitCode();
	gw->fWinMarker(&pt, HOLLOW_BOX_MRKR);
	return gw->checkHitCode();
#endif

	}
Ejemplo n.º 9
0
int AFRMod::HitTest(
		TimeValue t, INode* inode, 
		int type, int crossing, int flags, 
		IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{
	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);

	// Hit test start point
	if ((flags&HIT_SELONLY   &&  sel[0]) ||
		(flags&HIT_UNSELONLY && !sel[0]) ||
		!(flags&(HIT_UNSELONLY|HIT_SELONLY)) ) {
	
		gw->clearHitCode();
		p1->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
		gw->marker(&pt,HOLLOW_BOX_MRKR);
		if (gw->checkHitCode()) {
			vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
			res = 1;
			}
		}

	// Hit test end point
	if ((flags&HIT_SELONLY   &&  sel[1]) ||
		(flags&HIT_UNSELONLY && !sel[1]) ||
		!(flags&(HIT_UNSELONLY|HIT_SELONLY)) ) {
	
		gw->clearHitCode();
		p2->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
		gw->marker(&pt,HOLLOW_BOX_MRKR);
		if (gw->checkHitCode()) {
			vpt->LogHit(inode, mc, gw->getHitDistance(), 1, NULL); 
			res = 1;
			}
		}

	gw->setRndLimits(savedLimits);
	return res;
	}
int SplineData::HitTest(ViewExp *vpt,INode *node, ModContext *mc, Matrix3 tm, HitRegion hr, int flags, SplineMapProjectionTypes projType, BOOL selectCrossSection )
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here?
		DbgAssert(!_T("Doing HitTest() on invalid viewport!"));
		return FALSE;
	}

	int res = 0;

	GraphicsWindow *gw = vpt->getGW();
	DWORD limit = gw->getRndLimits();
	gw->setRndLimits(( limit | GW_PICK) & ~GW_ILLUM);
	if (selectCrossSection)
	{
		Tab<int> hitSplines;
		Tab<int> hitCrossSections;

		if (HitTestCrossSection(gw, hr,  projType, hitSplines,hitCrossSections))
		{
			for (int i = 0; i < hitSplines.Count(); i++)
			{
				int splineIndex = hitSplines[i];
				int crossSectionIndex = hitCrossSections[i];
				if ( (mSplineElementData[splineIndex]->CrossSectionIsSelected(crossSectionIndex) && (flags&HIT_SELONLY)) ||
					!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
					vpt->LogHit(node,mc,crossSectionIndex,splineIndex,NULL);
				else if ( (!mSplineElementData[splineIndex]->CrossSectionIsSelected(crossSectionIndex) && (flags&HIT_UNSELONLY)) ||
					!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
					vpt->LogHit(node,mc,crossSectionIndex,splineIndex,NULL);
			}
		}
	}
	else
	{
		for (int splineIndex = 0; splineIndex < mSplineElementData.Count();splineIndex++)
		{
			gw->clearHitCode();
			mSplineElementData[splineIndex]->Display(gw,Matrix3(1),projType );
			if (gw->checkHitCode())
			{
				if ( (mSplineElementData[splineIndex]->IsSelected() && (flags&HIT_SELONLY)) ||
					!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
					vpt->LogHit(node,mc,0,splineIndex,NULL);
				else if ( (!mSplineElementData[splineIndex]->IsSelected() && (flags&HIT_UNSELONLY)) ||
					!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
					vpt->LogHit(node,mc,0,splineIndex,NULL);
			}

		}

	}

	gw->setRndLimits(limit);
	return res;
}
Ejemplo n.º 11
0
int TapeHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
{
    if ( ! vpt || ! vpt->IsAlive() )
    {
        // why are we here
        DbgAssert(!_T("Invalid viewport!"));
        return FALSE;
    }

    HitRegion hitRegion;
    DWORD savedLimits;
    int res = 0;
    Matrix3 m;
    if (!enable) return  0;
    GraphicsWindow *gw = vpt->getGW();
    Material *mtl = gw->getMaterial();
    MakeHitRegion(hitRegion,type,crossing,4,p);
    gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
    GetMat(t,inode,*vpt,m);
    gw->setTransform(m);
    // if we get a hit on the mesh, we're done
    gw->clearHitCode();
    if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
        return TRUE;
    // if not, check the target line, and set the pair flag if it's hit
    // this special case only works with point selection
    if(type != HITTYPE_POINT)
        return 0;
    // don't let line be active if only looking at selected stuff and target isn't selected
    if((flags & HIT_SELONLY) && (inode->GetTarget()) && !inode->GetTarget()->Selected() )
        return 0;
    gw->clearHitCode();
    res = DrawLine(t,inode,gw,-1);
    if(res != 0)
        inode->SetTargetNodePair(1);
    gw->setRndLimits(savedLimits);
    return res;
}
Ejemplo n.º 12
0
int BendManip::HitTest(TimeValue t, INode* pNode, int type, int crossing,
			int flags, IPoint2 *p, ViewExp *pVpt)
{
	ModContext* mc = FindModContext( pNode, modifier );
	if( mc==NULL ) return 0;

// From SimpleMod - Removed the centre drawing section
	Interval valid;
	int savedLimits;	
	GraphicsWindow *gw = pVpt->getGW();
	HitRegion hr;
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	Matrix3 modmat, ntm = pNode->GetObjTMBeforeWSM(t);

	if (mc->box->IsEmpty()) return 0;

	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();

	//Lets get the Modifier do all the work here

	Matrix3 off, invoff;
	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);
	gw->setTransform(modmat);		
	DoModifiedBox(*mc->box,modifier->GetDeformer(t,*mc,invoff,off),DrawLineProc(gw));
	

	gw->setRndLimits(savedLimits);	

	if (gw->checkHitCode()) {
		pVpt->LogHit(pNode, mc, gw->getHitDistance(), 0, NULL); 

	}

// Setup the Hit data from the Manipulator system into the HitRecord
	if(  pVpt->NumSubObjHits() ) {
		ManipHitData* pHitData = new ManipHitData(this);
		HitRecord* hit = pVpt->GetSubObjHitList().First();

		hit->hitData = pHitData; //Add the manip hit data
		return TRUE;
	}

	else 
	{
		return FALSE;
	}
}
Ejemplo n.º 13
0
int ClustMod::HitTest(
		TimeValue t, INode* inode, int type, int crossing, 
		int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{	
	int savedLimits;
	Matrix3 obtm = inode->GetObjectTM(t);
	GraphicsWindow *gw = vpt->getGW();
	HitRegion hr;
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();	
	gw->setTransform(obtm);

	Matrix3 ptm(1), ctm(1);
	if (posControl) posControl->GetValue(t,&ptm,FOREVER,CTRL_RELATIVE);
	if (tmControl) tmControl->GetValue(t,&ctm,FOREVER,CTRL_RELATIVE);	

	if (ip && ip->GetSubObjectLevel() == 1) {		
		//Matrix3 tm = DEFORMER_TM;
		Matrix3 tm = CompTM(ptm,ctm,mc->tm,1);

		ClustDeformer deformer(tm);
		if (mc->box->pmin==mc->box->pmax) {
			Point3 pt = mc->box->pmin * tm;
			gw->marker(&pt,ASTERISK_MRKR);
		} else {
			DoModifiedBox(MakeBoxNotEmpty(*mc->box),deformer,DrawLineProc(gw));
			}
		}

	if (ip && (ip->GetSubObjectLevel() == 1 ||
	           ip->GetSubObjectLevel() == 2)) {		
		//obtm = ctm * obtm;
		if (mc->tm) obtm = ctm * Inverse(*mc->tm) * obtm;
		else obtm = ctm * obtm;

		gw->setTransform(obtm);
		DrawCenterMark(DrawLineProc(gw),MakeBoxNotEmpty(*mc->box));
		}

	gw->setRndLimits(savedLimits);	
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		return 1;
		}
	return 0;
	}
Ejemplo n.º 14
0
int PointHelpObject::HitTest(
		TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) 
	{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	Matrix3 tm(1);	
	HitRegion hitRegion;
	DWORD	savedLimits;
	Point3 pt(0,0,0);

	GraphicsWindow *gw = vpt->getGW();	
	gw->setTransform(tm);
	Material *mtl = gw->getMaterial();

   	tm = inode->GetObjectTM(t);		
	MakeHitRegion(hitRegion, type, crossing, 4, p);

	gw->setRndLimits(((savedLimits = gw->getRndLimits())|GW_PICK)&~GW_ILLUM);
	gw->setHitRegion(&hitRegion);
	gw->clearHitCode();

	DrawAndHit(t, inode, vpt);

/*
	if (showAxis) {
		DrawAxis(vpt,tm,axisLength,screenSize);
		}
	gw->setTransform(tm);
	gw->marker(&pt,X_MRKR);
*/

	gw->setRndLimits(savedLimits);
	
	// CAL-08/27/03: This doesn't make sense. It shouldn't do this. (Defect #468271)
	// This will always select this helper when there's an intersection on the bounding box and the selection window.
	// TODO: There's still a problem with window selection. We need to check if it hits all components in DrawAndHit.
	/*
	if((hitRegion.type != POINT_RGN) && !hitRegion.crossing)
		return TRUE;
	*/

	return gw->checkHitCode();
	}
Ejemplo n.º 15
0
int
BackgroundObject::HitTest(TimeValue t, INode *inode, int type, int crossing,
                          int flags, IPoint2 *p, ViewExp *vpt)
{
    HitRegion hitRegion;
    DWORD	savedLimits;
    int res = FALSE;
    Matrix3 m;
    GraphicsWindow *gw = vpt->getGW();	
    Material *mtl = gw->getMaterial();
    MakeHitRegion(hitRegion,type,crossing,4,p);	
    gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
    GetMat(t,inode,vpt,m);
    gw->setTransform(m);
    gw->clearHitCode();
    if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) 
        return TRUE;
    gw->setRndLimits(savedLimits);
    return res;
}
bool SnapPivot_Mode::DrawBounds(ViewExp *vpt, bool hitTest, bool hightLight, Point3& hitPoint)
{
	if (mPreviewMesh == nullptr) return false;

	GraphicsWindow *gw = vpt->getGW();

	gw->setTransform(mBoundingTM);

	if (hitTest)
	{
		gw->setRndLimits(gw->getRndLimits() | GW_PICK);
		gw->clearHitCode();
	}


	Box3 bounds;
	bounds.Init();

	bool useSel = false;
	for (int i = 0; i < mPreviewMesh->numv; i++)
	{
		if (mPreviewMesh->v[i].GetFlag(MN_DEAD)) continue;
		if (mPreviewMesh->v[i].GetFlag(MN_SEL))
		{
			useSel = true;
			break;
		}
	}

	Matrix3 tm;
	Matrix3 boundsTMInverse;
	boundsTMInverse = Inverse(mBoundingTM);
	tm = mMeshTM * boundsTMInverse;

	for (int i = 0; i < mPreviewMesh->numv; i++)
	{
		if (mPreviewMesh->v[i].GetFlag(MN_DEAD)) continue;
		if (useSel)
		{
			if (mPreviewMesh->v[i].GetFlag(MN_SEL))
				bounds += mPreviewMesh->v[i].p*tm;
		}
		else

			bounds += mPreviewMesh->v[i].p*tm;

	}
	
	
	Point3 p[9];	
	gw->setColor(ColorType::LINE_COLOR, mBoundsColor);

	gw->startMarkers();


	p[0] = bounds[0];
	p[1] = bounds[1];
	p[2] = bounds[2];
	p[3] = bounds[3];
	bool hit = DrawBoxFace(gw, p, hitTest, hitPoint);
	if (hit && hitTest)
		return true;

	p[0] = bounds[4];
	p[1] = bounds[5];
	p[2] = bounds[6];
	p[3] = bounds[7];
	hit = DrawBoxFace(gw, p, hitTest, hitPoint);
	if (hit && hitTest)
		return true;

	p[0] = (bounds[0] + bounds[4])*0.5f;
	p[1] = (bounds[1] + bounds[5])*0.5f;
	p[2] = (bounds[2] + bounds[6])*0.5f;
	p[3] = (bounds[3] + bounds[7])*0.5f;
	hit = DrawBoxFace(gw, p, hitTest, hitPoint);
	if (hit && hitTest)
		return true;



	gw->endMarkers();

	Point3 edgeColor(mBoundsColor);
	edgeColor *= 0.8f;
	gw->setColor(ColorType::LINE_COLOR, edgeColor);

	gw->startSegments();

	p[0] = bounds[0];
	p[1] = bounds[1];
	p[2] = bounds[3];
	p[3] = bounds[2];
	p[4] = bounds[0];
	for (int i = 0; i < 4; i++)
		gw->segment(&p[i], 1);

	p[0] = bounds[4];
	p[1] = bounds[5];
	p[2] = bounds[7];
	p[3] = bounds[6];
	p[4] = bounds[4];
	for (int i = 0; i < 4; i++)
		gw->segment(&p[i], 1);


	p[0] = bounds[0];
	p[1] = bounds[4];
	gw->segment(&p[0], 1);

	p[0] = bounds[1];
	p[1] = bounds[5];
	gw->segment(&p[0], 1);

	p[0] = bounds[2];
	p[1] = bounds[6];
	gw->segment(&p[0], 1);

	p[0] = bounds[3];
	p[1] = bounds[7];
	gw->segment(&p[0], 1);




	gw->endSegments();

	
	return false;
}