Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.2 KiB

  1. /**************************************************************************
  2. * *
  3. * Copyright (C) 1992, Silicon Graphics, Inc. *
  4. * *
  5. * These coded instructions, statements, and computer programs contain *
  6. * unpublished proprietary information of Silicon Graphics, Inc., and *
  7. * are protected by Federal copyright law. They may not be disclosed *
  8. * to third parties or copied or duplicated in any form, in whole or *
  9. * in part, without the prior written consent of Silicon Graphics, Inc. *
  10. * *
  11. **************************************************************************/
  12. /*
  13. * curvelist.c++ - $Revision: 1.1 $
  14. * Derrick Burns - 1991
  15. */
  16. #include "glimport.h"
  17. #include "myassert.h"
  18. #include "mystdio.h"
  19. #include "quilt.h"
  20. #include "curvelis.h"
  21. #include "curve.h"
  22. #include "nurbscon.h"
  23. #include "types.h"
  24. Curvelist::Curvelist( Quilt *quilts, REAL pta, REAL ptb )
  25. {
  26. curve = 0;
  27. for( Quilt *q = quilts; q; q = q->next )
  28. curve = new Curve( q, pta, ptb, curve );
  29. range[0] = pta;
  30. range[1] = ptb;
  31. range[2] = ptb - pta;
  32. }
  33. Curvelist::Curvelist( Curvelist &upper, REAL value )
  34. {
  35. Curvelist &lower = *this;
  36. curve = 0;
  37. for( Curve *c = upper.curve; c; c = c->next )
  38. curve = new Curve( *c, value, curve );
  39. lower.range[0] = upper.range[0];
  40. lower.range[1] = value;
  41. lower.range[2] = value - upper.range[0];
  42. upper.range[0] = value;
  43. upper.range[2] = upper.range[1] - value;
  44. }
  45. Curvelist::~Curvelist()
  46. {
  47. while( curve ) {
  48. Curve *c = curve;
  49. curve = curve->next;
  50. delete c;
  51. }
  52. }
  53. int
  54. Curvelist::cullCheck( void )
  55. {
  56. for( Curve *c = curve; c; c = c->next )
  57. if( c->cullCheck() == CULL_TRIVIAL_REJECT )
  58. return CULL_TRIVIAL_REJECT;
  59. return CULL_ACCEPT;
  60. }
  61. void
  62. Curvelist::getstepsize( void )
  63. {
  64. stepsize = range[2];
  65. for( Curve *c = curve; c; c = c->next ) {
  66. c->getstepsize();
  67. c->clamp();
  68. stepsize = ((c->stepsize < stepsize) ? c->stepsize : stepsize);
  69. if( c->needsSamplingSubdivision() ) break;
  70. }
  71. needsSubdivision = ( c ) ? 1 : 0;
  72. }
  73. int
  74. Curvelist::needsSamplingSubdivision( void )
  75. {
  76. return needsSubdivision;
  77. }