github.com/richardwilkes/toolbox@v1.121.0/xmath/geom/poly/vertex_type.go (about) 1 // Copyright (c) 2016-2024 by Richard A. Wilkes. All rights reserved. 2 // 3 // This Source Code Form is subject to the terms of the Mozilla Public 4 // License, version 2.0. If a copy of the MPL was not distributed with 5 // this file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 // 7 // This Source Code Form is "Incompatible With Secondary Licenses", as 8 // defined by the Mozilla Public License, version 2.0. 9 10 package poly 11 12 type vertexType int 13 14 const ( 15 _ vertexType = iota 16 externalMaximum 17 externalLeftIntermediate 18 _ // topEdge, not used 19 externalRightIntermediate 20 rightEdge 21 internalMaximumAndMinimum 22 internalMinimum 23 externalMinimum 24 externalMaximumAndMinimum 25 leftEdge 26 internalLeftIntermediate 27 _ // bottomEdge, not used 28 internalRightIntermediate 29 internalMaximum 30 _ // non-intersection, not used 31 ) 32 33 func calcVertexType(tr, tl, br, bl bool) vertexType { 34 var vt vertexType 35 if tr { 36 vt = externalMaximum 37 } 38 if tl { 39 vt |= externalLeftIntermediate 40 } 41 if br { 42 vt |= externalRightIntermediate 43 } 44 if bl { 45 vt |= externalMinimum 46 } 47 return vt 48 }