/* 1.3 Convert this face to a region with the given offsets and scale-factors. Also convert holes, if the parameter ~withholes~ is true */ Region Face::MakeRegion(double offx, double offy, double scalex, double scaley, bool withholes) { ListExpr cycle = Segs2NL(v, offx, offy, scalex, scaley); ListExpr cycles = nl->OneElemList(cycle); if (withholes) { for (unsigned int h = 0; h < holes.size(); h++) { ListExpr hcycle = Segs2NL(holes[h].v, offx, offy, scalex, scaley); Append(cycles, hcycle); } } ListExpr face = nl->OneElemList(cycles); ListExpr err = nl->Empty(); bool correct = false; Word w = InRegion(nl->Empty(), face, 0, err, correct); if (correct) { Region ret(*((Region*) w.addr)); return ret; } else { return Region(); } }
bool VoxelWorldRegion::Empty(uint32 x, uint32 y, uint32 z) { if(InRegion(x, y, z) == false) { return true; } return _get_voxel(x ,y, z) == VT_EMPTY; }
/***************************************************************************** * Function: _DtCvDrawAreaWithFlags * *****************************************************************************/ void _DtCvDrawAreaWithFlags ( _DtCanvasStruct *canvas, _DtCvSelectData start, _DtCvSelectData end, _DtCvFlags old_flags, _DtCvFlags new_flags, _DtCvElemType trav_type, _DtCvPointer trav_data) { int i; int len; int count; int startChar; int lnkInd; _DtCvUnit dstX; _DtCvUnit topY; _DtCvUnit botY; _DtCvUnit superWidth; _DtCvUnit subWidth; _DtCvUnit superY; _DtCvUnit subY; _DtCvUnit scriptX; _DtCvUnit segWidth; _DtCvSegmentI *pSeg; _DtCvValue lstLinkVis; _DtCvValue lstWasSuper; _DtCvValue lstWasSub; _DtCvValue trimmed; _DtCvFlags flagMask = old_flags | new_flags; _DtCvFlags endFlag = flagMask & _DtCvTRAVERSAL_END; _DtCvDspLine *lines = canvas->txt_lst; /* * now use the flagMask to determine what else to look for. * I.e. if flagMask has _DtCvMARK_FLAG set, then it becomes * set to _DtCvSELECTED_FLAG and visa versa. */ flagMask ^= (_DtCvSELECTED_FLAG | _DtCvMARK_FLAG); /* * strip the end flag from the other flags */ new_flags &= ~(_DtCvTRAVERSAL_END); old_flags &= ~(_DtCvTRAVERSAL_END); if (Equal(start, end)) return; for (i = 0; i < canvas->txt_cnt; i++) { topY = lines[i].baseline - lines[i].ascent; botY = lines[i].baseline + lines[i].descent; if (InRegion(topY, botY, start.y, end.y)) { /* * get the start of the text. */ lstLinkVis = False; lstWasSuper = False; lstWasSub = False; lnkInd = -1; dstX = _DtCvGetStartXOfLine(&(lines[i]), &pSeg); startChar = lines[i].byte_index; count = lines[i].length; while (pSeg != NULL && _DtCvIsSegNoop(pSeg)) { startChar = 0; pSeg = pSeg->next_disp; } /* * advance the starting point */ dstX = _DtCvAdvanceXOfLine(canvas, pSeg, dstX, &lnkInd, &lstLinkVis); /* * take into account super/sub scripting */ dstX = _DtCvAdjustForSuperSub(canvas, pSeg, dstX, &scriptX, &superWidth, &superY, &subWidth, &subY, &lstWasSuper, &lstWasSub); /* * set this flag so that the first pass of 'while (cnt > 0)' * doesn't do it again. */ trimmed = True; if (_DtCvStraddlesPt(start.y, topY, botY)) { /* * skip this item? * I.E. is this line before the start or after the end? */ if (canvas->txt_lst[i].max_x < start.x || (end.y == start.y && end.x <= dstX) ) continue; /* * does this line start the mark/selection? */ if (i == start.line_idx && start.x >= dstX) { int cnt = start.char_idx; while (cnt > 0) { if (trimmed == False) { /* * advance the starting point */ dstX = _DtCvAdvanceXOfLine(canvas, pSeg, dstX, &lnkInd, &lstLinkVis); /* * take into account super/sub scripting */ dstX = _DtCvAdjustForSuperSub(canvas, pSeg, dstX, &scriptX, &superWidth, &superY, &subWidth, &subY, &lstWasSuper, &lstWasSub); } /* * take into account the length of the segment */ _DtCvGetWidthOfSegment(canvas, pSeg, startChar , cnt, &len, &segWidth, &trimmed); dstX += segWidth; startChar += len; if (trimmed == False) { startChar = 0; pSeg = pSeg->next_disp; } trimmed = False; cnt -= len; } count -= start.char_idx; } /* * otherwise this line is after the line that starts * the mark/selection. Stick with its start x. */ } /* * does this straddle the end point? */ if (_DtCvStraddlesPt(end.y, topY, botY)) { /* * does this start after the end of the mark/selection? * if so, skip. */ if (end.x <= dstX) continue; /* * Does this segment end after the end of the mark/selection? * If so, trim how much gets highlighted. */ if (canvas->txt_lst[i].max_x > end.x) count -= (lines[i].length - end.char_idx); } /* * while there is something to draw (un)mark/selected. */ old_flags = old_flags | _DtCvMARK_BEGIN; new_flags = new_flags | _DtCvMARK_BEGIN; while (count > 0) { /* * the original count to render */ len = count; /* * check for other marks and selection. */ _DtCvCheckLineMarks(canvas, i, startChar - lines[i].byte_index, count, dstX, flagMask, &len, &old_flags, &new_flags); /* * if this is the last segment(s) of the (un)mark/selection * set the end flags. */ if (len == count) { new_flags |= (endFlag | _DtCvLINK_END | _DtCvMARK_END); old_flags |= (endFlag | _DtCvLINK_END | _DtCvMARK_END); } /* * draw the segments that are marked/unmarked. */ dstX = _DtCvDrawSegments(canvas, lines[i], pSeg, startChar , len, &lnkInd, dstX, dstX, &scriptX, &superWidth, &superY, &subWidth, &subY, &lstWasSub, &lstWasSuper, &lstLinkVis, old_flags, new_flags, trav_type, trav_data); /* * modify the count by the length processed */ count -= len; /* * did this do the entire length? If not, set the * indexes ahead and do again. */ if (count > 0) _DtCvSkipLineChars(canvas, pSeg, startChar , count + len, len, &startChar , &pSeg); /* * strip the any begin flags. */ _DtCvRemoveBeginFlags(old_flags); _DtCvRemoveBeginFlags(new_flags); } } } }