//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 18JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// protected static int Cast2Integer(double f) { if (f < 0) { return((int)MathEx.Ceil(f)); } return((int)MathEx.Floor(f)); }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 13JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// internal ArcIterator(Arc a, AffineTransform at) { _w = a.GetWidth() / 2.0; _h = a.GetHeight() / 2.0; _x = a.GetX() + _w; _y = a.GetY() + _h; _angStRad = -MathEx.ToRadians(a.GetAngleStart()); _affine = at; double ext = -a.GetAngleExtent(); if (ext >= 360.0 || ext <= -360) { _arcSegs = 4; _increment = Math.PI / 2; // btan(Math.PI / 2); _cv = 0.5522847498307933; if (ext < 0) { _increment = -_increment; _cv = -_cv; } } else { _arcSegs = (int)MathEx.Ceil(MathEx.Abs(ext) / 90.0); _increment = MathEx.ToRadians(ext / _arcSegs); _cv = Btan(_increment); if (_cv == 0) { _arcSegs = 0; } } switch (a.GetArcType()) { case Arc.OPEN: _lineSegs = 0; break; case Arc.CHORD: _lineSegs = 1; break; case Arc.PIE: _lineSegs = 2; break; } if (_w < 0 || _h < 0) { _arcSegs = _lineSegs = -1; } }