GithubHelp home page GithubHelp logo

cg's People

Contributors

andreyg avatar antonkov avatar dvbobrov avatar free0u avatar grtkachenko avatar lisyarus avatar mcquay239 avatar zumzoom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cg's Issues

boost::numeric::interval неправильно работает под MSVC 2015 x64

Привет! :)

Видимо эту строку

typedef boost::numeric::interval_lib::unprotect<boost::numeric::interval<double> >::type interval;
надо заменить на что-то вроде этого:

#if defined(_MSC_VER) && (defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP > 0)))
         // This is because MSVC compiler (2015) has SSE enabled by default for x64, and thus rounding mode can't be saved and should be specified each time
         // See also:
         // https://www.gecode.org/users-archive/2016-May/004862.html
         // https://github.com/Gecode/gecode/blob/7390b0b16bd7cc0cc385f3e8fd9436ca9897d065/gecode/float.hh#L131-L147
         typedef boost::numeric::interval_lib::save_state<boost::numeric::interval_lib::rounded_arith_std<T>> RoundingBase;
#else
         // Faster version thanks to saving rounding mode in state, also surprisingly rounded_arith_std leads to failed tests on GCC 5.4.0
         typedef boost::numeric::interval_lib::rounded_arith_opp<T> RoundingBase;
#endif
         typedef boost::numeric::interval_lib::checking_strict<T> CheckingBase;
         typedef boost::numeric::interval<double, boost::numeric::interval_lib::policies<RoundingBase, CheckingBase>> interval;

т.к. MSVC 2015 под x64 по умолчанию использует SSE2 (выдержка из https://www.gecode.org/users-archive/2016-May/004862.html):

if you look at the documentation
homepage, you'll see a big red warning :)

http://www.boost.org/doc/libs/1_61_0/libs/numeric/interval/doc/interval.htm

which says that the library probably won't work with SSE2 (or at least not
out of the box). But SSE2 is the only option for x64.

On the other hand, I'm not aware of any good alternative to this Boost
library. I think the library is actually quite good (even though it would
use some work on supporting SSE2 better).

So I thought I'd play with the library's policies to see if I could make it
work with x64. I looked into float.hh which defines what exact interval
datatype is used. It looks like changing from 'rounded_arith_opp' to
'rounded_arith_std' fixes the issues that we're observing. If you're
interested the description of those types is available here:

http://www.boost.org/doc/libs/1_61_0/libs/numeric/interval/doc/rounding.htm

Отправил бы PR, но не уверен что ничего не упускаю, т.к. не понимаю две вещи:

  1. Почему раньше использовался typedef interval_lib::unprotect<...>::type interval;
  2. Почему под GCC 5.4.0 rounded_arith_std дает не верный результат

P.S. см.:
https://www.gecode.org/users-archive/2016-May/004862.html
https://github.com/Gecode/gecode/blob/7390b0b16bd7cc0cc385f3e8fd9436ca9897d065/gecode/float.hh#L131-L147

P.P.S. понимаю что репозиторий не обновляется, но на всякий случай пусть будет хотя бы Issue

library restructuring

New structure:
Repo/
include/
cg/
visualization/
src/
tests/
examples/

Builds libcg, libvisualization, examples (optionally) and tests (optionally)

Provides findcg.cmake

Visualizer bug

In rectangle_intersects_segment: move the bottom right corner to the left and higher than top left one. Then move the segment into the rectangle. Visualizer will show they do not intersect. Quick fix for rectangle_intersects_segment.cpp:

 bool on_release(const point_2f & p)
 {
      rbutton_pressed_ = false;
+     r_.x = {std::min(r_.x.inf, r_.x.sup), std::max(r_.x.inf, r_.x.sup)};
+     r_.y = {std::min(r_.y.inf, r_.y.sup), std::max(r_.y.inf, r_.y.sup)};
      return false;
 }

epsilon in orientation_d

In file "cg / include / cg / operations / orientation.h":
Based on your article (http://habrahabr.ru/post/138168/), epsilon should be equal to "(fabs(l) + fabs(r)) * 4 * std::numeric_limits::epsilon();" instead of "(fabs(l) + fabs(r)) * 8 * std::numeric_limits::epsilon();" (becouse real epsilon is two times smaller than stl's).

CTest

Почему бы не прикрутить ctest к проекту, ведь это совершенно бесплатно делается в нашем случае. Получим замечательную систему запуска всех или выборочных тестов прямо из папки build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.