Warning, /include/opencascade/IntRes2d_IntersectionSegment.lxx is written in an unsupported language. File is not indexed.
0001 // Copyright (c) 1995-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014
0015 #include <Standard_DomainError.hxx>
0016
0017 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment(
0018 const IntRes2d_IntersectionPoint& P1,
0019 const IntRes2d_IntersectionPoint& P2,
0020 const bool Oppos,
0021 const bool ReverseFlag)
0022 :
0023
0024 oppos(Oppos),
0025 first(true),
0026 last(true),
0027 ptfirst(P1),
0028 ptlast(P2)
0029 {
0030 if (ReverseFlag)
0031 {
0032 if (Oppos)
0033 {
0034 ptfirst = P2;
0035 ptlast = P1;
0036 }
0037 }
0038 }
0039
0040 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment(
0041 const IntRes2d_IntersectionPoint& P,
0042 const bool First,
0043 const bool Oppos,
0044 const bool ReverseFlag)
0045 :
0046
0047 oppos(Oppos)
0048
0049 {
0050 if (ReverseFlag && Oppos)
0051 {
0052 if (First)
0053 {
0054 first = false;
0055 last = true;
0056 ptlast = P;
0057 }
0058 else
0059 {
0060 first = true;
0061 last = false;
0062 ptfirst = P;
0063 }
0064 }
0065 else
0066 {
0067 if (First)
0068 {
0069 first = true;
0070 last = false;
0071 ptfirst = P;
0072 }
0073 else
0074 {
0075 first = false;
0076 last = true;
0077 ptlast = P;
0078 }
0079 }
0080 }
0081
0082 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment(const bool Oppos)
0083 : oppos(Oppos),
0084 first(false),
0085 last(false)
0086
0087 {
0088 }
0089
0090 inline bool IntRes2d_IntersectionSegment::IsOpposite() const
0091 {
0092 return oppos;
0093 }
0094
0095 inline bool IntRes2d_IntersectionSegment::HasFirstPoint() const
0096 {
0097 return first;
0098 }
0099
0100 inline bool IntRes2d_IntersectionSegment::HasLastPoint() const
0101 {
0102 return last;
0103 }
0104
0105 inline const IntRes2d_IntersectionPoint& IntRes2d_IntersectionSegment::FirstPoint() const
0106 {
0107
0108 if (!first)
0109 {
0110 throw Standard_DomainError();
0111 }
0112 return ptfirst;
0113 }
0114
0115 inline const IntRes2d_IntersectionPoint& IntRes2d_IntersectionSegment::LastPoint() const
0116 {
0117
0118 if (!last)
0119 {
0120 throw Standard_DomainError();
0121 }
0122 return ptlast;
0123 }