// $Header: /cvs/gled-1.2/Geom1/Glasses/WSPoint.cxx,v 1.4 2004/06/03 12:30:43 matevz Exp $

// Copyright (C) 1999-2004, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

//______________________________________________________________________
// WSPoint
//
// Weaver Symbol Point. Represents one control point of a Weaver
// Symbol.  Its effect is determined by its position and orientation
// (from ZNode) and by three real parameters: mW (width), mS (spread)
// and mT (tension).

#include "WSPoint.h"
#include "WSSeed.h"

ClassImp(WSPoint)

/**************************************************************************/

 void WSPoint::_init()
{
  mW = 0.1; mS = 0; mT = 1;
  mTwist = 0; mStretch = 1;
  bDrawAxen = false;
}

namespace {
  inline Float_t sqr(Float_t x) { return x*x; }
}

 void WSPoint::Coff(const WSPoint* f)
{
  const ZTrans& a = RefTrans();
  const ZTrans& b = f->RefTrans();
  Float_t d = sqrt(sqr(a(1u,4u)-b(1u,4u)) +
		  sqr(a(2u,4u)-b(2u,4u)) +
		  sqr(a(3u,4u)-b(3u,4u)));
  Float_t T1 = mT*d, T2 = f->mT*d;
  for(Int_t i=1; i<=3; i++) {
    Float_t A = T2*b(i, 1u) - 2*(b(i, 4u) - a(i, 4u)) + T1*a(i, 1u);
    mCoffs(i,0u) = a(i,4u);
    mCoffs(i,1u) = T1*a(i,1u);
    mCoffs(i,2u) = (b(i, 4u) - a(i, 4u)) - T1*a(i, 1u) - A;
    mCoffs(i,3u) = A;
  }
  // Widths
  {
    Float_t A = f->mS - 2*(f->mW - mW) + mS;
    mCoffs(4u,0u) = mW;
    mCoffs(4u,1u) = mS;
    mCoffs(4u,2u) = (f->mW - mW) - mS - A;
    mCoffs(4u,3u) = A;
  }
}

/**************************************************************************/

 TimeStamp_t WSPoint::Stamp(LID_t lid, CID_t cid)
{
  // Upon change also change parent's triangulation stamp (if it is a WSSeed).
  // Not optimal as it forces re-computation of Coffs for all WSPoints
  // in the symbol.

  TimeStamp_t t = ZNode::Stamp(lid, cid);
  if(lid==0 && cid == 0 ||
     lid==ZNode::LibID() && cid==ZNode::ClassID() ||
     lid==LibID() && cid==ClassID())
  {
    mStampReqTring = t;

    WSSeed* seed = dynamic_cast<WSSeed*>(mParent);
    if(seed) seed->MarkStampReqTring();
  }

  return t;
}

#include "WSPoint.c7"


ROOT page - Home page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.