hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 109 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 48.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
962ffee954876d8999083f3bffc80ce4602a7c70 | 1,441 | cpp | C++ | greedy/Huffman_coding.cpp | verma-tanishq/placement-essentials | 515135f417f002db5e59317cce7660f29b8e902a | [
"MIT"
] | 1 | 2021-04-04T16:23:15.000Z | 2021-04-04T16:23:15.000Z | greedy/Huffman_coding.cpp | verma-tanishq/placement-essentials | 515135f417f002db5e59317cce7660f29b8e902a | [
"MIT"
] | null | null | null | greedy/Huffman_coding.cpp | verma-tanishq/placement-essentials | 515135f417f002db5e59317cce7660f29b8e902a | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
struct MinHeapNode{
char data;
unsigned frq;
MinHeapNode *left;
MinHeapNode *right;
MinHeapNode(char data, unsigned frq){
left=right=NULL;
this->data = data;
this->frq = frq;
}
};
struct comp{
bool operator()(MinHeapNode *l, MinHeapNode *r){
return l->frq > r->frq;
}
};
void printHuff(struct MinHeapNode* root, string str){
if(!root){
return;
}
if(root->data!='$'){
cout<<root->data<<": "<<str<<"\n";
}
printHuff(root->left, str+"0");
printHuff(root->right, str+"1");
}
void huffmanCode(char data[], int frq[], int n){
struct MinHeapNode *left, *right, *top;
priority_queue<MinHeapNode*, vector<MinHeapNode*>, comp> minHeap;
for(int i=0; i<n; ++i){
minHeap.push(new MinHeapNode(data[i], frq[i]));
}
while(minHeap.size()!=1){
left = minHeap.top();
minHeap.pop();
right = minHeap.top();
minHeap.pop();
top = new MinHeapNode('$', left->frq + right->frq);
top->left=left;
top->right=right;
minHeap.push(top);
}
printHuff(minHeap.top(),"");
}
int main(){
char arr[] = {'a','b','c','d','e','f'};
int frq[] = {5,9,12,13,16,45};
int n = sizeof(arr)/sizeof(arr[0]);
huffmanCode(arr,frq,n);
return 0;
}
| 22.169231 | 70 | 0.519084 | verma-tanishq |
9635570a8c1ba2dbdfc1faf6a8ff56b8ffbd5222 | 1,367 | cpp | C++ | Chapter13/TextQuery.cpp | FrogLu/CPPP | 0ee4632c12b287957739e2061fd6b02234465346 | [
"MIT"
] | null | null | null | Chapter13/TextQuery.cpp | FrogLu/CPPP | 0ee4632c12b287957739e2061fd6b02234465346 | [
"MIT"
] | null | null | null | Chapter13/TextQuery.cpp | FrogLu/CPPP | 0ee4632c12b287957739e2061fd6b02234465346 | [
"MIT"
] | null | null | null | #include "pch.h"
#include "StrVec.h"
#include "myfunction.h"
#include "TextQuery.h"
std::set<TextQuery::line_no>::iterator QueryResult::begin()
{
auto ret=lines->begin();
return ret;
}
const std::set<TextQuery::line_no>::iterator QueryResult::begin() const
{
auto ret = lines->cbegin();
return ret;
}
std::set<TextQuery::line_no>::iterator QueryResult::end()
{
auto ret = lines->end();
return ret;
}
const std::set<TextQuery::line_no>::iterator QueryResult::end() const
{
auto ret = lines->cend();
return ret;
}
void TextQuery::display_map() {
auto iter = wm.cbegin(), iter_end = wm.cend();
for (; iter != iter_end; ++iter) {
std::cout << "word: " << iter->first << " {";
auto text_locs = iter->second;
auto loc_iter = text_locs->cbegin();
auto loc_iter_end = text_locs->cend();
while (loc_iter != loc_iter_end) {
std::cout << *loc_iter;
if (++loc_iter != loc_iter_end) {
std::cout << ", ";
}
}
std::cout << "}" << std::endl;
}
std::cout << std::endl;
}
std::string TextQuery::cleanup_str(const std::string& word) {
std::string ret;
for (auto iter = word.begin(); iter != word.end(); ++iter) {
if (!ispunct(*iter)) {
ret += tolower(*iter);
}
}
return ret;
} | 22.783333 | 71 | 0.556693 | FrogLu |
963c7efd265515d3a06622501dd8338d5263c25b | 3,601 | cpp | C++ | pc/attr_id.cpp | rtilder/pyth-client | aaf33e1dd13c7c945f1545dd5b207646cba034d3 | [
"Apache-2.0"
] | 89 | 2021-05-13T15:05:45.000Z | 2022-03-17T16:42:21.000Z | pc/attr_id.cpp | rtilder/pyth-client | aaf33e1dd13c7c945f1545dd5b207646cba034d3 | [
"Apache-2.0"
] | 46 | 2021-05-14T15:26:14.000Z | 2022-03-31T11:33:48.000Z | pc/attr_id.cpp | rtilder/pyth-client | aaf33e1dd13c7c945f1545dd5b207646cba034d3 | [
"Apache-2.0"
] | 50 | 2021-05-18T05:10:38.000Z | 2022-03-31T22:26:28.000Z | #include "attr_id.hpp"
using namespace pc;
///////////////////////////////////////////////////////////////////////////
// attr_dict
attr_dict::pos::pos()
: idx_( 0 ), len_ ( 0 ) {
}
void attr_dict::clear()
{
num_ = 0;
abuf_.clear();
avec_.clear();
}
unsigned attr_dict::get_num_attr() const
{
return num_;
}
bool attr_dict::get_attr( attr_id aid, str& val ) const
{
if ( aid.get_id() >= avec_.size() ) return false;
const pos& p = avec_[aid.get_id()];
val.str_ = &abuf_[p.idx_];
val.len_ = p.len_;
return val.len_ != 0;
}
bool attr_dict::get_next_attr( attr_id&id, str& val ) const
{
for(unsigned i=1+id.get_id(); i<avec_.size(); ++i ) {
id = attr_id( i );
if ( get_attr( id, val ) ) {
return true;
}
}
return false;
}
void attr_dict::add_ref( attr_id aid, str val )
{
if ( aid.get_id() >= avec_.size() ) {
avec_.resize( 1 + aid.get_id() );
}
pos& p = avec_[aid.get_id()];
p.idx_ = abuf_.size();
p.len_ = val.len_;
abuf_.resize( abuf_.size() + p.len_ );
__builtin_memcpy( &abuf_[p.idx_], val.str_, p.len_ );
++num_;
}
bool attr_dict::init_from_account( pc_prod_t *aptr )
{
clear();
str key, val;
char *ptr = (char*)aptr + sizeof( pc_prod_t );
char *end = (char*)aptr + aptr->size_;
while( ptr != end ) {
key.str_ = &ptr[1];
key.len_ = (size_t)ptr[0];
ptr += 1 + key.len_;
if ( ptr > end ) return false;
val.str_ = &ptr[1];
val.len_ = (size_t)ptr[0];
ptr += 1 + val.len_;
if ( ptr > end ) return false;
attr_id aid = attr_id_set::inst().add_attr_id( key );
add_ref( aid, val );
}
return true;
}
bool attr_dict::init_from_json( jtree& pt, uint32_t hd )
{
if ( hd == 0 || pt.get_type( hd ) != jtree::e_obj ) {
return false;
}
clear();
for( uint32_t it=pt.get_first(hd); it; it = pt.get_next(it) ) {
uint32_t kt = pt.get_key( it );
if ( !kt ) return false;
attr_id aid = attr_id::add( pt.get_str( kt ) );
str val = pt.get_str( pt.get_val( it ) );
add_ref( aid, val );
}
return true;
}
void attr_dict::write_account( net_wtr& wtr )
{
str vstr, kstr;
for( unsigned id=1; id < avec_.size(); ++id ) {
attr_id aid( id );
if ( !get_attr( aid, vstr ) ) {
continue;
}
kstr = aid.get_str();
wtr.add( (char)kstr.len_ );
wtr.add( kstr );
wtr.add( (char)vstr.len_ );
wtr.add( vstr );
}
}
void attr_dict::write_json( json_wtr& wtr ) const
{
str vstr, kstr;
for( unsigned id=1; id < avec_.size(); ++id ) {
attr_id aid( id );
if ( !get_attr( aid, vstr ) ) {
continue;
}
kstr = aid.get_str();
wtr.add_key( kstr, vstr );
}
}
///////////////////////////////////////////////////////////////////////////
// attr_id_set
attr_id_set::attr_id_set()
: aid_( 0 )
{
}
str attr_id_set::attr_wtr::add_attr( str v )
{
char *tgt = reserve( v.len_ );
__builtin_memcpy( tgt, v.str_, v.len_ );
advance( v.len_ );
return str( tgt, v.len_ );
}
attr_id attr_id_set::add_attr_id( str v )
{
attr_map_t::iter_t it = amap_.find( v );
if ( it ) {
return amap_.obj( it );
} else {
str k = abuf_.add_attr( v );
it = amap_.add( k );
attr_id aid( ++aid_ );
avec_.resize( 1 + aid_ );
avec_[aid_] = k;
amap_.ref( it ) = aid;
return aid;
}
}
attr_id attr_id_set::get_attr_id( str v )
{
attr_map_t::iter_t it = amap_.find( v );
if ( it ) {
return amap_.obj( it );
} else {
return attr_id();
}
}
str attr_id_set::get_str( attr_id aid )
{
if ( aid.get_id() < avec_.size() ) {
return avec_[aid.get_id()];
} else {
return str();
}
}
| 20.815029 | 75 | 0.550958 | rtilder |
9640b4ab153b76bf5f6ac5aca006d12f618598b4 | 3,907 | cpp | C++ | src/Host.cpp | dgu123/enet-pp | 19559db6201d5b5d679185731bbb0bc623241576 | [
"MIT"
] | null | null | null | src/Host.cpp | dgu123/enet-pp | 19559db6201d5b5d679185731bbb0bc623241576 | [
"MIT"
] | null | null | null | src/Host.cpp | dgu123/enet-pp | 19559db6201d5b5d679185731bbb0bc623241576 | [
"MIT"
] | null | null | null | // Copyright (c) 2010 Johann Duscher (alias Jonny Dee)
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#include "enetpp/ENet.h"
#include <stdexcept>
namespace enetpp
{
Host::Host(ENet* parent, const Address& address, size_t maxClients, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) :
_parent(parent),
_host(enet_host_create(&address._address, maxClients, incomingBandwidth, outgoingBandwidth))
{
if (NULL == _host)
throw std::runtime_error("An error occurred while trying to create an ENet server host");
}
Host::Host(ENet* parent, size_t maxClients, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) :
_parent(parent),
_host(enet_host_create(NULL, maxClients, incomingBandwidth, outgoingBandwidth))
{
if (NULL == _host)
throw std::runtime_error("An error occurred while trying to create an ENet client host");
}
Host::~Host()
{
destroy();
}
void Host::destroy()
{
enet_host_destroy(_host);
}
int Host::service(Event& event, enet_uint32 timeoutMillis)
{
int result = enet_host_service(_host, &event._event, timeoutMillis);
handleEvent(event);
return result;
}
void Host::handleEvent(Event& event)
{
switch (event.type())
{
case ENET_EVENT_TYPE_CONNECT:
// Remember the new peer.
_allPeers.push_back(event.peer()._peer);
break;
case ENET_EVENT_TYPE_DISCONNECT:
// This is where you are informed about disconnects.
// Simply remove the peer from the list of all peers.
_allPeers.erase(std::find(_allPeers.begin(), _allPeers.end(), event.peer()._peer));
break;
default:
break;
}
}
Peer Host::connect(const Address& address, size_t channelCount)
{
ENetPeer* peer = enet_host_connect(_host, &address._address, channelCount);
if (NULL == peer)
throw std::runtime_error("Creating connection failed");
return Peer(peer);
}
void Host::broadcast(enet_uint8 channelID, Packet& packet)
{
// Once the packet is handed over to ENet with broadcast(),
// ENet will handle its deallocation.
enet_host_broadcast(_host, channelID, packet._packet);
}
void Host::flush()
{
enet_host_flush(_host);
}
void Host::bandwidthThrottle()
{
enet_host_bandwidth_throttle(_host);
}
void Host::bandwidthLimit(enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)
{
enet_host_bandwidth_limit(_host, incomingBandwidth, outgoingBandwidth);
}
int Host::checkEvents(Event& event) const
{
return enet_host_check_events(_host, &event._event);
}
}
| 32.02459 | 135 | 0.668032 | dgu123 |
96444558a1df67b443e3e3b51efad318659be8e0 | 17,885 | cpp | C++ | system/test/preprocessor_tools_test.cpp | vinders/pandora_toolbox | f32e301ebaa2b281a1ffc3d6d0c556091420520a | [
"MIT"
] | 2 | 2020-11-19T03:23:35.000Z | 2021-02-25T03:34:40.000Z | system/test/preprocessor_tools_test.cpp | vinders/pandora_toolbox | f32e301ebaa2b281a1ffc3d6d0c556091420520a | [
"MIT"
] | null | null | null | system/test/preprocessor_tools_test.cpp | vinders/pandora_toolbox | f32e301ebaa2b281a1ffc3d6d0c556091420520a | [
"MIT"
] | null | null | null | /*******************************************************************************
MIT License
Copyright (c) 2021 Romain Vinders
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifdef _MSC_VER
# define _CRT_SECURE_NO_WARNINGS
#endif
#if !defined(_MSC_VER) && !defined(__clang__) && defined(__GNUG__) && __GNUC__ > 7
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
#include <cstdint>
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include <system/force_inline.h> // include to force compiler check
#include <system/preprocessor_tools.h>
class PreprocessorToolsTest : public testing::Test {
public:
protected:
//static void SetUpTestCase() {}
//static void TearDownTestCase() {}
void SetUp() override {}
void TearDown() override {}
__forceinline int forceInlineTest() const { return 42; }
};
// -- expand/stringify macros --
TEST_F(PreprocessorToolsTest, expand) {
int abc = 2;
EXPECT_EQ(999, _P_EXPAND(999));
EXPECT_EQ(2.5, _P_EXPAND(2.5));
EXPECT_STREQ("abc", _P_EXPAND("abc"));
EXPECT_EQ(abc, _P_EXPAND(abc));
}
TEST_F(PreprocessorToolsTest, stringify) {
EXPECT_STREQ("999", _P_STRINGIFY(999));
EXPECT_STREQ("2.5", _P_STRINGIFY(2.5));
EXPECT_STREQ("abc", _P_STRINGIFY(abc));
}
// -- variadic macros --
TEST_F(PreprocessorToolsTest, getFirstArg) {
int abc = 2, def = 4;
EXPECT_EQ(5, _P_GET_FIRST_ARG(5, 7, 9, 11));
EXPECT_EQ(5, _P_GET_FIRST_ARG(5));
EXPECT_EQ(2.5, _P_GET_FIRST_ARG(2.5, 2.7, 2.9, 2.11));
EXPECT_EQ(2.5, _P_GET_FIRST_ARG(2.5));
EXPECT_STREQ("abc", _P_GET_FIRST_ARG("abc", "def"));
EXPECT_STREQ("abc", _P_GET_FIRST_ARG("abc"));
EXPECT_EQ(abc, _P_GET_FIRST_ARG(abc, def));
EXPECT_EQ(def, _P_GET_FIRST_ARG(def));
EXPECT_EQ(5, _P_GET_FIRST_ARG(5, 7.5, "abc", def));
}
TEST_F(PreprocessorToolsTest, dropFirstArg) {
std::vector<int> arrayInt { _P_DROP_FIRST_ARG(5, 7, 9, 11) };
ASSERT_EQ(size_t{ 3u }, arrayInt.size());
EXPECT_EQ(7, arrayInt[0]);
EXPECT_EQ(9, arrayInt[1]);
EXPECT_EQ(11, arrayInt[2]);
std::vector<double> arrayDec { _P_DROP_FIRST_ARG(2.5, 2.7, 2.9, 2.11) };
ASSERT_EQ(size_t{ 3u }, arrayDec.size());
EXPECT_EQ(2.7, arrayDec[0]);
EXPECT_EQ(2.9, arrayDec[1]);
EXPECT_EQ(2.11, arrayDec[2]);
std::vector<std::string> arrayStr { _P_DROP_FIRST_ARG("abc", "def", "ghi") };
ASSERT_EQ(size_t{ 2u }, arrayStr.size());
EXPECT_EQ(std::string("def"), arrayStr[0]);
EXPECT_EQ(std::string("ghi"), arrayStr[1]);
std::vector<int> arrayEmpty { _P_DROP_FIRST_ARG(5) };
EXPECT_EQ(size_t{ 0 }, arrayEmpty.size());
}
TEST_F(PreprocessorToolsTest, getArgCount) {
EXPECT_EQ(4, _P_GET_ARG_COUNT(5, 7, 9, 11));
EXPECT_EQ(4, _P_GET_ARG_COUNT(2.5, 2.7, 2.9, 2.11));
EXPECT_EQ(3, _P_GET_ARG_COUNT("abc", "def", "ghi"));
EXPECT_EQ(4, _P_GET_ARG_COUNT(5, 2.7, "def", "ghi"));
}
#define _FOREACH_TEST(x) |x
TEST_F(PreprocessorToolsTest, foreach) {
int abc = 5 _P_FOREACH(_FOREACH_TEST, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
EXPECT_EQ((5|0|1|2|3|4|5|6|7|8|9), abc);
}
#undef _FOREACH_TEST
#define _FOREACH_TEST(x) +x
TEST_F(PreprocessorToolsTest, foreachString) {
std::string abc = std::string("a") _P_FOREACH(_FOREACH_TEST, "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k");
ASSERT_EQ(size_t{ 101u }, abc.size());
EXPECT_EQ(std::string("abcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijkbcdefghijk"), abc);
}
#undef _FOREACH_TEST
TEST_F(PreprocessorToolsTest, foreachComma) {
std::vector<int> array{ _P_FOREACH_COMMA(_P_EXPAND, 1, 2, 3, 4, 5, 6, 7, 8) };
ASSERT_EQ(size_t{ 8u }, array.size());
for (int i = 0; static_cast<size_t>(i) < array.size(); ++i)
EXPECT_EQ(i+1, array[i]);
}
TEST_F(PreprocessorToolsTest, foreachCommaString) {
std::vector<std::string> array{ _P_FOREACH_COMMA(_P_EXPAND, "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"b", "c", "d", "e", "f", "g", "h", "i", "j", "k") };
ASSERT_EQ(size_t{ 100u }, array.size());
EXPECT_EQ("b", array[0]);
EXPECT_EQ("c", array[1]);
EXPECT_EQ("k", array[99]);
}
#define _FOREACH_TEST(x) counter+=x
TEST_F(PreprocessorToolsTest, foreachSemicolon) {
int counter = 0;
_P_FOREACH_SEMICOLON(_FOREACH_TEST, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
EXPECT_EQ(100, counter);
}
#undef _FOREACH_TEST
#define _FOREACH_TEST(val, x) +(val << x)
TEST_F(PreprocessorToolsTest, paramForeach) {
int abc = 5 _P_PARAM_FOREACH(_FOREACH_TEST, 1, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4,
0, 1, 2, 3, 4, 0, 1, 2, 3, 4);
EXPECT_EQ(5+20*0x1F, abc);
}
#undef _FOREACH_TEST
// -- enumerations --
enum class DummyEnum: uint32_t {
a,
b,
c,
d,
e,
f,
ghi
};
_P_LIST_ENUM_VALUES(DummyEnum, all, a, b, c, d, e, f, ghi);
_P_LIST_ENUM_VALUES(DummyEnum, repeat, a, a, b, b, a, b);
_P_LIST_ENUM_VALUES(DummyEnum, odd, ghi, e, c, a);
_P_SERIALIZABLE_ENUM(DummyEnum, a, b, c, d, e, f, ghi);
_P_SERIALIZABLE_ENUM_BUFFER(DummyEnum, a, b, c, d, e, f, ghi);
TEST_F(PreprocessorToolsTest, listEnumValues) {
ASSERT_EQ(size_t{ 7u }, DummyEnum_all().size());
EXPECT_EQ(DummyEnum::a, DummyEnum_all()[0]);
EXPECT_EQ(DummyEnum::b, DummyEnum_all()[1]);
EXPECT_EQ(DummyEnum::c, DummyEnum_all()[2]);
EXPECT_EQ(DummyEnum::d, DummyEnum_all()[3]);
EXPECT_EQ(DummyEnum::e, DummyEnum_all()[4]);
EXPECT_EQ(DummyEnum::f, DummyEnum_all()[5]);
EXPECT_EQ(DummyEnum::ghi, DummyEnum_all()[6]);
ASSERT_EQ(size_t{ 6u }, DummyEnum_repeat().size());
EXPECT_EQ(DummyEnum::a, DummyEnum_repeat()[0]);
EXPECT_EQ(DummyEnum::a, DummyEnum_repeat()[1]);
EXPECT_EQ(DummyEnum::b, DummyEnum_repeat()[2]);
EXPECT_EQ(DummyEnum::b, DummyEnum_repeat()[3]);
EXPECT_EQ(DummyEnum::a, DummyEnum_repeat()[4]);
EXPECT_EQ(DummyEnum::b, DummyEnum_repeat()[5]);
ASSERT_EQ(size_t{ 4u }, DummyEnum_odd().size());
EXPECT_EQ(DummyEnum::ghi, DummyEnum_odd()[0]);
EXPECT_EQ(DummyEnum::e, DummyEnum_odd()[1]);
EXPECT_EQ(DummyEnum::c, DummyEnum_odd()[2]);
EXPECT_EQ(DummyEnum::a, DummyEnum_odd()[3]);
}
TEST_F(PreprocessorToolsTest, fromSerializableEnum) {
EXPECT_EQ(std::string("a"), toString(DummyEnum::a));
EXPECT_EQ(std::string("b"), toString(DummyEnum::b));
EXPECT_EQ(std::string("c"), toString(DummyEnum::c));
EXPECT_EQ(std::string("d"), toString(DummyEnum::d));
EXPECT_EQ(std::string("e"), toString(DummyEnum::e));
EXPECT_EQ(std::string("f"), toString(DummyEnum::f));
EXPECT_EQ(std::string("ghi"), toString(DummyEnum::ghi));
EXPECT_EQ(std::string(""), toString((DummyEnum)123456));
bool result = false;
result = (memcmp("a", toString<DummyEnum::a>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("b", toString<DummyEnum::b>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("c", toString<DummyEnum::c>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("d", toString<DummyEnum::d>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("e", toString<DummyEnum::e>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("f", toString<DummyEnum::f>(), size_t{ 2u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("ghi", toString<DummyEnum::ghi>(), size_t{ 4u }) == 0);
EXPECT_TRUE(result);
result = (memcmp("", toString<(DummyEnum)123456>(), size_t{ 1u }) == 0);
EXPECT_TRUE(result);
}
TEST_F(PreprocessorToolsTest, fromSerializableEnumBuffered) {
char buffer[256]{ 0 };
EXPECT_EQ(std::string("a"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::a)));
EXPECT_EQ(std::string("b"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::b)));
EXPECT_EQ(std::string("c"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::c)));
EXPECT_EQ(std::string("d"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::d)));
EXPECT_EQ(std::string("e"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::e)));
EXPECT_EQ(std::string("f"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::f)));
EXPECT_EQ(std::string("ghi"), std::string(toString(buffer, size_t{ 256u }, DummyEnum::ghi)));
EXPECT_EQ(std::string("g"), std::string(toString(buffer, size_t{ 2u }, DummyEnum::ghi)));
EXPECT_EQ(std::string(""), std::string(toString(buffer, size_t{ 256u }, (DummyEnum)123456)));
}
TEST_F(PreprocessorToolsTest, toSerializableEnum) {
DummyEnum result = DummyEnum::a;
EXPECT_TRUE(fromString("a", result));
EXPECT_EQ(DummyEnum::a, result);
EXPECT_TRUE(fromString("b", result));
EXPECT_EQ(DummyEnum::b, result);
EXPECT_TRUE(fromString("c", result));
EXPECT_EQ(DummyEnum::c, result);
EXPECT_TRUE(fromString("d", result));
EXPECT_EQ(DummyEnum::d, result);
EXPECT_TRUE(fromString("e", result));
EXPECT_EQ(DummyEnum::e, result);
EXPECT_TRUE(fromString("f", result));
EXPECT_EQ(DummyEnum::f, result);
EXPECT_TRUE(fromString("ghi", result));
EXPECT_EQ(DummyEnum::ghi, result);
EXPECT_FALSE(fromString("azerty", result));
EXPECT_EQ(DummyEnum::ghi, result);
}
TEST_F(PreprocessorToolsTest, toSerializableEnumBuffered) {
DummyEnum result = DummyEnum::a;
EXPECT_TRUE(fromString("a", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::a, result);
EXPECT_TRUE(fromString("b", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::b, result);
EXPECT_TRUE(fromString("c", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::c, result);
EXPECT_TRUE(fromString("d", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::d, result);
EXPECT_TRUE(fromString("e", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::e, result);
EXPECT_TRUE(fromString("f", size_t{ 1u }, result));
EXPECT_EQ(DummyEnum::f, result);
EXPECT_TRUE(fromString("ghi", size_t{ 3u }, result));
EXPECT_EQ(DummyEnum::ghi, result);
EXPECT_FALSE(fromString("azerty", size_t{ 6u }, result));
EXPECT_EQ(DummyEnum::ghi, result);
}
TEST_F(PreprocessorToolsTest, toFromSerializableListedEnum) {
DummyEnum result = DummyEnum::a;
for (auto it : DummyEnum_all()) {
EXPECT_TRUE(fromString(toString(it), result));
EXPECT_EQ(it, result);
}
}
TEST_F(PreprocessorToolsTest, toFromSerializableListedEnumBuffered) {
char buffer[256]{ 0 };
DummyEnum result = DummyEnum::a;
for (auto it : DummyEnum_all()) {
EXPECT_TRUE(fromString(toString(buffer, size_t{ 256u }, it), (it == DummyEnum::ghi) ? size_t{ 3u } : size_t{ 1u }, result));
EXPECT_EQ(it, result);
}
}
// -- flags --
enum class FlagEnum: uint32_t {
none = 0,
b = 1,
c = 2,
d = 4,
e = 8
};
_P_FLAGS_OPERATORS(FlagEnum, uint32_t);
TEST_F(PreprocessorToolsTest, flagCompare) {
EXPECT_TRUE(FlagEnum::none != true);
EXPECT_TRUE(FlagEnum::b == true);
EXPECT_TRUE(FlagEnum::c == true);
EXPECT_TRUE(FlagEnum::d == true);
EXPECT_TRUE(FlagEnum::none == false);
EXPECT_TRUE(FlagEnum::b != false);
EXPECT_TRUE(FlagEnum::c != false);
EXPECT_TRUE(FlagEnum::d != false);
EXPECT_FALSE(FlagEnum::none < FlagEnum::none);
EXPECT_TRUE(FlagEnum::none <= FlagEnum::none);
EXPECT_FALSE(FlagEnum::none > FlagEnum::none);
EXPECT_TRUE(FlagEnum::none >= FlagEnum::none);
EXPECT_TRUE(FlagEnum::none < FlagEnum::b);
EXPECT_TRUE(FlagEnum::none <= FlagEnum::b);
EXPECT_FALSE(FlagEnum::none > FlagEnum::b);
EXPECT_FALSE(FlagEnum::none >= FlagEnum::b);
EXPECT_TRUE(FlagEnum::b < FlagEnum::d);
EXPECT_TRUE(FlagEnum::b <= FlagEnum::d);
EXPECT_FALSE(FlagEnum::b > FlagEnum::d);
EXPECT_FALSE(FlagEnum::b >= FlagEnum::d);
}
TEST_F(PreprocessorToolsTest, flagOperation) {
EXPECT_EQ(FlagEnum::none, FlagEnum::none&FlagEnum::b);
EXPECT_EQ(FlagEnum::b, FlagEnum::none|FlagEnum::b);
EXPECT_EQ(FlagEnum::b, FlagEnum::none^FlagEnum::b);
EXPECT_EQ(((uint32_t)-1) ^ 1, (uint32_t)~FlagEnum::b);
EXPECT_EQ(FlagEnum::none, FlagEnum::b&FlagEnum::c);
EXPECT_EQ(3, (int)(FlagEnum::b|FlagEnum::c));
EXPECT_EQ(3, (int)(FlagEnum::b^FlagEnum::c));
EXPECT_EQ(FlagEnum::c, (FlagEnum)(3)&FlagEnum::c);
EXPECT_EQ(3, (int)((FlagEnum)3|FlagEnum::c));
EXPECT_EQ(FlagEnum::b, (FlagEnum)(3)^FlagEnum::c);
FlagEnum abc = FlagEnum::b;
abc &= FlagEnum::b;
EXPECT_EQ(FlagEnum::b, abc);
abc |= FlagEnum::c;
EXPECT_EQ(3, (int)abc);
abc ^= FlagEnum::c;
EXPECT_EQ(FlagEnum::b, abc);
abc &= FlagEnum::d;
EXPECT_EQ(FlagEnum::none, abc);
}
TEST_F(PreprocessorToolsTest, flagAddRemove) {
FlagEnum abc = FlagEnum::none;
addFlag(abc, FlagEnum::b);
EXPECT_EQ(FlagEnum::b, abc);
addFlag(abc, FlagEnum::c);
EXPECT_EQ(3, (int)abc);
removeFlag(abc, FlagEnum::c);
EXPECT_EQ(FlagEnum::b, abc);
}
// -- duplication --
TEST_F(PreprocessorToolsTest, duplicate) {
int abc = 0 _P_DUPLICATE_64X(+1);
EXPECT_EQ(64, abc);
abc = 0 _P_DUPLICATE_48X(+1);
EXPECT_EQ(48, abc);
abc = 0 _P_DUPLICATE_24X(+1);
EXPECT_EQ(24, abc);
abc = 0 _P_DUPLICATE_12X(+1);
EXPECT_EQ(12, abc);
abc = 0 _P_DUPLICATE_10X(+1);
EXPECT_EQ(10, abc);
abc = 0 _P_DUPLICATE_9X(+1);
EXPECT_EQ(9, abc);
abc = 0 _P_DUPLICATE_7X(+1);
EXPECT_EQ(7, abc);
}
TEST_F(PreprocessorToolsTest, duplicateComma) {
std::vector<int> array{ _P_DUPLICATE_64X_COMMA(42) };
EXPECT_EQ(size_t{ 64u }, array.size());
for (auto it : array) {
EXPECT_EQ(42, it);
}
array = { _P_DUPLICATE_48X_COMMA(42) };
EXPECT_EQ(size_t{ 48u }, array.size());
array = { _P_DUPLICATE_24X_COMMA(42) };
EXPECT_EQ(size_t{ 24u }, array.size());
array = { _P_DUPLICATE_12X_COMMA(42) };
EXPECT_EQ(size_t{ 12u }, array.size());
array = { _P_DUPLICATE_10X_COMMA(42) };
EXPECT_EQ(size_t{ 10u }, array.size());
array = { _P_DUPLICATE_9X_COMMA(42) };
EXPECT_EQ(size_t{ 9u }, array.size());
array = { _P_DUPLICATE_7X_COMMA(42) };
EXPECT_EQ(size_t{ 7u }, array.size());
}
TEST_F(PreprocessorToolsTest, duplicateSemicolon) {
int counter = 0;
_P_DUPLICATE_64X_SEMICOLON(++counter);
EXPECT_EQ(64, counter);
counter = 0;
_P_DUPLICATE_48X_SEMICOLON(++counter);
EXPECT_EQ(48, counter);
counter = 0;
_P_DUPLICATE_24X_SEMICOLON(++counter);
EXPECT_EQ(24, counter);
counter = 0;
_P_DUPLICATE_12X_SEMICOLON(++counter);
EXPECT_EQ(12, counter);
counter = 0;
_P_DUPLICATE_10X_SEMICOLON(++counter);
EXPECT_EQ(10, counter);
counter = 0;
_P_DUPLICATE_9X_SEMICOLON(++counter);
EXPECT_EQ(9, counter);
counter = 0;
_P_DUPLICATE_7X_SEMICOLON(++counter);
EXPECT_EQ(7, counter);
}
// -- force inline --
TEST_F(PreprocessorToolsTest, forceInlineMethod) {
EXPECT_EQ(42, forceInlineTest());
}
#if !defined(_MSC_VER) && !defined(__clang__) && defined(__GNUG__) && __GNUC__ > 5
# pragma GCC diagnostic pop
#endif
| 38.462366 | 135 | 0.601342 | vinders |
9645aa2ab6dbd5e765fff8cc431bc20f5a56dfb0 | 6,234 | cpp | C++ | src/sigspm/spmtest.cpp | Hexlord/sig | 50be810f3f56e79e56110165972b7911d7519281 | [
"Apache-2.0"
] | null | null | null | src/sigspm/spmtest.cpp | Hexlord/sig | 50be810f3f56e79e56110165972b7911d7519281 | [
"Apache-2.0"
] | null | null | null | src/sigspm/spmtest.cpp | Hexlord/sig | 50be810f3f56e79e56110165972b7911d7519281 | [
"Apache-2.0"
] | null | null | null | # pragma once
# include <sig/gs_vars.h>
# include <sig/sn_poly_editor.h>
# include <sig/sn_lines.h>
# include <sigogl/gl_texture.h>
# include <sigogl/gl_resources.h>
# include <sigogl/ui_radio_button.h>
# include <sigogl/ws_viewer.h>
# include <sigogl/ws_run.h>
# include "spm_manager.h"
class SpmViewer : public WsViewer
{ public: // ui:
enum MenuEv { EvBuild, EvAutoBuild, EvMode, EvExit };
UiRadioButton *_obstbut, *_sinkbut;
UiCheckButton *_abbut;
public: // scene:
SnPolygons *_domain;
SnPolyEditor *_sinks;
SnPolyEditor *_obstacles;
SnPlanarObjects* SpmPlane;
SnLines *_path;
public: // spm data:
GlTexture SpmTexture;
ShortestPathMap* Spm;
ShortestPathMapManager SpmManager;
std::vector<GsVec> SpmPath;
public:
SpmViewer ( int x, int y, int w, int h, const char* l );
void refresh () { render(); ws_fast_check(); }
void build ();
void get_path ( float x, float y );
virtual int uievent ( int e ) override;
virtual int handle_scene_event ( const GsEvent& e ) override;
};
static void polyeditor_callback ( SnPolyEditor* pe, SnPolyEditor::Event e, int pid )
{
SpmViewer* v = (SpmViewer*)pe->userdata();
if ( !v->_abbut->value() ) return;
if ( e==SnPolyEditor::PostMovement || e==SnPolyEditor::PostEdition ||
e==SnPolyEditor::PostInsertion || e==SnPolyEditor::PostRemoval )
{ v->build();
if ( !v->_path->empty() ) v->get_path( v->SpmPath[0].x, v->SpmPath[0].y );
}
}
SpmViewer::SpmViewer ( int x, int y, int w, int h, const char* l ) : WsViewer( x, y, w, h, l )
{
// Define domain boundaries:
const float minx=-12, miny=-12, maxx=12, maxy=12;
// Define a plane to display the spm as a texture:
SnGroup* g = rootg();
g->add ( SpmPlane = new SnPlanarObjects ); // will initialize plane after 1st spm is built
GsRect rect ( minx, miny, maxx-minx, maxy-miny );
SpmPlane->zcoordinate = -0.01f;
SpmPlane->start_group ( SnPlanarObjects::Textured, 0 ); // texture id will be set after ogl is initialized
SpmPlane->push_rect ( rect, GsColor::gray );
SpmPlane->setT ( 0, GsPnt2( 0, 0 ), GsPnt2( 1, 0 ), GsPnt2( 1, 1 ), GsPnt2( 0, 1 ) );
// Define the non-editable domain polygon:
g->add ( _domain = new SnPolygons );
_domain->push().rectangle ( minx, miny, maxx, maxy );
_domain->draw_mode ( 0, 0 );
_domain->ecolor ( GsColor::black );
// Define an editable initial sink segment:
g->add ( _sinks = new SnPolyEditor );
_sinks->polygons()->push().setpoly ( "5 -5 5 5", true ); // the SPM sink
_sinks->solid_drawing ( 0 );
_sinks->polyline_mode ( true );
_sinks->min_polygons ( 1 ); // need to always have a source
_sinks->set_limits ( minx, maxx, miny, maxy );
_sinks->mode ( SnPolyEditor::ModeNoEdition );
_sinks->callback ( polyeditor_callback, this );
// Define an editable obstacle:
g->add ( _obstacles = new SnPolyEditor );
_obstacles->solid_drawing ( 0 );
_obstacles->set_limits ( minx, maxx, miny, maxy );
_obstacles->callback ( polyeditor_callback, this );
_obstacles->polygons()->push().setpoly ( "-2 -5 0 0 -2 5" ); // define one obstacle
// Define scene node to show a path:
g->add ( _path = new SnLines );
// Initiaze Spm objects:
Spm = 0;
SpmManager.SetDomain ( _domain->cget(0) );
SpmManager.SetEnv ( _obstacles->polygons(), _sinks->polygons() );
GlResources::configuration()->add("oglfuncs",500); // need to load more OpenGL functions then the default number
const char* shadersfolder = 0;//"../src/sigspm/shaders/"; // Use this to load external shaders
if ( shadersfolder )
{ SpmManager.SetShadersFolder ( shadersfolder ); // to load shaders instead of using the pre-defined ones
if ( !SpmManager.CanLoadShaders() ) gsout.fatal("Cannot find spm shaders in: %s",shadersfolder);
}
// Build ui:
UiPanel *p, *sp;
p = uim()->add_panel ( 0, UiPanel::HorizLeft, UiPanel::Top );
p->add ( new UiButton ( "build", EvBuild ) );
p->add ( new UiButton ( "mode", sp=new UiPanel(0,UiPanel::Vertical) ) );
{ UiPanel* p=sp;
p->add( _obstbut=new UiRadioButton( "obstacles", EvMode, true ) );
p->add( _sinkbut=new UiRadioButton( "sink", EvMode, false ) );
p->add ( _abbut=new UiCheckButton ( "auto build", EvAutoBuild, true ) ); p->top()->separate();
}
p->add ( new UiButton ( "exit", EvExit ) ); p->top()->separate();
}
void SpmViewer::build ()
{
activate_ogl_context();
Spm = SpmManager.Compute ( glrenderer()->glcontext(), Spm );
//xxx: computation is not correct when there are no obstacles?
SpmTexture.data ( Spm->GetMapBuffer(), Spm->Width(), Spm->Height(), GlTexture::Linear );
SpmPlane->G[0].texid = SpmTexture.id; // only needed for first time the id is created
}
void SpmViewer::get_path ( float x, float y )
{
if ( !Spm ) return;
Spm->GetShortestPath ( x, y, SpmPath );
_path->init ();
_path->line_width ( 2.0f );
_path->color ( GsColor::red );
_path->begin_polyline();
for ( int i=0, s=SpmPath.size(); i<s; i++ ) _path->push(SpmPath[i]);
_path->end_polyline();
}
int SpmViewer::uievent ( int e )
{
switch ( e )
{ case EvMode:
_obstacles->mode ( _obstbut->value()? SnPolyEditor::ModeEdit : SnPolyEditor::ModeNoEdition );
_sinks->mode ( _sinkbut->value()? SnPolyEditor::ModeEdit : SnPolyEditor::ModeNoEdition );
break;
case EvAutoBuild: if ( _abbut->value() ) { build(); refresh(); } break;
case EvBuild: build(); refresh(); break;
case EvExit: gs_exit();
}
return WsViewer::uievent(e);
}
int SpmViewer::handle_scene_event ( const GsEvent& e )
{
if ( Spm && e.alt && e.button1 && (e.type==GsEvent::Push||e.type==GsEvent::Drag) )
{ get_path ( e.mousep.x, e.mousep.y );
render();
return 1;
}
return WsViewer::handle_scene_event(e);
}
int main ( int argc, char** argv )
{
SpmViewer* v = new SpmViewer( -1, -1, 800, 600, "SIG SPM!" );
v->cmd ( WsViewer::VCmdPlanar );
GsCamera cam;
v->camera().eye.z = 25.0f;
v->root()->visible(false); // do not show unitialized texture that will contain the spm
v->show (); // request window to show
v->refresh (); // forces window to show and OpenGL to initialize now
v->root()->visible(true); // after initialization we can draw the scene
v->build (); // now we can use OpenGL to draw the first spm
v->message ( "Press Esc to switch between polygon creation and edition mode. Alt-left click to query path." );
ws_run ();
return 1;
}
| 34.441989 | 113 | 0.675008 | Hexlord |
96471df8a208257b172268172b40cd98a5fd3e76 | 2,953 | hpp | C++ | products/PurePhone/services/db/include/db/ServiceDB.hpp | SP2FET/MuditaOS-1 | 2906bb8a2fb3cdd39b167e600f6cc6d9ce1327bd | [
"BSL-1.0"
] | 1 | 2021-11-11T22:56:43.000Z | 2021-11-11T22:56:43.000Z | products/PurePhone/services/db/include/db/ServiceDB.hpp | SP2FET/MuditaOS-1 | 2906bb8a2fb3cdd39b167e600f6cc6d9ce1327bd | [
"BSL-1.0"
] | null | null | null | products/PurePhone/services/db/include/db/ServiceDB.hpp | SP2FET/MuditaOS-1 | 2906bb8a2fb3cdd39b167e600f6cc6d9ce1327bd | [
"BSL-1.0"
] | null | null | null | // Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <service-db/DBServiceName.hpp>
#include <service-db/ServiceDBCommon.hpp>
class AlarmEventRecordInterface;
class AlarmsRecordInterface;
class CalllogDB;
class CalllogRecordInterface;
class ContactRecordInterface;
class ContactsDB;
class CountryCodeRecordInterface;
class CountryCodesDB;
class DatabaseAgent;
class EventsDB;
class NotesDB;
class NotesRecordInterface;
class NotificationsDB;
class NotificationsRecordInterface;
class SMSRecordInterface;
class SMSTemplateRecordInterface;
class SettingsDB;
class SmsDB;
class ThreadRecordInterface;
namespace Quotes
{
class QuotesAgent;
}
namespace db::multimedia_files
{
class MultimediaFilesDB;
class MultimediaFilesRecordInterface;
} // namespace db::multimedia_files
class ServiceDB : public ServiceDBCommon
{
public:
~ServiceDB() override;
bool StoreIntoBackup(const std::filesystem::path &backupPath);
private:
std::unique_ptr<EventsDB> eventsDB;
std::unique_ptr<SmsDB> smsDB;
std::unique_ptr<ContactsDB> contactsDB;
std::unique_ptr<NotesDB> notesDB;
std::unique_ptr<CalllogDB> calllogDB;
std::unique_ptr<CountryCodesDB> countryCodesDB;
std::unique_ptr<NotificationsDB> notificationsDB;
std::unique_ptr<Database> quotesDB;
std::unique_ptr<db::multimedia_files::MultimediaFilesDB> multimediaFilesDB;
std::unique_ptr<AlarmEventRecordInterface> alarmEventRecordInterface;
std::unique_ptr<SMSRecordInterface> smsRecordInterface;
std::unique_ptr<ThreadRecordInterface> threadRecordInterface;
std::unique_ptr<SMSTemplateRecordInterface> smsTemplateRecordInterface;
std::unique_ptr<ContactRecordInterface> contactRecordInterface;
std::unique_ptr<NotesRecordInterface> notesRecordInterface;
std::unique_ptr<CalllogRecordInterface> calllogRecordInterface;
std::unique_ptr<CountryCodeRecordInterface> countryCodeRecordInterface;
std::unique_ptr<NotificationsRecordInterface> notificationsRecordInterface;
std::unique_ptr<Quotes::QuotesAgent> quotesRecordInterface;
std::unique_ptr<db::multimedia_files::MultimediaFilesRecordInterface> multimediaFilesRecordInterface;
db::Interface *getInterface(db::Interface::Name interface) override;
sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;
sys::ReturnCodes InitHandler() override;
};
namespace sys
{
template <> struct ManifestTraits<ServiceDB>
{
static auto GetManifest() -> ServiceManifest
{
ServiceManifest manifest;
manifest.name = service::name::db;
#if ENABLE_FILEINDEXER_SERVICE
manifest.dependencies = {service::name::file_indexer};
#endif
manifest.timeout = std::chrono::minutes{1};
return manifest;
}
};
} // namespace sys
| 32.450549 | 105 | 0.772773 | SP2FET |
9649ef28c41a5d2316e8dbc02492efc189ff18b7 | 389 | cpp | C++ | Logistics/2-D Transformations/Translate.cpp | amrii1/Computer-Graphics | 597b4ab061b57d222e54c01a7adf2799cb889f3a | [
"MIT"
] | 27 | 2020-01-18T02:30:40.000Z | 2022-03-13T17:15:38.000Z | Logistics/2-D Transformations/Translate.cpp | KINGRANDOLPH/Computer-Graphics | 509d2b06a34d9988e6c866eb6f900a56167f78ac | [
"MIT"
] | 5 | 2019-12-13T14:08:05.000Z | 2020-08-11T15:31:54.000Z | Logistics/2-D Transformations/Translate.cpp | KINGRANDOLPH/Computer-Graphics | 509d2b06a34d9988e6c866eb6f900a56167f78ac | [
"MIT"
] | 16 | 2019-12-17T08:28:42.000Z | 2021-10-31T03:47:54.000Z | #include<iostream>
using namespace std;
int main()
{
int x,y,tx,ty;
cout<<"Translation";
cout<<"Enter point to be translated\n";
cout<<"x: ";
cin>>x;
cout<<"y: ";
cin>>y;
cout<<"Enter the translation factors\n";
cout<<"tx: ";
cin>>tx;
cout<<"ty: ";
cin>>ty;
//Translate
x=x+tx;
y=y+ty;
//
cout<<"Point after translation\n";
cout<<"x: "<<x<<endl;
cout<<"y: "<<y<<endl;
}
| 15.56 | 41 | 0.580977 | amrii1 |
964c616723335f4c83822526c277ffb11d238bd9 | 455 | hpp | C++ | include/xvega/grammar/marks/mark_rule.hpp | domoritz/xvega | 3754dee3e7e38e79282ba267cd86c3885807a4cd | [
"BSD-3-Clause"
] | 34 | 2020-08-14T14:32:51.000Z | 2022-02-16T23:20:02.000Z | include/xvega/grammar/marks/mark_rule.hpp | domoritz/xvega | 3754dee3e7e38e79282ba267cd86c3885807a4cd | [
"BSD-3-Clause"
] | 19 | 2020-08-20T20:04:39.000Z | 2022-02-28T14:34:37.000Z | include/xvega/grammar/marks/mark_rule.hpp | domoritz/xvega | 3754dee3e7e38e79282ba267cd86c3885807a4cd | [
"BSD-3-Clause"
] | 7 | 2020-08-14T14:18:17.000Z | 2022-02-01T10:59:24.000Z | // Copyright (c) 2020, QuantStack and XVega Contributors
//
// Distributed under the terms of the BSD 3-Clause License.
//
// The full license is in the file LICENSE, distributed with this software.
#ifndef XVEGA_MARK_RULE_HPP
#define XVEGA_MARK_RULE_HPP
#include "../marks.hpp"
namespace xv
{
struct mark_rule : public mark<mark_rule>
{
XVEGA_API mark_rule();
};
XVEGA_API void to_json(nl::json&, const mark_rule&);
}
#endif
| 19.782609 | 75 | 0.707692 | domoritz |
9654c62959de7600e8de907ad5a6839bd3b48315 | 585 | hpp | C++ | ClassicProblem/reFibonacci.hpp | shaneliu-zf/CodeBook | 0c30e46f5661051d523c621eac9740d6dcbab440 | [
"MIT"
] | 3 | 2020-12-15T12:34:29.000Z | 2020-12-15T21:21:33.000Z | ClassicProblem/reFibonacci.hpp | shane-liu-1010/CodeBook | 0c30e46f5661051d523c621eac9740d6dcbab440 | [
"MIT"
] | null | null | null | ClassicProblem/reFibonacci.hpp | shane-liu-1010/CodeBook | 0c30e46f5661051d523c621eac9740d6dcbab440 | [
"MIT"
] | null | null | null | int reFibonacci(int n){
union{
double d;
long long lld;
}log2={0x23C6EF372FE951P-52*n};
int result=((log2.lld>>52)-0x3FF)/0xB1B9D68A8E5338P-56;
double power=0x727C9716FFB764P-56;
int i=(result+3)/4;
switch(result%4){
case 0:do{ power*=0x19E3779B97F4A8P-52;
case 3: power*=0x19E3779B97F4A8P-52;
case 2: power*=0x19E3779B97F4A8P-52;
case 1: power*=0x19E3779B97F4A8P-52;
}while(--i>0);
}
int ans=power+0x1P-1<n?power*0x19E3779B97F4A8P-52+0x1P-1<n?result+2:result+1:result;
return ans;
}
| 30.789474 | 88 | 0.620513 | shaneliu-zf |
9657b0ece15c4e4552b441526a981b1f5613f3fe | 6,270 | cpp | C++ | wxGUI/ctrl_partition_list.cpp | Null665/partmod | 11f2b90c745e27bdb47b105e0bf45834c62d3527 | [
"BSD-3-Clause"
] | 1 | 2017-02-12T15:10:38.000Z | 2017-02-12T15:10:38.000Z | wxGUI/ctrl_partition_list.cpp | Null665/partmod | 11f2b90c745e27bdb47b105e0bf45834c62d3527 | [
"BSD-3-Clause"
] | 1 | 2016-06-03T18:20:16.000Z | 2016-10-10T22:22:41.000Z | wxGUI/ctrl_partition_list.cpp | Null665/partmod | 11f2b90c745e27bdb47b105e0bf45834c62d3527 | [
"BSD-3-Clause"
] | null | null | null | #include "ctrl_partition_list.h"
#include "../Partmod/numstr.h"
#include <algorithm>
using std::sort;
bool cmp_lv(lvlist a,lvlist b)
{
return strtoull((char*)a.begin_sect.c_str(),0,10) < strtoull((char*)b.begin_sect.c_str(),0,10);
}
wxPartitionList::wxPartitionList(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString &name) : wxListView(parent,winid,pos,size,style,validator,name)
{
InsertColumn(0,_("Partition #"),0,70);
InsertColumn(1,_("Type"),0,100);
InsertColumn(2,_("FS type"),0,90);
InsertColumn(3,_("Size"),0,70);
//InsertColumn(4,_("Free"),0,70);
InsertColumn(5,_("First sect."),0,80);
InsertColumn(6,_("Last sect."),0,80);
InsertColumn(7,_("Mount point"),0,100);
disk=NULL;
}
wxPartitionList::~wxPartitionList()
{
//dtor
}
void wxPartitionList::AssignDisk(Disk *disk)
{
this->disk=disk;
}
int wxPartitionList::GetSelectedPartition()
{
if(disk==NULL)
return -1;
if(disk_structure[this->GetFocusedItem()].selection_type==S_PARTITION)
return disk_structure[this->GetFocusedItem()].num;
else return -1;
}
int wxPartitionList::GetSelectedFreeSpace()
{
if(disk==NULL)
return -1;
if(disk_structure[this->GetFocusedItem()].selection_type==S_FREE_SPACE)
return disk_structure[this->GetFocusedItem()].num;
else return -1;
}
void wxPartitionList::Refresh()
{
this->DeleteAllItems();
disk_structure.clear();
if(disk==NULL)
return;
if(disk->IsOpen()==false)
return;
for(int i=0;i<disk->CountPartitions();i++)
{
GEN_PART gpart=disk->GetPartition(i);
lvlist tmp;
if(gpart.flags&PART_PRIMARY && gpart.flags&PART_ACTIVE)
tmp.type="Primary (Active)";
else if(gpart.flags&PART_PRIMARY)
tmp.type="Primary";
else if(gpart.flags&PART_EXTENDED)
tmp.type="Extended MBR";
else if(gpart.flags&PART_LOGICAL)
tmp.type="Logical";
else if(gpart.flags&PART_MBR_GPT)
tmp.type="GUID part. table";
else if(gpart.flags&PART_GPT)
tmp.type="GPT partition";
if(gpart.flags&PART_EXTENDED || gpart.flags&PART_MBR_GPT)
tmp.mountpoint="";
else
tmp.mountpoint=get_mount_point(gpart,disk->GetDiskSignature());
tmp.partition=to_string(i+1);
tmp.begin_sect=to_string(gpart.begin_sector);
tmp.last_sect=to_string(gpart.begin_sector+gpart.length);
tmp.free="N/A";
if(gpart.flags&PART_PRIMARY || gpart.flags&PART_EXTENDED || gpart.flags&PART_MBR_GPT || gpart.flags&PART_LOGICAL)
{
try{
tmp.fs_type=disk->fsid_man->GetByFsid(disk->GetMBRSpecific(i).fsid).description;
}catch(DiskException &de)
{
if(de.error_code==ERR_UNKNOWN_FSID)
{
std::string new_type= "[unknown 0x"+to_string(disk->GetMBRSpecific(i).fsid,STR_HEX)+"]";
disk->fsid_man->Add(disk->GetMBRSpecific(i).fsid,new_type,0,0,0/*OR MSDOS FSID?*/);
tmp.fs_type=new_type;
}
else throw de;
}
}
else if(gpart.flags&PART_GPT)
{
try{
tmp.fs_type=disk->guid_man->GetDescription(disk->GetGPTSpecific(i).type_guid);
}catch(...)
{
tmp.fs_type="[unknown guid]";
}
}
else tmp.fs_type="[unknown]";
tmp.num=i;
tmp.selection_type=S_PARTITION;
tmp.flags=gpart.flags;
tmp.size=size_str(gpart.length,disk->GetDiskGeometry().bps).c_str();
disk_structure.push_back(tmp);
}
for(int i=0;i<disk->CountFreeSpaces();i++)
{
FREE_SPACE frs=disk->GetFreeSpace(i);
lvlist tmp;
tmp.partition="-";
tmp.type="Free space";
tmp.fs_type="";
tmp.mountpoint="";
tmp.begin_sect=to_string(frs.begin_sector);
tmp.last_sect=to_string(frs.begin_sector+frs.length);
tmp.flags=frs.type;
tmp.selection_type=S_FREE_SPACE;
tmp.num=i;
tmp.size=size_str(frs.length,disk->GetDiskGeometry().bps).c_str();
disk_structure.push_back(tmp);
}
sort(disk_structure.begin(),disk_structure.end(),cmp_lv);
for(int i=0;i<disk_structure.size();i++)
{
lvlist tmp=disk_structure[i];
this->InsertItem(i,tmp.partition.c_str(),-1);
this->SetItem(i,1,tmp.type.c_str(),-1);
this->SetItem(i,2,tmp.fs_type.c_str(),-1);
this->SetItem(i,3,tmp.size.c_str(),-1);
// this->SetItem(i,4,tmp.free.c_str(),-1);
this->SetItem(i,4,tmp.begin_sect.c_str(),-1);
this->SetItem(i,5,tmp.last_sect.c_str(),-1);
this->SetItem(i,6,tmp.mountpoint.c_str(),-1);
if(tmp.selection_type==S_FREE_SPACE)
{
if(tmp.flags!=FREE_UNALLOCATED)
this->SetItemTextColour(i,wxColor(50,130,50));
else this->SetItemTextColour(i,wxColor(50,50,50));
}
else
{
if(tmp.flags&PART_PRIMARY)
this->SetItemTextColour(i,wxColor(1,6,203));
else if(tmp.flags&PART_EXTENDED || tmp.flags&PART_MBR_GPT)
this->SetItemTextColour(i,wxColor(240,0,0));
else if(tmp.flags&PART_LOGICAL || tmp.flags&PART_GPT)
this->SetItemTextColour(i,wxColor(140,90,140));
}
}
}
void wxPartitionList::HideMountPoint(bool hide)
{
static bool col_hidden=false;
if(hide && col_hidden==false)
{
this->DeleteColumn(this->GetColumnCount()-1);
col_hidden=true;
}
else if( !hide && col_hidden==true)
{
InsertColumn(7,_("Mount point"),0,100);
col_hidden=false;
}
}
| 31.039604 | 123 | 0.560447 | Null665 |
965a24213b0e0cce210c5eefd6c24f5e1b0ef002 | 2,730 | hpp | C++ | DT3Core/Scripting/ScriptingParticleColorRandomizer.hpp | 9heart/DT3 | 4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e | [
"MIT"
] | 3 | 2018-10-05T15:03:27.000Z | 2019-03-19T11:01:56.000Z | DT3Core/Scripting/ScriptingParticleColorRandomizer.hpp | pakoito/DT3 | 4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e | [
"MIT"
] | null | null | null | DT3Core/Scripting/ScriptingParticleColorRandomizer.hpp | pakoito/DT3 | 4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e | [
"MIT"
] | 3 | 2016-01-14T07:51:52.000Z | 2021-08-21T08:02:51.000Z | #ifndef DT3_SCRIPTINGPARTICLECOLORRANDOMIZER
#define DT3_SCRIPTINGPARTICLECOLORRANDOMIZER
//==============================================================================
///
/// File: ScriptingParticleColorRandomizer.hpp
///
/// Copyright (C) 2000-2014 by Smells Like Donkey Software Inc. All rights reserved.
///
/// This file is subject to the terms and conditions defined in
/// file 'LICENSE.txt', which is part of this source code package.
///
//==============================================================================
#include "DT3Core/Scripting/ScriptingBase.hpp"
//==============================================================================
//==============================================================================
namespace DT3 {
//==============================================================================
/// Forward declarations
//==============================================================================
class Particles;
//==============================================================================
/// Color Randomizer for Particle System.
//==============================================================================
class ScriptingParticleColorRandomizer: public ScriptingBase {
public:
DEFINE_TYPE(ScriptingParticleColorRandomizer,ScriptingBase)
DEFINE_CREATE_AND_CLONE
DEFINE_PLUG_NODE
ScriptingParticleColorRandomizer (void);
ScriptingParticleColorRandomizer (const ScriptingParticleColorRandomizer &rhs);
ScriptingParticleColorRandomizer& operator = (const ScriptingParticleColorRandomizer &rhs);
virtual ~ScriptingParticleColorRandomizer (void);
virtual void archive (const std::shared_ptr<Archive> &archive);
public:
/// Called to initialize the object
virtual void initialize (void);
/// Computes the value of the node
/// \param plug plug to compute
DTboolean compute (const PlugBase *plug);
DEFINE_ACCESSORS(r_mag, set_r_mag, DTfloat, _r_mag);
DEFINE_ACCESSORS(g_mag, set_g_mag, DTfloat, _g_mag);
DEFINE_ACCESSORS(b_mag, set_b_mag, DTfloat, _b_mag);
DEFINE_ACCESSORS(a_mag, set_a_mag, DTfloat, _a_mag);
private:
static const DTint NUM_ENTRIES = 8;
DTfloat _r_mag;
DTfloat _g_mag;
DTfloat _b_mag;
DTfloat _a_mag;
Plug<std::shared_ptr<Particles>> _in;
Plug<std::shared_ptr<Particles>> _out;
};
//==============================================================================
//==============================================================================
} // DT3
#endif
| 35.454545 | 107 | 0.476923 | 9heart |
965acb9105b85009cae75d76f715acec39a19fe4 | 6,485 | cpp | C++ | sdl1/kiloblaster/src/2b_editr.cpp | pdpdds/sdldualsystem | d74ea84cbea705fef62868ba8c693bf7d2555636 | [
"BSD-2-Clause"
] | null | null | null | sdl1/kiloblaster/src/2b_editr.cpp | pdpdds/sdldualsystem | d74ea84cbea705fef62868ba8c693bf7d2555636 | [
"BSD-2-Clause"
] | null | null | null | sdl1/kiloblaster/src/2b_editr.cpp | pdpdds/sdldualsystem | d74ea84cbea705fef62868ba8c693bf7d2555636 | [
"BSD-2-Clause"
] | null | null | null | // 2B_EDITR.C
//
// Kiloblaster v.2 Editor
//
// Written by Allen W. Pilgrim
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include "include/gr.h"
#include "include/keyboard.h"
#include "include/windows.h"
#include "include/gamectrl.h"
#include "include/kconfig.h"
#include "include/2blaster.h"
int16_t x, y, cell;
extern char cfgfname[];
extern char ext[];
void fill_brd (void);
void infname (char *msg, char *fname, int16_t num) {
fontcolor (&statvp, 10, 0);
clearvp (&statvp);
wprint (&statvp, 2, 2, 1, msg);
fontcolor (&statvp, 13, 0);
if (num) wprint (&statvp, 4, 26, 2, "NO EXT.");
winput (&statvp, 0, 14, 2, fname, 8);
};
void edit_brd (void) {
int16_t tempint;
int16_t lastcell = b_blank; // last placed item on the board
char tempstr[12]; // temporary string, used for input
char tempfname[12];
tempstr[0] = '\0';
tempfname[0] = '\0';
init_brd (); clrvp (&cmdvp, 0); clrvp (&statvp, 0);
x = 0, y = 0, cell = 0;
if (pcx_sh==0) loadboard ("menu");
drawboard ();
fontcolor (&cmdvp, 14, 0);
wprint (&cmdvp, 2, 4, 1, "L");
wprint (&cmdvp, 2, 16, 1, "S");
wprint (&cmdvp, 2, 28, 1, "A");
wprint (&cmdvp, 2, 40, 1, "C");
wprint (&cmdvp, 2, 52, 1, "F");
wprint (&cmdvp, 4, 76, 2, "<space>");
wprint (&cmdvp, 4, 98, 2, "<enter>");
fontcolor (&cmdvp, 13, 0);
wprint (&cmdvp, 10, 4, 1, "OAD");
wprint (&cmdvp, 10, 16, 1, "AVE");
wprint (&cmdvp, 10, 28, 1, "DD");
wprint (&cmdvp, 10, 40, 1, "LEAR");
wprint (&cmdvp, 10, 52, 1, "ILL");
fontcolor (&cmdvp, 11, 0);
wprint (&cmdvp, 0, 64, 1, "REPEAT");
wprint (&cmdvp, 8, 86, 1, "COPY");
do {
drawshape (&gamevp, 0x4400 + 16, x * 16, y * 16); // cursor
checkctrl0 (0);
drawcell (x, y); // draw board cell (erases cursor!)
x += dx1; y += dy1;
if (x < 0) x = 0; // bounds checking routine
if (x >= end_x) x = end_x - 1;
if (y < 0) y = 0;
if (y >= end_y) y = end_y - 1;
switch (toupper(key)) {
case 'A' : // A = add new background
clearvp (&statvp);
wprint (&statvp, 2, 2, 1, "NAME:");
winput (&statvp, 2, 14, 1, tempstr, 5);
_strupr (tempstr);
for (tempint = 0; tempint < b_maxbkgnd; tempint++) {
if (strcmp (tempstr, info[tempint].na) == 0) {
board[x][y] = tempint;
lastcell = tempint;
};
}; break;
case ' ' : // SPACE = put down last background again
board[x][y] = lastcell;
break;
case 13 : // RETURN = 'pick up' whatever is under cursor
lastcell = board[x][y];
break;
case 'F' : // Fills entire screen with selected pattern
fill_brd ();
for (x = 0; x < end_x; x++) {
for (y = 0; y < end_y; y++) {
board[x][y] = cell;
};
};
drawboard (); break;
case 'C' : // clears screen and sets everything to "0"
init_brd ();
x = 0, y = 0, cell = 0; break;
case 'Z':
infname ("LOAD:", tempfname, 0);
if (tempfname[0] != '\0') {
loadbrd (tempfname);
drawboard ();
}; break;
case 'L':
infname ("LOAD:", tempfname, 1);
if (tempfname[0] != '\0') {
loadboard (tempfname);
drawboard ();
}; break;
case 'S':
infname ("SAVE:", tempfname, 1);
if (tempfname[0] != '\0') saveboard (tempfname); break;
};
key = (toupper(key));
} while (key != escape);
}
/*
void init_brd (void) {
int16_t x, y;
clrvp (&gamevp, 0);
for (x = 0; x < end_x; x++) {
for (y = 0; y < end_y; y++) {
board[x][y] = 0;
modflg[x][y] = 0;
};
};
};
*/
/*
void drawboard (void) {
int16_t x, y;
statmodflg = 0;
refresh (0);
};
void drawcell (int16_t x, int16_t y) {
if (board[x][y]==0) {
drawshape (&gamevp, pcx_sh + x + y * 16, x * 16, y * 16);
}
else {
drawshape (&gamevp, info[board[x][y]].sh, x * 16, y * 16);
};
}
*/
void fill_brd () {
cell = getch();
switch (cell) {
case '0': cell = 0; break; // blank
case '1': cell = 1; break; // wall1
case '2': cell = 2; break; // wall2
case '3': cell = 3; break; // wall3
case '4': cell = 4; break; // wall4
case '5': cell = 5; break; // wall5
case '6': cell = 6; break; // wall6
case '7': cell = 7; break; // wall7
case '8': cell = 8; break; // wall8
case '9': cell = 9; break; // wall9
case 'a': cell = 10; break; // walla
case 'b': cell = 11; break; // wallb
case 'c': cell = 12; break; // wallc
case 'd': cell = 13; break; // walld
case 'e': cell = 14; break; // walle
case 'f': cell = 15; break; // wallf
default : cell = 0; break; // default
};
};
void loadbrd (char *fname) { // loads a board with .BAK extension
FILE* boardfile;
char dest[12];
char *src1 = ".bak";
strcpy(dest, fname);
strcat(dest, src1);
boardfile = fopen (dest, O_BINARY);
if (!fread (&board, 1, sizeof(board), boardfile))
; // rexit(1);
fclose (boardfile);
};
/*
void loadboard (char *fname) { // loads a board with .BRD extension
int16_t boardfile;
char dest[12];
char *src1 = ext;
strcpy(dest, fname);
strcat(dest, src1);
boardfile = _open (dest, O_BINARY);
if (!read (boardfile, &board, sizeof(board))); // rexit(1);
_close (boardfile);
};
void saveboard (char *fname) { // saves a board with .BRD extension
int16_t boardfile;
char dest[12]; char dest2[12];
char *src1 = ext; char *src2 = ".bak";
strcpy(dest, fname); strcat(dest, src1);
strcpy(dest2, fname); strcat(dest2, src2);
boardfile = creatnew (dest, 0);
if (boardfile== -1) {
rename (dest, dest2);
boardfile = _creat (dest, 0);
if (!write (boardfile, &board, sizeof(board))) rexit(5);
}
else {
if (!write (boardfile, &board, sizeof(board))) rexit(5);
};
_close (boardfile);
};
void loadcfg (void) {
int16_t cfgfile, c;
char ourname[64];
// strcpy (ourname, path);
strcpy (ourname, cfgfname);
cfgfile = _open (ourname, O_BINARY);
if ((cfgfile < 0) || (filelength(cfgfile) <= 0)) {
for (c = 0; c < numhighs; c++) {hiname[c][0]='\0'; hiscore[c]=0;};
for (c = 0; c < numsaves; c++) {savename[c][0]='\0';};
cf.firstthru = 1;
}
else {
read (cfgfile, &hiname, sizeof(hiname));
read (cfgfile, &hiscore, sizeof(hiscore));
read (cfgfile, &savename, sizeof(savename));
if (read (cfgfile, &cf, sizeof (cf)) < 0) cf.firstthru = 1;
};
close (cfgfile);
};
void savecfg (void) {
int16_t cfgfile;
char ourname[64];
// strcpy (ourname, path);
strcpy (ourname, cfgfname);
cfgfile = _creat (ourname, 0);
if (cfgfile >= 0) {
write (cfgfile, &hiname, sizeof(hiname));
write (cfgfile, &hiscore, sizeof(hiscore));
write (cfgfile, &savename, sizeof(savename));
write (cfgfile, &cf, sizeof (cf));
};
close (cfgfile);
};
*/
| 24.846743 | 68 | 0.578412 | pdpdds |
965ca6279cac1e760ea9faafa930f71c56e5d994 | 9,743 | cpp | C++ | src/resource/resource_manager.cpp | sndrz/glen | 398fbc146c92a2fa36433e9a9865344bc4c23c6e | [
"MIT"
] | null | null | null | src/resource/resource_manager.cpp | sndrz/glen | 398fbc146c92a2fa36433e9a9865344bc4c23c6e | [
"MIT"
] | null | null | null | src/resource/resource_manager.cpp | sndrz/glen | 398fbc146c92a2fa36433e9a9865344bc4c23c6e | [
"MIT"
] | null | null | null | #include "../../includes/resource/resource_manager.hpp"
#include "../../includes/render/shader_program.hpp"
#include "../../includes/render/texture2d.hpp"
#include "../../includes/render/sprite.hpp"
#include "../includes/logger.hpp"
#include <sstream>
#include <fstream>
#include <iostream>
#include <vector>
#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_PNG
#include "../../external/stb_image.h"
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
ResourceManager::ShaderProgramsMap ResourceManager::shaderPrograms;
ResourceManager::TexturesMap ResourceManager::textures;
ResourceManager::SpritesMap ResourceManager::m_sprites;
std::string ResourceManager::path;
void ResourceManager::SetExecutablePath(const std::string& executablePath) {
size_t slashPosition = executablePath.find_last_of("/\\");
path = executablePath.substr(0, slashPosition);
} // endof ResourceManager::SetExecutablePath()
void ResourceManager::UnloadAllResources() {
shaderPrograms.clear();
textures.clear();
m_sprites.clear();
} // endof ResourceManager::UnloadAllResources()
std::string ResourceManager::GetFileString(const std::string& relativeFilePath) {
std::ifstream f;
f.open(path + "/" + relativeFilePath.c_str(), std::ios::in | std::ios::binary);
if (!f.is_open()) {
LOG_CRITICAL("Failed to open file: {}", relativeFilePath);
return std::string{};
}
std::stringstream buffer;
buffer << f.rdbuf();
return buffer.str();
} // ResourceManager::GetFileString()
std::shared_ptr<render::ShaderProgram> ResourceManager::LoadShaders(const std::string& shaderName, const std::string& vertexPath, const std::string& fragmentPath) {
std::string vertexString = GetFileString(vertexPath);
if (vertexString.empty()) {
LOG_ERROR("No vertex shader");
return nullptr;
}
std::string fragmentString = GetFileString(fragmentPath);
if (fragmentString.empty()) {
LOG_ERROR("No fragment shader");
return nullptr;
}
std::shared_ptr<render::ShaderProgram>& newShader = shaderPrograms.emplace(shaderName, std::make_shared<render::ShaderProgram>(vertexString, fragmentString)).first->second;
if (newShader->IsCompiled()) {
return newShader;
}
LOG_ERROR("Can't load shader program:\nVertex: {0}\nFragment: {1}", vertexPath, fragmentPath);
return nullptr;
} // ResourceManager::LoadShaders
std::shared_ptr<render::ShaderProgram> ResourceManager::GetShaderProgram(const std::string& shaderName) {
ShaderProgramsMap::const_iterator it = shaderPrograms.find(shaderName);
if (it != shaderPrograms.end()) {
return it->second;
}
LOG_ERROR("Can't find shader program: {}", shaderName);
return nullptr;
} // ResourceManager::GetShaderProgram
std::shared_ptr<render::Texture2D> ResourceManager::LoadTexture(const std::string& textureName, const std::string& texturePath) {
int channels = 0;
int width = 0;
int height = 0;
stbi_set_flip_vertically_on_load(true);
unsigned char* pixels = stbi_load(std::string(path + "/" + texturePath).c_str(), &width, &height, &channels, 0);
if (!pixels) {
LOG_ERROR("Can't load image: {}", texturePath);
return nullptr;
}
std::shared_ptr<render::Texture2D> newTexture = textures.emplace(textureName, std::make_shared<render::Texture2D>(width, height, pixels, channels, GL_NEAREST, GL_CLAMP_TO_EDGE)).first->second;
stbi_image_free(pixels);
return newTexture;
} // ResourceManager::LoadTexture
std::shared_ptr<render::Texture2D> ResourceManager::GetTexture(const std::string& textureName) {
TexturesMap::const_iterator it = textures.find(textureName);
if (it != textures.end()) {
return it->second;
}
LOG_ERROR("Can't find texture: {}", textureName);
return nullptr;
} // ResourceManager::GetTexture
std::shared_ptr<render::Sprite> ResourceManager::LoadSprite(const std::string& spriteName,
const std::string& textureName,
const std::string& shaderName,
const std::string& subTextureName) {
auto pTexture = GetTexture(textureName);
if (!pTexture) {
std::cerr << "Can't find texture: " << textureName << " for sprite: " << spriteName << std::endl;
}
auto pShader = GetShaderProgram(shaderName);
if (!pShader) {
std::cerr << "Can't find shader: " << shaderName << " for sprite: " << spriteName << std::endl;
}
std::shared_ptr<render::Sprite> newSprite = m_sprites.emplace(spriteName,
std::make_shared<render::Sprite>(pTexture,
subTextureName,
pShader)).first->second;
return newSprite;
} // ResourceManager::LoadSprite
std::shared_ptr<render::Sprite> ResourceManager::GetSprite(const std::string& spriteName) {
SpritesMap::const_iterator it = m_sprites.find(spriteName);
if (it != m_sprites.end()) {
return it->second;
}
std::cerr << "Can't find sprite: " << spriteName << std::endl;
return nullptr;
} // ResourceManager::GetSprite
std::shared_ptr<render::Texture2D> ResourceManager::LoadTextureAtlas(const std::string& textureName,
const std::string& texturePath,
std::vector<std::string> subTextures,
const unsigned int subTextureWidth,
const unsigned int subTextureHeight) {
auto pTexture = LoadTexture(std::move(textureName), std::move(texturePath));
if (pTexture) {
const unsigned int textureWidth = pTexture->GetWidth();
const unsigned int textureHeight = pTexture->GetHeight();
unsigned int currentTextureOffsetX = 0;
unsigned int currentTextureOffsetY = textureHeight;
for (auto& currentSubTextureName : subTextures) {
glm::vec2 leftBottomUV(static_cast<float>(currentTextureOffsetX + 0.01f) / textureWidth,
static_cast<float>(currentTextureOffsetY - subTextureHeight + 0.01f) / textureHeight);
glm::vec2 rightTopUV(static_cast<float>(currentTextureOffsetX + subTextureWidth - 0.01f) / textureWidth,
static_cast<float>(currentTextureOffsetY - 0.01f) / textureHeight);
pTexture->AddSubTexture(std::move(currentSubTextureName), leftBottomUV, rightTopUV);
currentTextureOffsetX += subTextureWidth;
if (currentTextureOffsetX >= textureWidth) {
currentTextureOffsetX = 0;
currentTextureOffsetY = subTextureHeight;
}
} // for
} // if (pTexture)
return pTexture;
} // ResourceManager::LoadTextureAtlas
bool ResourceManager::LoadJSONResources(const std::string& JSONPath) {
const std::string JSONString = GetFileString(JSONPath);
if (JSONString.empty()) {
std::cerr << "No JSON resources file" << std::endl;
return false;
}
rapidjson::Document document;
rapidjson::ParseResult parseResult = document.Parse(JSONString.c_str());
if (!parseResult) {
std::cerr << "JSON parce error: " << rapidjson::GetParseError_En(parseResult.Code()) << "(" << parseResult.Offset() << ")" << std::endl;
std::cerr << "In JSON file: " << JSONPath << std::endl;
return false;
}
auto shadersIt = document.FindMember("shaders");
if (shadersIt != document.MemberEnd()) {
for (const auto& currentShader : shadersIt->value.GetArray()) {
const std::string name = currentShader["name"].GetString();
const std::string filePath_v = currentShader["filePath_v"].GetString();
const std::string filePath_f = currentShader["filePath_f"].GetString();
LoadShaders(name, filePath_v, filePath_f);
}
} // endof if shadersIt
auto textureAtlasesIt = document.FindMember("textureAtlases");
if (textureAtlasesIt != document.MemberEnd()) {
for (const auto& currentTextureAtlas : textureAtlasesIt->value.GetArray()) {
const std::string name = currentTextureAtlas["name"].GetString();
const std::string filePath = currentTextureAtlas["filePath"].GetString();
const unsigned int subTextureWidth = currentTextureAtlas["subTextureWidth"].GetUint();
const unsigned int subTextureHeight = currentTextureAtlas["subTextureHeight"].GetUint();
const auto subTexturesArray = currentTextureAtlas["subTextures"].GetArray();
std::vector<std::string> subTextures;
subTextures.reserve(subTexturesArray.Size());
for (const auto & currentSubTexture : subTexturesArray) {
subTextures.emplace_back(currentSubTexture.GetString());
}
LoadTextureAtlas(name, filePath, std::move(subTextures), subTextureWidth, subTextureHeight);
} // endof for currentTextureAtlas
} // endof if textureAtlasesIt
auto spritesIt = document.FindMember("sprites");
if (spritesIt != document.MemberEnd()) {
for (const auto& currentSprite : spritesIt->value.GetArray()) {
const std::string name = currentSprite["name"].GetString();
const std::string textureAtlas = currentSprite["textureAtlas"].GetString();
const std::string shader = currentSprite["shader"].GetString();
const std::string initialSubTexture = currentSprite["initialSubTexture"].GetString();
auto pSprite = LoadSprite(name, textureAtlas, shader, initialSubTexture);
if (!pSprite) { continue; }
auto framesIt = currentSprite.FindMember("frames");
if (framesIt != document.MemberEnd()) {
const auto framesArray = framesIt->value.GetArray();
std::vector<render::Sprite::FrameDescription> framesDescription;
framesDescription.reserve(framesArray.Size());
for (const auto& currentFrame : framesArray) {
const std::string subTexture = currentFrame["subTexture"].GetString();
const uint64_t duration = currentFrame["duration"].GetUint64();
const auto pTextureAtlas = GetTexture(textureAtlas);
const auto pSubTexture = pTextureAtlas->GetSubTexture(subTexture);
framesDescription.emplace_back(pSubTexture.leftBottomUV, pSubTexture.rightTopUV, duration);
}
pSprite->InsertFrames(std::move(framesDescription));
} // endof if
} // endof for currentAnimatedSprite
} // endof if animatedSpritesIt
return true;
} // endof ResourceManager::LoadJSONResources() | 41.815451 | 193 | 0.725136 | sndrz |
9660835c2012e72569a4a4f893a430e82ea2076b | 2,939 | cpp | C++ | src/game/client/swarm/vgui/playerswaitingpanel.cpp | BlueNovember/alienswarm-reactivedrop | ffaca58157f9fdd36e5c48e8d7d34d8ca958017e | [
"CC0-1.0"
] | null | null | null | src/game/client/swarm/vgui/playerswaitingpanel.cpp | BlueNovember/alienswarm-reactivedrop | ffaca58157f9fdd36e5c48e8d7d34d8ca958017e | [
"CC0-1.0"
] | null | null | null | src/game/client/swarm/vgui/playerswaitingpanel.cpp | BlueNovember/alienswarm-reactivedrop | ffaca58157f9fdd36e5c48e8d7d34d8ca958017e | [
"CC0-1.0"
] | null | null | null | #include "cbase.h"
#include "PlayersWaitingPanel.h"
#include "vgui/isurface.h"
#include <KeyValues.h>
#include <vgui_controls/Label.h>
#include "c_asw_game_resource.h"
#include "c_playerresource.h"
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
PlayersWaitingPanel::PlayersWaitingPanel(vgui::Panel *parent, const char *panelName) :
vgui::Panel(parent, panelName)
{
m_pTitle = new vgui::Label(this, "Title", "#asw_commanders");
for (int i=0;i<ASW_MAX_READY_PLAYERS;i++)
{
m_pPlayerNameLabel[i] = new vgui::Label(this, "Ready", " ");
m_pPlayerReadyLabel[i] = new vgui::Label(this, "Ready", " ");
}
}
void PlayersWaitingPanel::PerformLayout()
{
int w, t;
//w = ScreenWidth() * 0.3f;
//t = ScreenHeight() * 0.3f;
//SetSize(w, t);
GetSize(w, t);
int row_height = 0.035f * ScreenHeight();
float fScale = ScreenHeight() / 768.0f;
int padding = fScale * 6.0f;
int title_wide = w - padding * 2;
m_pTitle->SetBounds(padding, padding, title_wide, row_height);
int name_wide = title_wide * 0.6f;
int ready_wide = title_wide * 0.4f;
for (int i=0;i<ASW_MAX_READY_PLAYERS;i++)
{
m_pPlayerNameLabel[i]->SetBounds(padding, (i+1) * (row_height) + padding, name_wide, row_height);
m_pPlayerReadyLabel[i]->SetBounds(padding + name_wide, (i+1) * (row_height) + padding, ready_wide, row_height);
}
}
void PlayersWaitingPanel::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
SetPaintBackgroundEnabled(true);
SetPaintBackgroundType(0);
SetBgColor(Color(0,0,0,128));
vgui::HFont DefaultFont = pScheme->GetFont( "Default", IsProportional() );
m_pTitle->SetFont(DefaultFont);
m_pTitle->SetFgColor(Color(255,255,255,255));
for (int i=0;i<ASW_MAX_READY_PLAYERS;i++)
{
m_pPlayerReadyLabel[i]->SetFont(DefaultFont);
m_pPlayerReadyLabel[i]->SetFgColor(pScheme->GetColor("LightBlue", Color(128,128,128,255)));
m_pPlayerNameLabel[i]->SetFont(DefaultFont);
m_pPlayerNameLabel[i]->SetFgColor(pScheme->GetColor("LightBlue", Color(128,128,128,255)));
}
}
void PlayersWaitingPanel::OnThink()
{
C_ASW_Game_Resource* pGameResource = ASWGameResource();
if (!pGameResource)
return;
// set labels and ready status from players
int iNumPlayersInGame = 0;
for ( int j = 1; j <= gpGlobals->maxClients; j++ )
{
if ( g_PR->IsConnected( j ) )
{
m_pPlayerNameLabel[iNumPlayersInGame]->SetText(g_PR->GetPlayerName(j));
bool bReady = pGameResource->IsPlayerReady(j);
if (bReady)
m_pPlayerReadyLabel[iNumPlayersInGame]->SetText("#asw_campaign_ready");
else
m_pPlayerReadyLabel[iNumPlayersInGame]->SetText("#asw_campaign_waiting");
iNumPlayersInGame++;
}
}
// hide further panels in
for (int j=iNumPlayersInGame;j<ASW_MAX_READY_PLAYERS;j++)
{
m_pPlayerNameLabel[j]->SetText("");
m_pPlayerReadyLabel[j]->SetText("");
}
} | 31.602151 | 114 | 0.696155 | BlueNovember |
9663569663a266aae9657999178e5c9e5cbced75 | 12,841 | cpp | C++ | RenderCore/Techniques/CommonResources.cpp | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | 3 | 2015-12-04T09:16:53.000Z | 2021-05-28T23:22:49.000Z | RenderCore/Techniques/CommonResources.cpp | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | null | null | null | RenderCore/Techniques/CommonResources.cpp | djewsbury/XLE | 7806e4b5c9de5631c94c2020f6adcd4bd8e3d91e | [
"MIT"
] | 2 | 2015-03-03T05:32:39.000Z | 2015-12-04T09:16:54.000Z | // Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
#include "CommonResources.h"
#include "CommonBindings.h"
#include "../IDevice.h"
#include "../Metal/Metal.h"
#include "../Metal/Resource.h" // for Metal::CompleteInitialization
#include "../Metal/DeviceContext.h" // for Metal::CompleteInitialization
#include "../../Utility/MemoryUtils.h"
#if GFXAPI_TARGET == GFXAPI_DX11
#include "TechniqueUtils.h" // just for sizeof(LocalTransformConstants)
#include "../Metal/ObjectFactory.h"
#endif
namespace RenderCore { namespace Techniques
{
DepthStencilDesc CommonResourceBox::s_dsReadWrite { CompareOp::GreaterEqual };
DepthStencilDesc CommonResourceBox::s_dsReadOnly { CompareOp::GreaterEqual, false };
DepthStencilDesc CommonResourceBox::s_dsDisable { CompareOp::Always, false };
DepthStencilDesc CommonResourceBox::s_dsReadWriteWriteStencil { CompareOp::GreaterEqual, true, true, 0xff, 0xff, StencilDesc::AlwaysWrite, StencilDesc::AlwaysWrite };
DepthStencilDesc CommonResourceBox::s_dsWriteOnly { CompareOp::Always, true };
DepthStencilDesc CommonResourceBox::s_dsReadWriteCloserThan { CompareOp::Greater }; // (ie, when reversed Z is the default, greater is closer)
AttachmentBlendDesc CommonResourceBox::s_abStraightAlpha { true, Blend::SrcAlpha, Blend::InvSrcAlpha, BlendOp::Add };
AttachmentBlendDesc CommonResourceBox::s_abAlphaPremultiplied { true, Blend::One, Blend::InvSrcAlpha, BlendOp::Add };
AttachmentBlendDesc CommonResourceBox::s_abOneSrcAlpha { true, Blend::One, Blend::SrcAlpha, BlendOp::Add };
AttachmentBlendDesc CommonResourceBox::s_abAdditive { true, Blend::One, Blend::One, BlendOp::Add };
AttachmentBlendDesc CommonResourceBox::s_abOpaque { };
RasterizationDesc CommonResourceBox::s_rsDefault { CullMode::Back };
RasterizationDesc CommonResourceBox::s_rsCullDisable { CullMode::None };
RasterizationDesc CommonResourceBox::s_rsCullReverse { CullMode::Back, FaceWinding::CW };
static uint64_t s_nextCommonResourceBoxGuid = 1;
static std::shared_ptr<IResource> CreateBlackResource(IDevice& device, const ResourceDesc& resDesc)
{
if (resDesc._type == ResourceDesc::Type::Texture) {
return device.CreateResource(resDesc);
} else {
std::vector<uint8_t> blank(ByteCount(resDesc), 0);
return device.CreateResource(resDesc, SubResourceInitData{MakeIteratorRange(blank)});
}
}
static std::shared_ptr<IResource> CreateWhiteResource(IDevice& device, const ResourceDesc& resDesc)
{
if (resDesc._type == ResourceDesc::Type::Texture) {
return device.CreateResource(resDesc);
} else {
std::vector<uint8_t> blank(ByteCount(resDesc), 0xff);
return device.CreateResource(resDesc, SubResourceInitData{MakeIteratorRange(blank)});
}
}
CommonResourceBox::CommonResourceBox(IDevice& device)
: _samplerPool(device)
, _guid(s_nextCommonResourceBoxGuid++)
{
using namespace RenderCore::Metal;
#if GFXAPI_TARGET == GFXAPI_DX11
_dssReadWrite = DepthStencilState();
_dssReadOnly = DepthStencilState(true, false);
_dssDisable = DepthStencilState(false, false);
_dssReadWriteWriteStencil = DepthStencilState(true, true, 0xff, 0xff, StencilMode::AlwaysWrite, StencilMode::AlwaysWrite);
_dssWriteOnly = DepthStencilState(true, true, CompareOp::Always);
_blendStraightAlpha = BlendState(BlendOp::Add, Blend::SrcAlpha, Blend::InvSrcAlpha);
_blendAlphaPremultiplied = BlendState(BlendOp::Add, Blend::One, Blend::InvSrcAlpha);
_blendOneSrcAlpha = BlendState(BlendOp::Add, Blend::One, Blend::SrcAlpha);
_blendAdditive = BlendState(BlendOp::Add, Blend::One, Blend::One);
_blendOpaque = BlendOp::NoBlending;
_defaultRasterizer = CullMode::Back;
_cullDisable = CullMode::None;
_cullReverse = RasterizerState(CullMode::Back, false);
_localTransformBuffer = MakeConstantBuffer(GetObjectFactory(), sizeof(LocalTransformConstants));
#endif
_linearClampSampler = device.CreateSampler(SamplerDesc{FilterMode::Trilinear, AddressMode::Clamp, AddressMode::Clamp});
_linearWrapSampler = device.CreateSampler(SamplerDesc{FilterMode::Trilinear, AddressMode::Wrap, AddressMode::Wrap});
_pointClampSampler = device.CreateSampler(SamplerDesc{FilterMode::Point, AddressMode::Clamp, AddressMode::Clamp});
_anisotropicWrapSampler = device.CreateSampler(SamplerDesc{FilterMode::Anisotropic, AddressMode::Wrap, AddressMode::Wrap});
_unnormalizedBilinearClampSampler = device.CreateSampler(SamplerDesc{FilterMode::Bilinear, AddressMode::Clamp, AddressMode::Clamp, AddressMode::Clamp, CompareOp::Never, SamplerDescFlags::UnnormalizedCoordinates});
_defaultSampler = _linearWrapSampler;
_black2DSRV = CreateBlackResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain2D(32, 32, Format::R8_UNORM), "black2d"))->CreateTextureView();
_black2DArraySRV = CreateBlackResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain2D(32, 32, Format::R8_UNORM, 1, 1), "black2darray"))->CreateTextureView();
_black3DSRV = CreateBlackResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain3D(8, 8, 8, Format::R8_UNORM), "black3d"))->CreateTextureView();
_blackCubeSRV = CreateBlackResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::PlainCube(32, 32, Format::R8_UNORM), "blackCube"))->CreateTextureView();
_blackCubeArraySRV = CreateBlackResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::PlainCube(32, 32, Format::R8_UNORM, 1, 6), "blackCubeArray"))->CreateTextureView();
_blackCB = CreateBlackResource(device, CreateDesc(BindFlag::ConstantBuffer, 0, GPUAccess::Read, LinearBufferDesc{256}, "blackbuffer"));
_blackBufferUAV = CreateBlackResource(device, CreateDesc(BindFlag::UnorderedAccess, 0, GPUAccess::Read, LinearBufferDesc{256, 16}, "blackbufferuav"))->CreateBufferView(BindFlag::UnorderedAccess);
_white2DSRV = CreateWhiteResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain2D(32, 32, Format::R8_UNORM), "white2d"))->CreateTextureView();
_white2DArraySRV = CreateWhiteResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain2D(32, 32, Format::R8_UNORM, 1, 1), "white2darray"))->CreateTextureView();
_white3DSRV = CreateWhiteResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::Plain3D(8, 8, 8, Format::R8_UNORM), "white3d"))->CreateTextureView();
_whiteCubeSRV = CreateWhiteResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::PlainCube(32, 32, Format::R8_UNORM), "whiteCube"))->CreateTextureView();
_whiteCubeArraySRV = CreateWhiteResource(device, CreateDesc(BindFlag::ShaderResource|BindFlag::TransferDst, 0, GPUAccess::Read, TextureDesc::PlainCube(32, 32, Format::R8_UNORM, 1, 6), "whiteCubeArray"))->CreateTextureView();
_pendingCompleteInitialization = true;
}
CommonResourceBox::~CommonResourceBox()
{}
void CommonResourceBox::CompleteInitialization(IThreadContext& threadContext)
{
if (!_pendingCompleteInitialization) return;
IResource* blackTextures[] {
_black2DSRV->GetResource().get(),
_black2DArraySRV->GetResource().get(),
_black3DSRV->GetResource().get(),
_blackCubeSRV->GetResource().get(),
_blackCubeArraySRV->GetResource().get()
};
IResource* whiteTextures[] {
_white2DSRV->GetResource().get(),
_white2DArraySRV->GetResource().get(),
_white3DSRV->GetResource().get(),
_whiteCubeSRV->GetResource().get(),
_whiteCubeArraySRV->GetResource().get()
};
auto& metalContext = *Metal::DeviceContext::Get(threadContext);
Metal::CompleteInitialization(metalContext, MakeIteratorRange(blackTextures));
Metal::CompleteInitialization(metalContext, MakeIteratorRange(whiteTextures));
// We also have to clear out data for the textures (since these can't be initialized
// in the construction operation)
// We might be able to do this with just a clear call on some APIs; but let's do it
// it hard way, anyway
size_t largest = 0;
for (const auto& res:blackTextures)
largest = std::max(largest, (size_t)ByteCount(res->GetDesc()));
for (const auto& res:whiteTextures)
largest = std::max(largest, (size_t)ByteCount(res->GetDesc()));
{
auto staging = CreateBlackResource(*threadContext.GetDevice(), CreateDesc(BindFlag::TransferSrc, 0, 0, LinearBufferDesc{(unsigned)largest}, "staging"));
auto encoder = metalContext.BeginBlitEncoder();
for (const auto& res:blackTextures)
encoder.Copy(*res, *staging);
}
{
auto staging = CreateWhiteResource(*threadContext.GetDevice(), CreateDesc(BindFlag::TransferSrc, 0, 0, LinearBufferDesc{(unsigned)largest}, "staging"));
auto encoder = metalContext.BeginBlitEncoder();
for (const auto& res:whiteTextures)
encoder.Copy(*res, *staging);
}
_pendingCompleteInitialization = false;
}
namespace AttachmentSemantics
{
const char* TryDehash(uint64_t hashValue)
{
switch (hashValue) {
case MultisampleDepth: return "MultisampleDepth";
case GBufferDiffuse: return "GBufferDiffuse";
case GBufferNormal: return "GBufferNormal";
case GBufferNormalPrev: return "GBufferNormalPrev";
case GBufferParameter: return "GBufferParameter";
case GBufferMotion: return "GBufferMotion";
case ColorLDR: return "ColorLDR";
case ColorHDR: return "ColorHDR";
case Depth: return "Depth";
case ShadowDepthMap: return "ShadowDepthMap";
case HierarchicalDepths: return "HierarchicalDepths";
case TiledLightBitField: return "TiledLightBitField";
case ConstHash64<'SSRe', 'flec', 'tion'>::Value: return "SSReflection";
case ConstHash64<'SSRe', 'flec', 'tion'>::Value+1: return "SSReflectionPrev";
case ConstHash64<'SSRC', 'onfi', 'denc', 'e'>::Value: return "SSRConfidence";
case ConstHash64<'SSRC', 'onfi', 'denc', 'e'>::Value+1: return "SSRConfidencePrev";
case ConstHash64<'SSRC', 'onfi', 'denc', 'eInt'>::Value: return "SSRConfidenceInt";
case ConstHash64<'SSRI', 'nt'>::Value: return "SSRInt";
case ConstHash64<'SSRD', 'ebug'>::Value: return "SSRDebug";
default: return nullptr;
}
}
}
namespace CommonSemantics
{
std::pair<const char*, unsigned> TryDehash(uint64_t hashValue)
{
if ((hashValue - POSITION) < 16) return std::make_pair("POSITION", unsigned(hashValue - POSITION));
if ((hashValue - PIXELPOSITION) < 16) return std::make_pair("PIXELPOSITION", unsigned(hashValue - PIXELPOSITION));
else if ((hashValue - TEXCOORD) < 16) return std::make_pair("TEXCOORD", unsigned(hashValue - TEXCOORD));
else if ((hashValue - COLOR) < 16) return std::make_pair("COLOR", unsigned(hashValue - COLOR));
else if ((hashValue - NORMAL) < 16) return std::make_pair("NORMAL", unsigned(hashValue - NORMAL));
else if ((hashValue - TEXTANGENT) < 16) return std::make_pair("TEXTANGENT", unsigned(hashValue - TEXTANGENT));
else if ((hashValue - TEXBITANGENT) < 16) return std::make_pair("TEXBITANGENT", unsigned(hashValue - TEXBITANGENT));
else if ((hashValue - BONEINDICES) < 16) return std::make_pair("BONEINDICES", unsigned(hashValue - BONEINDICES));
else if ((hashValue - BONEWEIGHTS) < 16) return std::make_pair("BONEWEIGHTS", unsigned(hashValue - BONEWEIGHTS));
else if ((hashValue - PER_VERTEX_AO) < 16) return std::make_pair("PER_VERTEX_AO", unsigned(hashValue - PER_VERTEX_AO));
else if ((hashValue - RADIUS) < 16) return std::make_pair("RADIUS", unsigned(hashValue - RADIUS));
else return std::make_pair(nullptr, ~0u);
}
}
}}
| 62.639024 | 232 | 0.696052 | djewsbury |
966417aa7ffa9a07a97bc85a1348824217b9e726 | 5,067 | cpp | C++ | OpenSHMEM/buffon.cpp | aljo242/nn_training | ce583cbf5a03ec10dbece768961863720f83093b | [
"Apache-2.0"
] | null | null | null | OpenSHMEM/buffon.cpp | aljo242/nn_training | ce583cbf5a03ec10dbece768961863720f83093b | [
"Apache-2.0"
] | null | null | null | OpenSHMEM/buffon.cpp | aljo242/nn_training | ce583cbf5a03ec10dbece768961863720f83093b | [
"Apache-2.0"
] | null | null | null | #include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <shmem.h>
static const double PI = 3.141592653589793238462643;
int
buffon_laplace_simulate(double a, double b, double l, int trial_num)
{
double angle;
int hits;
int trial;
double x1;
double x2;
double y1;
double y2;
hits = 0;
for (trial = 1; trial <= trial_num; ++trial) {
//
// Randomly choose the location of the eye of the needle in
// [0,0]x[A,B],
// and the angle the needle makes.
//
x1 = a * (double) rand() / (double) RAND_MAX;
y1 = b * (double) rand() / (double) RAND_MAX;
angle = 2.0 * PI * (double) rand() / (double) RAND_MAX;
//
// Compute the location of the point of the needle.
//
x2 = x1 + l * cos(angle);
y2 = y1 + l * sin(angle);
//
// Count the end locations that lie outside the cell.
//
if (x2 <= 0.0 || a <= x2 || y2 <= 0.0 || b <= y2) {
++hits;
}
}
return hits;
}
double
r8_abs(double x)
{
return (0.0 <= x) ? x : (-x);
}
double
r8_huge()
{
return 1.0E+30;
}
//
// symmetric variables for reduction
//
int pWrk[SHMEM_REDUCE_SYNC_SIZE];
long pSync[SHMEM_BCAST_SYNC_SIZE];
int hit_total;
int hit_num;
int
main()
{
const double a = 1.0;
const double b = 1.0;
const double l = 1.0;
const int master = 0;
double pdf_estimate;
double pi_error;
double pi_estimate;
int process_num;
int process_rank;
double random_value;
int seed;
int trial_num = 100000;
int trial_total;
//
// Initialize SHMEM.
//
shmem_init();
//
// Get the number of processes.
//
process_num = shmem_n_pes();
//
// Get the rank of this process.
//
process_rank = shmem_my_pe();
//
// The master process prints a message.
//
if (process_rank == master) {
std::cout << "\n";
std::cout << "BUFFON_LAPLACE - Master process:\n";
std::cout << " C++ version\n";
std::cout << "\n";
std::cout << " A SHMEM example program to estimate PI\n";
std::cout << " using the Buffon-Laplace needle experiment.\n";
std::cout << " On a grid of cells of width A and height B,\n";
std::cout << " a needle of length L is dropped at random.\n";
std::cout << " We count the number of times it crosses\n";
std::cout << " at least one grid line, and use this to estimate \n";
std::cout << " the value of PI.\n";
std::cout << "\n";
std::cout << " The number of processes is " << process_num << "\n";
std::cout << "\n";
std::cout << " Cell width A = " << a << "\n";
std::cout << " Cell height B = " << b << "\n";
std::cout << " Needle length L = " << l << "\n";
}
//
// added barrier here to force output sequence
//
shmem_barrier_all();
//
// Each process sets a random number seed.
//
seed = 123456789 + process_rank * 100;
srand(seed);
//
// Just to make sure that we're all doing different things, have each
// process print out its rank, seed value, and a first test random value.
//
random_value = (double) rand() / (double) RAND_MAX;
std::cout << " " << std::setw(8) << process_rank
<< " " << std::setw(12) << seed
<< " " << std::setw(14) << random_value << "\n";
//
// Each process now carries out TRIAL_NUM trials, and then
// sends the value back to the master process.
//
hit_num = buffon_laplace_simulate(a, b, l, trial_num);
//
// initialize sync buffer for reduction
//
for (int i = 0; i < SHMEM_BCAST_SYNC_SIZE; ++i) {
pSync[i] = SHMEM_SYNC_VALUE;
}
shmem_barrier_all();
shmem_int_sum_to_all(&hit_total, &hit_num, 1, 0, 0, process_num, pWrk,
pSync);
//
// The master process can now estimate PI.
//
if (process_rank == master) {
trial_total = trial_num * process_num;
pdf_estimate = (double) hit_total / (double) trial_total;
if (hit_total == 0) {
pi_estimate = r8_huge();
}
else {
pi_estimate = l * (2.0 * (a + b) - l) / (a * b * pdf_estimate);
}
pi_error = r8_abs(PI - pi_estimate);
std::cout << "\n";
std::cout <<
" Trials Hits Estimated PDF Estimated Pi Error\n";
std::cout << "\n";
std::cout << " " << std::setw(8) << trial_total
<< " " << std::setw(8) << hit_total
<< " " << std::setw(16) << pdf_estimate
<< " " << std::setw(16) << pi_estimate
<< " " << std::setw(16) << pi_error << "\n";
}
//
// Shut down
//
if (process_rank == master) {
std::cout << "\n";
std::cout << "BUFFON_LAPLACE - Master process:\n";
std::cout << " Normal end of execution.\n";
}
shmem_finalize();
return 0;
} | 26.253886 | 86 | 0.525755 | aljo242 |
966c21903180632e01bb45310a389af5a4677467 | 8,719 | cpp | C++ | src/wrapper/lua_qevent.cpp | nddvn2008/bullet-physics-playground | 2895af190054b6a38525b679cf3f241c7147ee6f | [
"Zlib"
] | 1 | 2015-10-05T01:25:18.000Z | 2015-10-05T01:25:18.000Z | src/wrapper/lua_qevent.cpp | nddvn2008/bullet-physics-playground | 2895af190054b6a38525b679cf3f241c7147ee6f | [
"Zlib"
] | null | null | null | src/wrapper/lua_qevent.cpp | nddvn2008/bullet-physics-playground | 2895af190054b6a38525b679cf3f241c7147ee6f | [
"Zlib"
] | 2 | 2015-01-02T20:02:13.000Z | 2018-02-26T03:08:43.000Z | #include "lua_qevent.h"
#include "luabind/dependency_policy.hpp"
namespace luabind{
QT_ENUM_CONVERTER(Qt::KeyboardModifiers)
QT_ENUM_CONVERTER(Qt::MouseButtons)
QT_ENUM_CONVERTER(Qt::MouseButton)
QT_ENUM_CONVERTER(Qt::DropAction)
QT_ENUM_CONVERTER(Qt::DropActions)
}
template<typename T>
bool isEvent(QEvent::Type type);
template<typename T>
struct myEventFilter : public QObject
{
myEventFilter(const object& obj):m_obj(obj){}
virtual bool eventFilter(QObject * obj, QEvent * event)
{
try{
if(isEvent<T>(event->type())){
T* evt = static_cast<T *>(event);
if(evt){
bool res = false;
if(type(m_obj) == LUA_TFUNCTION){
res = call_function<bool>(m_obj,obj,evt);
}else if(type(m_obj) == LUA_TTABLE){
object c,f;
for(iterator i(m_obj),e;i!=e;++i){
if(type(*i) == LUA_TUSERDATA){
c = *i;
}else if(type(*i) == LUA_TFUNCTION){
f = *i;
}else if(type(*i) == LUA_TSTRING){
f = *i;
}
}
if(f && c){
if(type(f) == LUA_TFUNCTION){
res = call_function<bool>(f,c,obj,evt);
}else if(type(f) == LUA_TSTRING){
res = call_member<bool>(c,object_cast<const char*>(f),obj,evt);
}
}
}
if(res) return res;
}
}
}catch(...){}
return QObject::eventFilter(obj,event);
}
private:
object m_obj;
};
template<>bool isEvent<QEvent>(QEvent::Type){ return true; }
template<>bool isEvent<QInputEvent>(QEvent::Type){ return true; }
template<>bool isEvent<QCloseEvent>(QEvent::Type type){ return type == QEvent::Close; }
template<>bool isEvent<QContextMenuEvent>(QEvent::Type type){ return type == QEvent::ContextMenu; }
template<>bool isEvent<QKeyEvent>(QEvent::Type type){ return type == QEvent::KeyPress || type == QEvent::KeyRelease; }
template<>bool isEvent<QMouseEvent>(QEvent::Type type){
switch(type){
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
return true;
default:
return false;
}
return false;
}
template<>bool isEvent<QWheelEvent>(QEvent::Type type){ return type == QEvent::Wheel; }
template<>bool isEvent<QPaintEvent>(QEvent::Type type){ return type == QEvent::Paint; }
template<>bool isEvent<QTimerEvent>(QEvent::Type type){ return type == QEvent::Timer; }
template<>bool isEvent<QResizeEvent>(QEvent::Type type){ return type == QEvent::Resize; }
template<>bool isEvent<QShowEvent>(QEvent::Type type){ return type == QEvent::Show; }
template<>bool isEvent<QHideEvent>(QEvent::Type type){ return type == QEvent::Hide; }
template<>bool isEvent<QDropEvent>(QEvent::Type type){ return type == QEvent::Drop; }
template<>bool isEvent<QDragEnterEvent>(QEvent::Type type){ return type == QEvent::DragEnter; }
template<>bool isEvent<QDragMoveEvent>(QEvent::Type type){ return type == QEvent::DragMove; }
template<>bool isEvent<QDragLeaveEvent>(QEvent::Type type){ return type == QEvent::DragLeave; }
template<typename T>
QObject* event_filter(const object& obj)
{
return new myEventFilter<T>(obj);
}
void lqevent_init_general(const luabind::argument & arg)
{
construct<QEvent>(arg,QEvent::Type(0));
}
LQEvent lqevent()
{
return
class_<QEvent>("QEvent")
.def("__init",lqevent_init_general)
.def(constructor<QEvent::Type>())
.def("accept", &QEvent::accept)
.def("ignore", &QEvent::ignore)
.property("type" , &QEvent::type)
.property("accepted" , &QEvent::isAccepted, &QEvent::setAccepted)
.scope[ def("filter", event_filter<QEvent>)]
;
}
LQInputEvent lqinputevent()
{
return
LQInputEvent("QInputEvent")
.property("modifiers", &QInputEvent::modifiers, &QInputEvent::setModifiers)
.scope[ def("filter", event_filter<QInputEvent>)]
;
}
LQCloseEvent lqcloseevent()
{
return
LQCloseEvent("QCloseEvent")
.scope[ def("filter", event_filter<QCloseEvent>)]
;
}
LQContextMenuEvent lqcontextmenuevent()
{
return
LQContextMenuEvent("QContextMenuEvent")
.property("globalPos", &QContextMenuEvent::globalPos)
.property("globalX", &QContextMenuEvent::globalX)
.property("globalY", &QContextMenuEvent::globalY)
.property("pos", &QContextMenuEvent::pos)
.property("x", &QContextMenuEvent::x)
.property("y", &QContextMenuEvent::y)
.property("reason", &QContextMenuEvent::reason)
.scope[ def("filter", event_filter<QContextMenuEvent>)]
;
}
LQKeyEvent lqkeyevent()
{
return
LQKeyEvent("QKeyEvent")
.def("matches", &QKeyEvent::matches)
.property("count", &QKeyEvent::count)
.property("autoRepeat", &QKeyEvent::isAutoRepeat)
.property("key", &QKeyEvent::key)
.property("text", &QKeyEvent::text)
.property("modifiers", &QKeyEvent::modifiers)
.scope[ def("filter", event_filter<QKeyEvent>)]
;
}
LQMouseEvent lqmouseevent()
{
return
LQMouseEvent("QMouseEvent")
.property("button", &QMouseEvent::button)
.property("buttons", &QMouseEvent::buttons)
.property("globalPos", &QMouseEvent::globalPos)
.property("globalX", &QMouseEvent::globalX)
.property("globalY", &QMouseEvent::globalY)
.property("pos", &QMouseEvent::pos)
.property("x", &QMouseEvent::x)
.property("y", &QMouseEvent::y)
.scope[ def("filter", event_filter<QMouseEvent>)]
;
}
LQWheelEvent lqwheelevent()
{
return
LQWheelEvent("QWheelEvent")
.property("buttons", &QWheelEvent::buttons)
.property("globalPos", &QWheelEvent::globalPos)
.property("globalX", &QWheelEvent::globalX)
.property("globalY", &QWheelEvent::globalY)
.property("pos", &QWheelEvent::pos)
.property("x", &QWheelEvent::x)
.property("y", &QWheelEvent::y)
.property("orientation", &QWheelEvent::orientation)
.scope[ def("filter", event_filter<QWheelEvent>)]
;
}
LQPaintEvent lqpaintevent()
{
return
LQPaintEvent("QPaintEvent")
.property("rect", &QPaintEvent::rect)
.scope[ def("filter", event_filter<QPaintEvent>)]
;
}
LQTimerEvent lqtimerevent()
{
return
LQTimerEvent("QTimerEvent")
.property("timerId", &QTimerEvent::timerId)
.scope[ def("filter", event_filter<QTimerEvent>)]
;
}
LQResizeEvent lqresizeevent()
{
return
LQResizeEvent("QResizeEvent")
.property("oldSize", &QResizeEvent::oldSize)
.property("size", &QResizeEvent::size)
.scope[ def("filter", event_filter<QResizeEvent>)]
;
}
LQShowEvent lqshowevent()
{
return
LQShowEvent("QShowEvent")
.scope[ def("filter", event_filter<QShowEvent>)]
;
}
LQHideEvent lqhideevent()
{
return
LQHideEvent("QHideEvent")
.scope[ def("filter", event_filter<QHideEvent>)]
;
}
LQDropEvent lqdropevent()
{
return
LQDropEvent("QDropEvent")
.def("acceptProposedAction", &QDropEvent::acceptProposedAction)
.property("dropAction", &QDropEvent::dropAction, &QDropEvent::setDropAction)
.property("keyboardModifiers", &QDropEvent::keyboardModifiers)
.property("mimeData", &QDropEvent::mimeData)
.property("mouseButtons", &QDropEvent::mouseButtons)
.property("possibleActions", &QDropEvent::possibleActions)
.property("proposedAction", &QDropEvent::proposedAction)
.property("source", &QDropEvent::source)
.property("pos", &QDropEvent::pos)
.scope[ def("filter", event_filter<QDropEvent>)]
;
}
LQDragMoveEvent lqdragmoveevent()
{
return
LQDragMoveEvent("QDragMoveEvent")
.def("accept", ( void (QDragMoveEvent::*)())&QDragMoveEvent::accept)
.def("accept", ( void (QDragMoveEvent::*)(const QRect&))&QDragMoveEvent::accept)
.def("ignore", ( void (QDragMoveEvent::*)())&QDragMoveEvent::ignore)
.def("ignore", ( void (QDragMoveEvent::*)(const QRect&))&QDragMoveEvent::ignore)
.property("answerRect", &QDragMoveEvent::answerRect)
.scope[ def("filter", event_filter<QDragMoveEvent>)]
;
}
LQDragEnterEvent lqdragenterevent()
{
return
LQDragEnterEvent("QDragEnterEvent")
.scope[ def("filter", event_filter<QDragEnterEvent>)]
;
}
LQDragLeaveEvent lqdragleaveevent()
{
return
LQDragLeaveEvent("QDragLeaveEvent")
.scope[ def("filter", event_filter<QDragLeaveEvent>)]
;
}
| 31.59058 | 118 | 0.634247 | nddvn2008 |
9671460fad50fc96675723b56d38f5e2a22998ce | 1,170 | cpp | C++ | codechef/STROPR.cpp | hardbeater/Coding-competition-solution | d75eb704caa26a33505f0488f91636cc27d4c849 | [
"MIT"
] | 1 | 2016-10-02T03:22:57.000Z | 2016-10-02T03:22:57.000Z | codechef/STROPR.cpp | hardbeater/Coding-competition-solution | d75eb704caa26a33505f0488f91636cc27d4c849 | [
"MIT"
] | null | null | null | codechef/STROPR.cpp | hardbeater/Coding-competition-solution | d75eb704caa26a33505f0488f91636cc27d4c849 | [
"MIT"
] | null | null | null | #include<iostream>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
typedef unsigned long long int lli;
lli mod=1000000007;
using namespace std;
lli a[100010];
lli nu,de;
lli power(lli a,lli b)
{
lli res = 1;
while(b > 0) {
if( b % 2 != 0) {
res = (res * a) % mod;
}
a = (a * a) %mod;
b /= 2;
}
return res;
}
lli calc(lli n,lli r)
{
de=(de*r)%mod;
nu=(nu*(n+r-1))%mod;
lli d=power(de,mod-2);
lli c =(nu*d)%mod;
return c;
}
int main()
{
int t;
lli m,n,x;
scanf("%d",&t);
while(t--)
{ lli c=1;
nu=1;de=1;
scanf("%llu%llu%llu",&n,&x,&m);
for(lli i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
}
for(lli j=1;j<=x;j++)
{
a[j]=a[j]%mod;
}
m=m%mod;
lli sum=a[x];
if(x==1)
{
printf("%llu\n",a[1]);
}
else
if(x==2)
{
lli ans=(m*a[1]+a[2])%mod;
printf("%llu\n",ans);
}
else
{
for(lli j=1;j<x;j++)
{
c=(calc(m,j)*a[x-j])%mod;
sum=(sum+c)%mod;
}
printf("%llu\n",sum);
}
}
return 0;
}
| 13.295455 | 36 | 0.432479 | hardbeater |
96727133f2d1e8aa777c256e2a3acb64a6e9a900 | 2,113 | cpp | C++ | Siv3D/src/Siv3D/TexturedRoundRect/SivTexturedRoundRect.cpp | tas9n/OpenSiv3D | c561cba1d88eb9cd9606ba983fcc1120192d5615 | [
"MIT"
] | 2 | 2021-11-22T00:52:48.000Z | 2021-12-24T09:33:55.000Z | Siv3D/src/Siv3D/TexturedRoundRect/SivTexturedRoundRect.cpp | tas9n/OpenSiv3D | c561cba1d88eb9cd9606ba983fcc1120192d5615 | [
"MIT"
] | null | null | null | Siv3D/src/Siv3D/TexturedRoundRect/SivTexturedRoundRect.cpp | tas9n/OpenSiv3D | c561cba1d88eb9cd9606ba983fcc1120192d5615 | [
"MIT"
] | 1 | 2021-12-31T05:08:00.000Z | 2021-12-31T05:08:00.000Z | //-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2022 Ryo Suzuki
// Copyright (c) 2016-2022 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# include <Siv3D/TexturedRoundRect.hpp>
# include <Siv3D/Renderer2D/IRenderer2D.hpp>
# include <Siv3D/Common/Siv3DEngine.hpp>
namespace s3d
{
namespace detail
{
[[nodiscard]]
inline constexpr Vertex2D::IndexType CaluculateFanQuality(const float r) noexcept
{
return r <= 1.0f ? 3
: r <= 6.0f ? 5
: r <= 12.0f ? 8
: static_cast<Vertex2D::IndexType>(Min(64.0f, r * 0.2f + 6));
}
}
TexturedRoundRect::TexturedRoundRect(const Texture& _texture, const float l, const float t, const float r, const float b, const RoundRect& _rect)
: rect{ _rect }
, texture{ _texture }
, uvRect{ l, t, r, b } {}
TexturedRoundRect::TexturedRoundRect(const Texture& _texture, const FloatRect& _uvRect, const RoundRect& _rect)
: rect{ _rect }
, texture{ _texture }
, uvRect{ _uvRect } {}
const RoundRect& TexturedRoundRect::draw(const ColorF& diffuse) const
{
SIV3D_ENGINE(Renderer2D)->addTexturedRoundRect(texture,
FloatRect{ rect.x, rect.y, (rect.x + rect.w), (rect.y + rect.h) },
static_cast<float>(rect.w),
static_cast<float>(rect.h),
static_cast<float>(rect.r),
uvRect, diffuse.toFloat4());
return rect;
}
RoundRect TexturedRoundRect::draw(const double x, const double y, const ColorF& diffuse) const
{
const RoundRect rr = rect.movedBy(x, y);
return TexturedRoundRect{ texture, uvRect, rr }.draw(diffuse);
}
RoundRect TexturedRoundRect::draw(const Vec2& pos, const ColorF& diffuse) const
{
return draw(pos.x, pos.y, diffuse);
}
RoundRect TexturedRoundRect::drawAt(const double x, const double y, const ColorF& diffuse) const
{
return TexturedRoundRect(texture, uvRect, RoundRect(Arg::center(x, y), rect.w, rect.h, rect.r)).draw(diffuse);
}
RoundRect TexturedRoundRect::drawAt(const Vec2& pos, const ColorF& diffuse) const
{
return drawAt(pos.x, pos.y, diffuse);
}
}
| 28.945205 | 146 | 0.666351 | tas9n |
967b278cf5c670082ad5a8f615252fd100ec0a30 | 471 | cpp | C++ | PAT/PAT-A/CPP/1019.General Palindromic Number (20 分).cpp | hao14293/2021-Postgraduate-408 | 70e1c40e6bcf0c5afe4a4638a7c168069d9c8319 | [
"MIT"
] | 950 | 2020-02-21T02:39:18.000Z | 2022-03-31T07:27:36.000Z | PAT/PAT-A/CPP/1019.General Palindromic Number (20 分).cpp | RestmeF/2021-Postgraduate-408 | 70e1c40e6bcf0c5afe4a4638a7c168069d9c8319 | [
"MIT"
] | 6 | 2020-04-03T13:08:47.000Z | 2022-03-07T08:54:56.000Z | PAT/PAT-A/CPP/1019.General Palindromic Number (20 分).cpp | RestmeF/2021-Postgraduate-408 | 70e1c40e6bcf0c5afe4a4638a7c168069d9c8319 | [
"MIT"
] | 131 | 2020-02-22T15:35:59.000Z | 2022-03-21T04:23:57.000Z | #include <iostream>
using namespace std;
int main(){
int n, d;
scanf("%d %d", &n, &d);
int arr[40], index = 0;
while(n != 0){
arr[index++] = n % d;
n = n / d;
}
int flag = 0;
for(int i = 0; i < index / 2; i++){
if(arr[i] != arr[index - i - 1]){
printf("No\n");
flag = 1;
break;
}
}
if(!flag) printf("Yes\n");
for(int i = index - 1; i >= 0; i--){
printf("%d", arr[i]);
if(i != 0) printf(" ");
}
if(index == 0)
printf("0");
return 0;
}
| 16.241379 | 37 | 0.469214 | hao14293 |
967d0c1d78f9f96380f7e150f1147a9a66c8626e | 5,445 | cpp | C++ | drawmapfigure.cpp | AirSThib/MinetestMapperGUI | adb672841de32c1ac1ab36d78731831ecfc369d3 | [
"CC-BY-3.0"
] | 1 | 2021-08-05T08:58:04.000Z | 2021-08-05T08:58:04.000Z | drawmapfigure.cpp | AirSThib/MinetestMapperGUI | adb672841de32c1ac1ab36d78731831ecfc369d3 | [
"CC-BY-3.0"
] | null | null | null | drawmapfigure.cpp | AirSThib/MinetestMapperGUI | adb672841de32c1ac1ab36d78731831ecfc369d3 | [
"CC-BY-3.0"
] | 1 | 2021-04-08T14:44:27.000Z | 2021-04-08T14:44:27.000Z | #include "drawmapfigure.h"
QStringList DrawMapFigure::figuresList = QStringList() << QT_TR_NOOP("Unknown")
<< QT_TR_NOOP("Arrow")
<< QT_TR_NOOP("Circle")
<< QT_TR_NOOP("Ellipse")
<< QT_TR_NOOP("Line")
<< QT_TR_NOOP("Point")
<< QT_TR_NOOP("Rectangle")
<< QT_TR_NOOP("Text");
DrawMapFigure::DrawMapFigure(QObject *parent) :
QObject(parent)
{
geometry = new Geometry();
}
DrawMapFigure::DrawMapFigure(const QString &str, QObject *parent) :
QObject(parent)
{
const QRegularExpression parser = QRegularExpression("^--draw(?<map>map)?(?<type>\\w+) \"(?<params>.+)*\"$");
QRegularExpressionMatch match = parser.match(str);
QStringList xy;
if(match.hasMatch()){
useImageCoordinates = (match.captured("map")=="map");
QString params = match.captured("params");
color.setNamedColor(params.section(' ', 1, 1));
figure = getFigure(match.captured("type"));
if(color.isValid()){
switch (figure) {
case Text:
//parse text and fall through for point
text = params.section(' ', 2);// everything after the 3rd whitespace
case Point:
//parse point and color
xy = params.section(' ', 0, 0).split(',');
point.setX(xy[0].toInt());
point.setY(xy[1].toInt());
break;
case Circle:
case Arrow:
case Line:
case Rectangle:
case Ellipse:
//parse geometry
geometry = new Geometry(params.section(' ', 0, 0));
break;
default:
figure = Unknown;
geometry = new Geometry();
break;
}
}
else{
geometry = new Geometry();
figure = Unknown;
}
}
else{
geometry = new Geometry();
figure = Unknown;
}
}
bool DrawMapFigure::requiresPoint() const
{
return (figure == Text || figure == Point);
}
bool DrawMapFigure::requiresGeometry() const
{
return (figure != Text && figure != Point);
}
bool DrawMapFigure::requiresText() const
{
return (figure == Text);
}
QString DrawMapFigure::getString() const
{
QStringList splitted = getSplittedString();
return QString("%1 \"%2\"").arg(splitted.at(0)).arg(splitted.at(1));
}
QStringList DrawMapFigure::getSplittedString() const
{
QString param;
QString argument;
param = "--draw";
if(useImageCoordinates)
param += "map";
param += QString(metaFigure.key(figure)).toLower();
if(requiresGeometry())
argument += geometry->getString();
if(requiresPoint())
argument += QString("%1,%2").arg(point.x()).arg(point.y());
argument += ' '+ color.name();
if(requiresText())
argument += ' '+text;
return QStringList()<<param<<argument;
}
bool DrawMapFigure::getUseImageCoordinates() const
{
return useImageCoordinates;
}
DrawMapFigure::Figure DrawMapFigure::getFigure() const
{
return figure;
}
DrawMapFigure::Figure DrawMapFigure::getFigure(const QString &str) const
{
const QString temp = str.left(1).toUpper()+str.mid(1);
return static_cast<Figure>(metaFigure.keyToValue(temp.toUtf8().constData()));
}
int DrawMapFigure::getFigureIndex() const
{
QMetaEnum metaEnum = QMetaEnum::fromType<Figure>();
return metaEnum.value(figure);
}
QPoint DrawMapFigure::getPoint() const
{
return point;
}
QString DrawMapFigure::getText() const
{
return text;
}
QColor DrawMapFigure::getColor() const
{
return color;
}
QStringList DrawMapFigure::getFigureList()
{
return figuresList;
}
void DrawMapFigure::setFigure(const Figure &value)
{
figure = value;
}
void DrawMapFigure::setFigure(int value)
{
figure = static_cast<Figure>(value);
}
void DrawMapFigure::setText(const QString &value)
{
text = value;
}
void DrawMapFigure::setColor(const QColor &value)
{
color = value;
}
Geometry *DrawMapFigure::getGeometry()
{
return this->geometry;
}
void DrawMapFigure::setGeometry(Geometry *value)
{
geometry = value;
}
void DrawMapFigure::setUseImageCoordinates(bool value)
{
useImageCoordinates = value;
}
void DrawMapFigure::setPoint(const QPoint &value)
{
point = value;
}
void DrawMapFigure::setPoint(const QVariant &value)
{
point = value.toPoint();
}
void DrawMapFigure::setPoint(const QString &value)
{
static const QRegularExpression regex("(\\-?\\d+)[ |,](\\-?\\d+)");
QRegularExpressionMatch match = regex.match(value);
if(match.hasMatch()){
point = QPoint(match.captured(1).toInt(), match.captured(2).toInt());
}
else{
qDebug() <<"Could not match point from String "<<value;
point = QPoint();
}
}
QIcon DrawMapFigure::getIcon() const
{
return getIcon(figure);
}
QIcon DrawMapFigure::getIcon(DrawMapFigure::Figure figure)
{
const char* a = QMetaEnum::fromType<Figure>().key(figure);
return QIcon(QString(":/images/draw-%1").arg(a).toLower());
}
| 23.571429 | 113 | 0.573737 | AirSThib |
968365c6410eec6015a053a24d4d9b633575d595 | 819 | hpp | C++ | runtime-lib/include/modules/ModuleFactory.hpp | edwino-stein/elrond-runtime-linux | 77b64e9c960c53fa8a2a2e5b9d96e060b5c95533 | [
"Apache-2.0"
] | null | null | null | runtime-lib/include/modules/ModuleFactory.hpp | edwino-stein/elrond-runtime-linux | 77b64e9c960c53fa8a2a2e5b9d96e060b5c95533 | [
"Apache-2.0"
] | 13 | 2019-11-29T21:58:39.000Z | 2020-04-02T03:30:43.000Z | runtime-lib/include/modules/ModuleFactory.hpp | edwino-stein/elrond-runtime | 77b64e9c960c53fa8a2a2e5b9d96e060b5c95533 | [
"Apache-2.0"
] | null | null | null | #if !defined _ELROND_RUNTIME_MODULE_FACTORY_HPP
#define _ELROND_RUNTIME_MODULE_FACTORY_HPP
#include "rtTypes.hpp"
namespace elrond {
namespace runtime {
class ModuleFactory {
protected:
elrond::String _name;
elrond::runtime::ModuleInfo _info;
public:
elrond::runtime::ModuleInfo const& info;
ModuleFactory(elrond::String name);
virtual ~ModuleFactory();
virtual elrond::interface::Module* newInstance(String const& instName)=0;
virtual void deleteInstance(elrond::interface::Module* inst)=0;
virtual bool match(elrond::String const& name) const;
};
}
}
#endif
| 26.419355 | 93 | 0.545788 | edwino-stein |
968539cbbbb5705b37cc802cbf63090a1867ae15 | 14,005 | cpp | C++ | src/gtsamutils.cpp | tmcg0/bioslam | d59f07733cb3a9a1de8e6dea4b1fb745d706da09 | [
"MIT"
] | 6 | 2021-01-26T19:31:46.000Z | 2022-03-10T15:33:49.000Z | src/gtsamutils.cpp | tmcg0/bioslam | d59f07733cb3a9a1de8e6dea4b1fb745d706da09 | [
"MIT"
] | 8 | 2021-01-26T16:12:22.000Z | 2021-08-12T18:39:36.000Z | src/gtsamutils.cpp | tmcg0/bioslam | d59f07733cb3a9a1de8e6dea4b1fb745d706da09 | [
"MIT"
] | 1 | 2021-05-02T18:47:42.000Z | 2021-05-02T18:47:42.000Z | // -------------------------------------------------------------------- //
// (c) Copyright 2021 Massachusetts Institute of Technology //
// Author: Tim McGrath //
// All rights reserved. See LICENSE file for license information. //
// -------------------------------------------------------------------- //
#include <gtsam/nonlinear/NonlinearFactor.h>
#include <mathutils.h>
#include "gtsamutils.h"
#include <fstream>
#include <iomanip>
#include <gtsam/navigation/CombinedImuFactor.h>
#include <factors/ConstrainedJointCenterPositionFactor.h>
#include <factors/ConstrainedJointCenterVelocityFactor.h>
#include <gtsam/slam/PriorFactor.h>
#include <gtsam/navigation/ImuFactor.h>
#include <factors/AngularVelocityFactor.h>
#include <factors/HingeJointFactors.h>
#include <factors/SegmentLengthMagnitudeFactor.h>
#include <factors/SegmentLengthDiscrepancyFactor.h>
#include <factors/AngleBetweenAxisAndSegmentFactor.h>
#include <factors/MagPose3Factor.h>
#include <factors/Pose3Priors.h>
#include <factors/Point3Priors.h>
void print(const gtsam::Matrix& A, const std::string &s, std::ostream& stream);
namespace gtsamutils{
Eigen::MatrixXd Point3VectorToEigenMatrix(const std::vector<gtsam::Point3>& p){
// vector<Rot3> => Nx4 Eigen::MatrixXd
Eigen::MatrixXd M(p.size(),3);
for(uint i=0; i<p.size(); i++){
gtsam::Vector3 pos=p[i].vector();
M(i,0)=pos[0]; M(i,1)=pos[1]; M(i,2)=pos[2];
}
return M;
}
Eigen::MatrixXd Vector3VectorToEigenMatrix(const std::vector<gtsam::Vector3>& v){
// vector<Rot3> => Nx4 Eigen::MatrixXd
Eigen::MatrixXd M(v.size(),3);
for(uint i=0; i<v.size(); i++){
M(i,0)=v[i][0]; M(i,1)=v[i][1]; M(i,2)=v[i][2];
}
return M;
}
Eigen::MatrixXd vectorRot3ToFlattedEigenMatrixXd(const std::vector<gtsam::Rot3>& R){
// make a Nx9 flatted Eigen::Matrix
Eigen::MatrixXd M(R.size(),9);
for(uint i=0; i<R.size(); i++){
gtsam::Matrix33 m=R[i].matrix();
M(i,0)=m(0,0); M(i,1)=m(0,1); M(i,2)=m(0,2); M(i,3)=m(1,0); M(i,4)=m(1,1); M(i,5)=m(1,2); M(i,6)=m(2,0); M(i,7)=m(2,1); M(i,8)=m(2,2);
}
return M;
}
void printErrorsInGraphByFactorType(const gtsam::NonlinearFactorGraph& graph, const gtsam::Values& vals){
// this is less fun in C++ than MATLAB. You'll need to automatically know every possible in your graph a priori.
// for each factor, get a count of how many there are in the graph. If count>0, then find error and print it.
double totalGraphError=graph.error(vals), startTic=clock();
std::cout<<"total error in graph = "<<totalGraphError<<std::endl;
// now for each type of factor, create count, total error, and print results if some are found
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::Unit3>>(graph,vals," gtsam::PriorFactor<Unit3>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::Pose3>>(graph,vals," gtsam::PriorFactor<Pose3>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::Rot3>>(graph,vals," gtsam::PriorFactor<Rot3>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::Point3>>(graph,vals," gtsam::PriorFactor<Point3>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::Vector3>>(graph,vals," gtsam::PriorFactor<Vector3>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::PriorFactor<gtsam::imuBias::ConstantBias>>(graph,vals," gtsam::PriorFactor<imuBias::ConstantBias>:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::CombinedImuFactor>(graph,vals," gtsam::CombinedImuFactor:");
gtsamutils::printGraphErrorDueToFactorType<gtsam::ImuFactor>(graph,vals," gtsam::ImuFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::Pose3TranslationPrior>(graph,vals," bioslam::Pose3TranslationPrior:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::Pose3CompassPrior>(graph,vals," bioslam::Pose3CompassPrior:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::AngularVelocityFactor>(graph,vals," bioslam::AngularVelocityFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::ConstrainedJointCenterPositionFactor>(graph, vals, " bioslam::ConstrainedJointCenterPositionFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::ConstrainedJointCenterNormPositionFactor>(graph, vals, " bioslam::ConstrainedJointCenterNormPositionFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::HingeJointConstraintVecErrEstAngVel>(graph, vals, " bioslam::HingeJointConstraintVecErrEstAngVel:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::HingeJointConstraintNormErrEstAngVel>(graph, vals, " bioslam::HingeJointConstraintNormErrEstAngVel:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::SegmentLengthMagnitudeFactor>(graph,vals," bioslam::SegmentLengthMagnitudeFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::SegmentLengthMaxMagnitudeFactor>(graph,vals," bioslam::SegmentLengthMaxMagnitudeFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::SegmentLengthMinMagnitudeFactor>(graph,vals," bioslam::SegmentLengthMinMagnitudeFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::ConstrainedJointCenterVelocityFactor>(graph,vals," bioslam::ConstrainedJointCenterVelocityFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::ConstrainedJointCenterNormVelocityFactor>(graph, vals, " bioslam::ConstrainedJointCenterNormVelocityFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::SegmentLengthDiscrepancyFactor>(graph,vals," bioslam::SegmentLengthDiscrepancyFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::AngleBetweenAxisAndSegmentFactor>(graph,vals," bioslam::AngleBetweenAxisAndSegmentFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::MinAngleBetweenAxisAndSegmentFactor>(graph,vals," bioslam::MinAngleBetweenAxisAndSegmentFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::MaxAngleBetweenAxisAndSegmentFactor>(graph,vals," bioslam::MaxAngleBetweenAxisAndSegmentFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::Point3MagnitudeDifferenceFactor>(graph,vals," bioslam::Point3MagnitudeDifferenceFactor:");
gtsamutils::printGraphErrorDueToFactorType<bioslam::MagPose3Factor>(graph,vals," bioslam::MagPose3Factor:");
std::cout<<" graph error printing complete. ("<<(clock()-startTic)/CLOCKS_PER_SEC<<" seconds)"<<std::endl;
}
std::vector<gtsam::Rot3> imuOrientation(const imu& myImu){
std::vector<std::vector<double>> q=myImu.quaternion();
std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> qAPDM=mathutils::VectorVectorDoubleToVectorEigenVector(q);
std::vector<gtsam::Rot3> orientation_Rot3=mathutils::QuaternionVectorToRot3Vector(qAPDM);
return orientation_Rot3;
}
std::vector<gtsam::Rot3> Pose3VectorToRot3Vector(const std::vector<gtsam::Pose3>& poses){
std::vector<gtsam::Rot3> rots(poses.size());
for(uint k=0; k<poses.size();k++){
rots[k]=poses[k].rotation();
}
return rots;
}
std::vector<gtsam::Point3> Pose3VectorToPoint3Vector(const std::vector<gtsam::Pose3>& poses){
std::vector<gtsam::Point3> pos(poses.size());
for(uint k=0; k<poses.size();k++){
pos[k]=poses[k].translation();
}
return pos;
}
std::vector<double> vectorSetMagnitudes(const std::vector<Eigen::Vector3d>& v){
std::vector<double> mags(v.size());
for(uint i=0;i<v.size();i++){
mags[i]=v[i].norm();
}
return mags;
}
gtsam::Vector3 accel_Vector3(const imu& myImu, const int& idx){
gtsam::Vector3 x;
x[0]=myImu.ax[idx]; x[1]=myImu.ay[idx]; x[2]=myImu.az[idx];
return x;
}
gtsam::Vector3 mags_Vector3(const imu& myImu, const int& idx){
gtsam::Vector3 x;
x[0]=myImu.mx[idx]; x[1]=myImu.my[idx]; x[2]=myImu.mz[idx];
return x;
}
gtsam::Vector3 gyros_Vector3(const imu& myImu, const int& idx){
gtsam::Vector3 x;
x[0]=myImu.gx[idx]; x[1]=myImu.gy[idx]; x[2]=myImu.gz[idx];
return x;
}
Eigen::MatrixXd gyroMatrix(const imu& myImu){
Eigen::MatrixXd gyros(myImu.length(),3);
for(uint k=0; k<myImu.length();k++){
gyros(k,0)=myImu.gx[k]; gyros(k,1)=myImu.gy[k]; gyros(k,2)=myImu.gz[k];
}
return gyros;
}
Eigen::MatrixXd accelMatrix(const imu& myImu){
Eigen::MatrixXd accels(myImu.length(),3);
for(uint k=0; k<myImu.length();k++){
accels(k,0)=myImu.ax[k]; accels(k,1)=myImu.ay[k]; accels(k,2)=myImu.az[k];
}
return accels;
}
double median(std::vector<double> len){
assert(!len.empty());
if (len.size() % 2 == 0) {
const auto median_it1 = len.begin() + len.size() / 2 - 1;
const auto median_it2 = len.begin() + len.size() / 2;
std::nth_element(len.begin(), median_it1 , len.end());
const auto e1 = *median_it1;
std::nth_element(len.begin(), median_it2 , len.end());
const auto e2 = *median_it2;
return (e1 + e2) / 2;
} else {
const auto median_it = len.begin() + len.size() / 2;
std::nth_element(len.begin(), median_it , len.end());
return *median_it;
}
}
uint nearestIdxToVal(std::vector<double> v, double val){
// this is gonna be ugly. copies entire vector and brute force searches for index nearest to value val.
uint nearestIdx;
double dist=9.0e9;
for (uint k=0; k<v.size(); k++){
if(abs(v[k]-val)<dist){ // update nearest index
nearestIdx=k;
dist=abs(v[k]-val); // update smallest found distance
}
}
return nearestIdx;
}
std::vector<double> vectorizePoint3x(std::vector<gtsam::Point3> p){
std::vector<double> x(p.size());
for(uint i=0; i<p.size(); i++){
x[i]=p[i].x();
}
return x;
}
std::vector<double> vectorizePoint3y(std::vector<gtsam::Point3> p){
std::vector<double> y(p.size());
for(uint i=0; i<p.size(); i++){
y[i]=p[i].y();
}
return y;
}
std::vector<double> vectorizePoint3z(std::vector<gtsam::Point3> p){
std::vector<double> z(p.size());
for(uint i=0; i<p.size(); i++){
z[i]=p[i].z();
}
return z;
}
std::vector<double> vectorizeVector3X(std::vector<gtsam::Vector3> v){
std::vector<double> a(v.size());
for(uint i=0; i<v.size(); i++){
a[i]=v[i](0);
}
return a;
}
std::vector<double> vectorizeVector3Y(std::vector<gtsam::Vector3> v){
std::vector<double> a(v.size());
for(uint i=0; i<v.size(); i++){
a[i]=v[i](1);
}
return a;
}
std::vector<double> vectorizeVector3Z(std::vector<gtsam::Vector3> v){
std::vector<double> a(v.size());
for(uint i=0; i<v.size(); i++){
a[i]=v[i](2);
}
return a;
}
std::vector<double> vectorizeQuaternionS(std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> q){
std::vector<double> a(q.size());
for(uint i=0; i<q.size(); i++){
a[i]=q[i](0);
}
return a;
}
std::vector<double> vectorizeQuaternionX(std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> q){
std::vector<double> a(q.size());
for(uint i=0; i<q.size(); i++){
a[i]=q[i](1);
}
return a;
}
std::vector<double> vectorizeQuaternionY(std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> q){
std::vector<double> a(q.size());
for(uint i=0; i<q.size(); i++){
a[i]=q[i](2);
}
return a;
}
std::vector<double> vectorizeQuaternionZ(std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> q){
std::vector<double> a(q.size());
for(uint i=0; i<q.size(); i++){
a[i]=q[i](3);
}
return a;
}
void saveMatrixToFile(const gtsam::Matrix& A, const std::string &s, const std::string& filename) {
std::fstream stream(filename.c_str(), std::fstream::out | std::fstream::app);
print(A, s + "=", stream);
stream.close();
}
void writeEigenMatrixToCsvFile(const std::string& name, const Eigen::MatrixXd& matrix, const Eigen::IOFormat& CSVFormat){
std::ofstream file(name.c_str());
file << matrix.format(CSVFormat);
file.close();
}
Eigen::MatrixXd vectorRot3ToYprMatrix(const std::vector<gtsam::Rot3>& R){
Eigen::MatrixXd yprMatrix(R.size(),3);
for(uint k=0; k<R.size(); k++){
gtsam::Vector3 ypr=R[k].ypr();
yprMatrix(k,0)=ypr(0); yprMatrix(k,1)=ypr(1); yprMatrix(k,2)=ypr(2);
}
return yprMatrix;
}
}
// helper functions
void print(const gtsam::Matrix& A, const std::string &s, std::ostream& stream) {
size_t m = A.rows(), n = A.cols();
// print out all elements
stream << s << "[\n";
for( size_t i = 0 ; i < m ; i++) {
for( size_t j = 0 ; j < n ; j++) {
double aij = A(i,j);
if(aij != 0.0)
stream << std::setw(12) << std::setprecision(9) << aij << ",\t";
else
stream << " 0.0,\t";
}
stream << std::endl;
}
stream << "];" << std::endl;
} | 46.374172 | 173 | 0.619564 | tmcg0 |
9689bf7cdb4a419310b90dbf8e3fabc7c0f0af22 | 68,541 | cpp | C++ | main_d2/gameseg.cpp | Kreeblah/ChocolateDescent | ce575a8193c4fa560731203d9aea66355c41cc0d | [
"MIT"
] | 22 | 2019-08-19T21:09:29.000Z | 2022-03-25T23:19:15.000Z | main_d2/gameseg.cpp | Kreeblah/ChocolateDescent | ce575a8193c4fa560731203d9aea66355c41cc0d | [
"MIT"
] | 6 | 2019-11-08T22:17:03.000Z | 2022-03-10T05:02:59.000Z | main_d2/gameseg.cpp | Kreeblah/ChocolateDescent | ce575a8193c4fa560731203d9aea66355c41cc0d | [
"MIT"
] | 6 | 2019-08-24T08:03:14.000Z | 2022-02-04T15:04:52.000Z | /*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#include <stdlib.h>
#include <stdio.h>
#if defined(__linux__) || defined(_WIN32) || defined(_WIN64)
#include <malloc.h> //for stackavail()
#endif
#include <string.h> // for memset()
#include <algorithm>
#include "misc/rand.h"
#include "inferno.h"
#include "game.h"
#include "misc/error.h"
#include "platform/mono.h"
#include "vecmat/vecmat.h"
#include "gameseg.h"
#include "wall.h"
#include "fuelcen.h"
#include "bm.h"
#include "fvi.h"
#include "misc/byteswap.h"
// How far a point can be from a plane, and still be "in" the plane
#define PLANE_DIST_TOLERANCE 250
dl_index Dl_indices[MAX_DL_INDICES];
delta_light Delta_lights[MAX_DELTA_LIGHTS];
int Num_static_lights;
// ------------------------------------------------------------------------------------------
// Compute the center point of a side of a segment.
// The center point is defined to be the average of the 4 points defining the side.
void compute_center_point_on_side(vms_vector *vp,segment *sp,int side)
{
int v;
vm_vec_zero(vp);
for (v=0; v<4; v++)
vm_vec_add2(vp,&Vertices[sp->verts[Side_to_verts[side][v]]]);
vm_vec_scale(vp,F1_0/4);
}
// ------------------------------------------------------------------------------------------
// Compute segment center.
// The center point is defined to be the average of the 8 points defining the segment.
void compute_segment_center(vms_vector *vp,segment *sp)
{
int v;
vm_vec_zero(vp);
for (v=0; v<8; v++)
vm_vec_add2(vp,&Vertices[sp->verts[v]]);
vm_vec_scale(vp,F1_0/8);
}
// -----------------------------------------------------------------------------
// Given two segments, return the side index in the connecting segment which connects to the base segment
// Optimized by MK on 4/21/94 because it is a 2% load.
int find_connect_side(segment *base_seg, segment *con_seg)
{
int s;
short base_seg_num = base_seg - Segments;
short *childs = con_seg->children;
for (s=0; s<MAX_SIDES_PER_SEGMENT; s++) {
if (*childs++ == base_seg_num)
return s;
}
// legal to return -1, used in object_move_one(), mk, 06/08/94: Assert(0); // Illegal -- there is no connecting side between these two segments
return -1;
}
// -----------------------------------------------------------------------------------
// Given a side, return the number of faces
int get_num_faces(side *sidep)
{
switch (sidep->type) {
case SIDE_IS_QUAD:
return 1;
break;
case SIDE_IS_TRI_02:
case SIDE_IS_TRI_13:
return 2;
break;
default:
Error("Illegal type = %i\n", sidep->type);
break;
}
return 0; //shut up warning
}
// Fill in array with four absolute point numbers for a given side
void get_side_verts(short *vertlist,int segnum,int sidenum)
{
int i;
int8_t *sv = Side_to_verts[sidenum];
short *vp = Segments[segnum].verts;
for (i=4; i--;)
vertlist[i] = vp[sv[i]];
}
#ifdef EDITOR
// -----------------------------------------------------------------------------------
// Create all vertex lists (1 or 2) for faces on a side.
// Sets:
// num_faces number of lists
// vertices vertices in all (1 or 2) faces
// If there is one face, it has 4 vertices.
// If there are two faces, they both have three vertices, so face #0 is stored in vertices 0,1,2,
// face #1 is stored in vertices 3,4,5.
// Note: these are not absolute vertex numbers, but are relative to the segment
// Note: for triagulated sides, the middle vertex of each trianle is the one NOT
// adjacent on the diagonal edge
void create_all_vertex_lists(int *num_faces, int *vertices, int segnum, int sidenum)
{
side *sidep = &Segments[segnum].sides[sidenum];
int *sv = Side_to_verts_int[sidenum];
Assert((segnum <= Highest_segment_index) && (segnum >= 0));
Assert((sidenum >= 0) && (sidenum < 6));
switch (sidep->type) {
case SIDE_IS_QUAD:
vertices[0] = sv[0];
vertices[1] = sv[1];
vertices[2] = sv[2];
vertices[3] = sv[3];
*num_faces = 1;
break;
case SIDE_IS_TRI_02:
*num_faces = 2;
vertices[0] = sv[0];
vertices[1] = sv[1];
vertices[2] = sv[2];
vertices[3] = sv[2];
vertices[4] = sv[3];
vertices[5] = sv[0];
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS()
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
case SIDE_IS_TRI_13:
*num_faces = 2;
vertices[0] = sv[3];
vertices[1] = sv[0];
vertices[2] = sv[1];
vertices[3] = sv[1];
vertices[4] = sv[2];
vertices[5] = sv[3];
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS()
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
default:
Error("Illegal side type (1), type = %i, segment # = %i, side # = %i\n", sidep->type, segnum, sidenum);
break;
}
}
#endif
// -----------------------------------------------------------------------------------
// Like create all vertex lists, but returns the vertnums (relative to
// the side) for each of the faces that make up the side.
// If there is one face, it has 4 vertices.
// If there are two faces, they both have three vertices, so face #0 is stored in vertices 0,1,2,
// face #1 is stored in vertices 3,4,5.
void create_all_vertnum_lists(int *num_faces, int *vertnums, int segnum, int sidenum)
{
side *sidep = &Segments[segnum].sides[sidenum];
Assert((segnum <= Highest_segment_index) && (segnum >= 0));
switch (sidep->type) {
case SIDE_IS_QUAD:
vertnums[0] = 0;
vertnums[1] = 1;
vertnums[2] = 2;
vertnums[3] = 3;
*num_faces = 1;
break;
case SIDE_IS_TRI_02:
*num_faces = 2;
vertnums[0] = 0;
vertnums[1] = 1;
vertnums[2] = 2;
vertnums[3] = 2;
vertnums[4] = 3;
vertnums[5] = 0;
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS()
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
case SIDE_IS_TRI_13:
*num_faces = 2;
vertnums[0] = 3;
vertnums[1] = 0;
vertnums[2] = 1;
vertnums[3] = 1;
vertnums[4] = 2;
vertnums[5] = 3;
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS()
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
default:
Error("Illegal side type (2), type = %i, segment # = %i, side # = %i\n", sidep->type, segnum, sidenum);
break;
}
}
// -----
//like create_all_vertex_lists(), but generate absolute point numbers
void create_abs_vertex_lists(int *num_faces, int *vertices, int segnum, int sidenum)
{
short *vp = Segments[segnum].verts;
side *sidep = &Segments[segnum].sides[sidenum];
int *sv = Side_to_verts_int[sidenum];
Assert((segnum <= Highest_segment_index) && (segnum >= 0));
switch (sidep->type) {
case SIDE_IS_QUAD:
vertices[0] = vp[sv[0]];
vertices[1] = vp[sv[1]];
vertices[2] = vp[sv[2]];
vertices[3] = vp[sv[3]];
*num_faces = 1;
break;
case SIDE_IS_TRI_02:
*num_faces = 2;
vertices[0] = vp[sv[0]];
vertices[1] = vp[sv[1]];
vertices[2] = vp[sv[2]];
vertices[3] = vp[sv[2]];
vertices[4] = vp[sv[3]];
vertices[5] = vp[sv[0]];
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS(),
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
case SIDE_IS_TRI_13:
*num_faces = 2;
vertices[0] = vp[sv[3]];
vertices[1] = vp[sv[0]];
vertices[2] = vp[sv[1]];
vertices[3] = vp[sv[1]];
vertices[4] = vp[sv[2]];
vertices[5] = vp[sv[3]];
//IMPORTANT: DON'T CHANGE THIS CODE WITHOUT CHANGING GET_SEG_MASKS()
//CREATE_ABS_VERTEX_LISTS(), CREATE_ALL_VERTEX_LISTS(), CREATE_ALL_VERTNUM_LISTS()
break;
default:
Error("Illegal side type (3), type = %i, segment # = %i, side # = %i\n", sidep->type, segnum, sidenum);
break;
}
}
//returns 3 different bitmasks with info telling if this sphere is in
//this segment. See segmasks structure for info on fields
segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad)
{
int sn,facebit,sidebit;
segmasks masks;
int num_faces;
int vertex_list[6];
segment *seg;
if (segnum==-1)
Error("segnum == -1 in get_seg_masks()");
Assert((segnum <= Highest_segment_index) && (segnum >= 0));
seg = &Segments[segnum];
//check point against each side of segment. return bitmask
masks.sidemask = masks.facemask = masks.centermask = 0;
for (sn=0,facebit=sidebit=1;sn<6;sn++,sidebit<<=1) {
#ifndef COMPACT_SEGS
side *s = &seg->sides[sn];
#endif
int side_pokes_out;
int vertnum,fn;
// Get number of faces on this side, and at vertex_list, store vertices.
// If one face, then vertex_list indicates a quadrilateral.
// If two faces, then 0,1,2 define one triangle, 3,4,5 define the second.
create_abs_vertex_lists( &num_faces, vertex_list, segnum, sn);
//ok...this is important. If a side has 2 faces, we need to know if
//those faces form a concave or convex side. If the side pokes out,
//then a point is on the back of the side if it is behind BOTH faces,
//but if the side pokes in, a point is on the back if behind EITHER face.
if (num_faces==2) {
fix dist;
int side_count,center_count;
#ifdef COMPACT_SEGS
vms_vector normals[2];
#endif
vertnum = std::min(vertex_list[0],vertex_list[2]);
#ifdef COMPACT_SEGS
get_side_normals(seg, sn, &normals[0], &normals[1] );
#endif
if (vertex_list[4] < vertex_list[1])
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(&Vertices[vertex_list[4]],&normals[0],&Vertices[vertnum]);
#else
dist = vm_dist_to_plane(&Vertices[vertex_list[4]],&s->normals[0],&Vertices[vertnum]);
#endif
else
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(&Vertices[vertex_list[1]],&normals[1],&Vertices[vertnum]);
#else
dist = vm_dist_to_plane(&Vertices[vertex_list[1]],&s->normals[1],&Vertices[vertnum]);
#endif
side_pokes_out = (dist > PLANE_DIST_TOLERANCE);
side_count = center_count = 0;
for (fn=0;fn<2;fn++,facebit<<=1) {
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(checkp, &normals[fn], &Vertices[vertnum]);
#else
dist = vm_dist_to_plane(checkp, &s->normals[fn], &Vertices[vertnum]);
#endif
if (dist < -PLANE_DIST_TOLERANCE) //in front of face
center_count++;
if (dist-rad < -PLANE_DIST_TOLERANCE) {
masks.facemask |= facebit;
side_count++;
}
}
if (!side_pokes_out) { //must be behind both faces
if (side_count==2)
masks.sidemask |= sidebit;
if (center_count==2)
masks.centermask |= sidebit;
}
else { //must be behind at least one face
if (side_count)
masks.sidemask |= sidebit;
if (center_count)
masks.centermask |= sidebit;
}
}
else { //only one face on this side
fix dist;
int i;
#ifdef COMPACT_SEGS
vms_vector normal;
#endif
//use lowest point number
vertnum = vertex_list[0];
for (i=1;i<4;i++)
if (vertex_list[i] < vertnum)
vertnum = vertex_list[i];
#ifdef COMPACT_SEGS
get_side_normal(seg, sn, 0, &normal );
dist = vm_dist_to_plane(checkp, &normal, &Vertices[vertnum]);
#else
dist = vm_dist_to_plane(checkp, &s->normals[0], &Vertices[vertnum]);
#endif
if (dist < -PLANE_DIST_TOLERANCE)
masks.centermask |= sidebit;
if (dist-rad < -PLANE_DIST_TOLERANCE) {
masks.facemask |= facebit;
masks.sidemask |= sidebit;
}
facebit <<= 2;
}
}
return masks;
}
//this was converted from get_seg_masks()...it fills in an array of 6
//elements for the distace behind each side, or zero if not behind
//only gets centermask, and assumes zero rad
uint8_t get_side_dists(vms_vector *checkp,int segnum,fix *side_dists)
{
int sn,facebit,sidebit;
uint8_t mask;
int num_faces;
int vertex_list[6];
segment *seg;
Assert((segnum <= Highest_segment_index) && (segnum >= 0));
if (segnum==-1)
Error("segnum == -1 in get_seg_dists()");
seg = &Segments[segnum];
//check point against each side of segment. return bitmask
mask = 0;
for (sn=0,facebit=sidebit=1;sn<6;sn++,sidebit<<=1) {
#ifndef COMPACT_SEGS
side *s = &seg->sides[sn];
#endif
int side_pokes_out;
int fn;
side_dists[sn] = 0;
// Get number of faces on this side, and at vertex_list, store vertices.
// If one face, then vertex_list indicates a quadrilateral.
// If two faces, then 0,1,2 define one triangle, 3,4,5 define the second.
create_abs_vertex_lists( &num_faces, vertex_list, segnum, sn);
//ok...this is important. If a side has 2 faces, we need to know if
//those faces form a concave or convex side. If the side pokes out,
//then a point is on the back of the side if it is behind BOTH faces,
//but if the side pokes in, a point is on the back if behind EITHER face.
if (num_faces==2) {
fix dist;
int center_count;
int vertnum;
#ifdef COMPACT_SEGS
vms_vector normals[2];
#endif
vertnum = std::min(vertex_list[0],vertex_list[2]);
#ifdef COMPACT_SEGS
get_side_normals(seg, sn, &normals[0], &normals[1] );
#endif
if (vertex_list[4] < vertex_list[1])
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(&Vertices[vertex_list[4]],&normals[0],&Vertices[vertnum]);
#else
dist = vm_dist_to_plane(&Vertices[vertex_list[4]],&s->normals[0],&Vertices[vertnum]);
#endif
else
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(&Vertices[vertex_list[1]],&normals[1],&Vertices[vertnum]);
#else
dist = vm_dist_to_plane(&Vertices[vertex_list[1]],&s->normals[1],&Vertices[vertnum]);
#endif
side_pokes_out = (dist > PLANE_DIST_TOLERANCE);
center_count = 0;
for (fn=0;fn<2;fn++,facebit<<=1) {
#ifdef COMPACT_SEGS
dist = vm_dist_to_plane(checkp, &normals[fn], &Vertices[vertnum]);
#else
dist = vm_dist_to_plane(checkp, &s->normals[fn], &Vertices[vertnum]);
#endif
if (dist < -PLANE_DIST_TOLERANCE) { //in front of face
center_count++;
side_dists[sn] += dist;
}
}
if (!side_pokes_out) { //must be behind both faces
if (center_count==2) {
mask |= sidebit;
side_dists[sn] /= 2; //get average
}
}
else { //must be behind at least one face
if (center_count) {
mask |= sidebit;
if (center_count==2)
side_dists[sn] /= 2; //get average
}
}
}
else { //only one face on this side
fix dist;
int i,vertnum;
#ifdef COMPACT_SEGS
vms_vector normal;
#endif
//use lowest point number
vertnum = vertex_list[0];
for (i=1;i<4;i++)
if (vertex_list[i] < vertnum)
vertnum = vertex_list[i];
#ifdef COMPACT_SEGS
get_side_normal(seg, sn, 0, &normal );
dist = vm_dist_to_plane(checkp, &normal, &Vertices[vertnum]);
#else
dist = vm_dist_to_plane(checkp, &s->normals[0], &Vertices[vertnum]);
#endif
if (dist < -PLANE_DIST_TOLERANCE) {
mask |= sidebit;
side_dists[sn] = dist;
}
facebit <<= 2;
}
}
return mask;
}
#ifndef NDEBUG
#ifndef COMPACT_SEGS
//returns true if errors detected
int check_norms(int segnum,int sidenum,int facenum,int csegnum,int csidenum,int cfacenum)
{
vms_vector *n0,*n1;
n0 = &Segments[segnum].sides[sidenum].normals[facenum];
n1 = &Segments[csegnum].sides[csidenum].normals[cfacenum];
if (n0->x != -n1->x || n0->y != -n1->y || n0->z != -n1->z) {
mprintf((0,"Seg %x, side %d, norm %d doesn't match seg %x, side %d, norm %d:\n"
" %8x %8x %8x\n"
" %8x %8x %8x (negated)\n",
segnum,sidenum,facenum,csegnum,csidenum,cfacenum,
n0->x,n0->y,n0->z,-n1->x,-n1->y,-n1->z));
return 1;
}
else
return 0;
}
//heavy-duty error checking
int check_segment_connections(void)
{
int segnum,sidenum;
int errors=0;
for (segnum=0;segnum<=Highest_segment_index;segnum++) {
segment *seg;
seg = &Segments[segnum];
for (sidenum=0;sidenum<6;sidenum++) {
side *s;
segment *cseg;
side *cs;
int num_faces,csegnum,csidenum,con_num_faces;
int vertex_list[6],con_vertex_list[6];
s = &seg->sides[sidenum];
create_abs_vertex_lists( &num_faces, vertex_list, segnum, sidenum);
csegnum = seg->children[sidenum];
if (csegnum >= 0) {
cseg = &Segments[csegnum];
csidenum = find_connect_side(seg,cseg);
if (csidenum == -1) {
mprintf((0,"Could not find connected side for seg %x back to seg %x, side %d\n",csegnum,segnum,sidenum));
errors = 1;
continue;
}
cs = &cseg->sides[csidenum];
create_abs_vertex_lists( &con_num_faces, con_vertex_list, csegnum, csidenum);
if (con_num_faces != num_faces) {
mprintf((0,"Seg %x, side %d: num_faces (%d) mismatch with seg %x, side %d (%d)\n",segnum,sidenum,num_faces,csegnum,csidenum,con_num_faces));
errors = 1;
}
else
if (num_faces == 1) {
int t;
for (t=0;t<4 && con_vertex_list[t]!=vertex_list[0];t++);
if (t==4 ||
vertex_list[0] != con_vertex_list[t] ||
vertex_list[1] != con_vertex_list[(t+3)%4] ||
vertex_list[2] != con_vertex_list[(t+2)%4] ||
vertex_list[3] != con_vertex_list[(t+1)%4]) {
mprintf((0,"Seg %x, side %d: vertex list mismatch with seg %x, side %d\n"
" %x %x %x %x\n"
" %x %x %x %x\n",
segnum,sidenum,csegnum,csidenum,
vertex_list[0],vertex_list[1],vertex_list[2],vertex_list[3],
con_vertex_list[0],con_vertex_list[1],con_vertex_list[2],con_vertex_list[3]));
errors = 1;
}
else
errors |= check_norms(segnum,sidenum,0,csegnum,csidenum,0);
}
else {
if (vertex_list[1] == con_vertex_list[1]) {
if (vertex_list[4] != con_vertex_list[4] ||
vertex_list[0] != con_vertex_list[2] ||
vertex_list[2] != con_vertex_list[0] ||
vertex_list[3] != con_vertex_list[5] ||
vertex_list[5] != con_vertex_list[3]) {
mprintf((0,"Seg %x, side %d: vertex list mismatch with seg %x, side %d\n"
" %x %x %x %x %x %x\n"
" %x %x %x %x %x %x\n",
segnum,sidenum,csegnum,csidenum,
vertex_list[0],vertex_list[1],vertex_list[2],vertex_list[3],vertex_list[4],vertex_list[5],
con_vertex_list[0],con_vertex_list[1],con_vertex_list[2],con_vertex_list[3],con_vertex_list[4],con_vertex_list[5]));
mprintf((0,"Changing seg:side %4i:%i from %i to %i\n", csegnum, csidenum, Segments[csegnum].sides[csidenum].type, 5-Segments[csegnum].sides[csidenum].type));
Segments[csegnum].sides[csidenum].type = 5-Segments[csegnum].sides[csidenum].type;
} else {
errors |= check_norms(segnum,sidenum,0,csegnum,csidenum,0);
errors |= check_norms(segnum,sidenum,1,csegnum,csidenum,1);
}
} else {
if (vertex_list[1] != con_vertex_list[4] ||
vertex_list[4] != con_vertex_list[1] ||
vertex_list[0] != con_vertex_list[5] ||
vertex_list[5] != con_vertex_list[0] ||
vertex_list[2] != con_vertex_list[3] ||
vertex_list[3] != con_vertex_list[2]) {
mprintf((0,"Seg %x, side %d: vertex list mismatch with seg %x, side %d\n"
" %x %x %x %x %x %x\n"
" %x %x %x %x %x %x\n",
segnum,sidenum,csegnum,csidenum,
vertex_list[0],vertex_list[1],vertex_list[2],vertex_list[3],vertex_list[4],vertex_list[5],
con_vertex_list[0],con_vertex_list[1],con_vertex_list[2],con_vertex_list[3],con_vertex_list[4],vertex_list[5]));
mprintf((0,"Changing seg:side %4i:%i from %i to %i\n", csegnum, csidenum, Segments[csegnum].sides[csidenum].type, 5-Segments[csegnum].sides[csidenum].type));
Segments[csegnum].sides[csidenum].type = 5-Segments[csegnum].sides[csidenum].type;
} else {
errors |= check_norms(segnum,sidenum,0,csegnum,csidenum,1);
errors |= check_norms(segnum,sidenum,1,csegnum,csidenum,0);
}
}
}
}
}
}
// mprintf((0,"\n DONE \n"));
return errors;
}
#endif
#endif
// Used to become a constant based on editor, but I wanted to be able to set
// this for omega blob find_point_seg calls. Would be better to pass a paremeter
// to the routine...--MK, 01/17/96
int Doing_lighting_hack_flag=0;
//figure out what seg the given point is in, tracing through segments
//returns segment number, or -1 if can't find segment
int trace_segs(vms_vector *p0,int oldsegnum, int trace_segs_iterations)
{
int centermask;
segment *seg;
fix side_dists[6];
Assert((oldsegnum <= Highest_segment_index) && (oldsegnum >= 0));
/*if (stackavail() < 1024)*/
if (trace_segs_iterations > 1024)
{ //if no debugging, we'll get past assert
#ifndef NDEBUG
if (!Doing_lighting_hack_flag)
Int3(); // Please get Matt, or if you cannot, then type
// "?p0->xyz,segnum" at the DBG prompt, write down
// the values (a 3-element vector and a segment number),
// and make a copy of the mine you are playing.
else
#endif
//[ISB] this function is really bad. really really bad. agonizingly bad.
//This doesn't even begin to replicate it vanilla like, but I'd rather do this than rely on stupid shit
//like stack availability. It would make more sense to do an exhaustive test if this fails but that's not what vanilla does.
//or maybe they could have just used a saner search algorithm...
fprintf(stderr, "trace_segs: iteration limit hit\n");
return oldsegnum; //just say we're in this segment and be done with it
}
centermask = get_side_dists(p0,oldsegnum,side_dists); //check old segment
if (centermask == 0) //we're in the old segment
return oldsegnum; //..say so
//not in old seg. trace through to find seg
else
{
int biggest_side;
do
{
int sidenum,bit;
fix biggest_val;
seg = &Segments[oldsegnum];
biggest_side = -1; biggest_val = 0;
for (sidenum=0,bit=1;sidenum<6;sidenum++,bit<<=1)
if ((centermask&bit) && (seg->children[sidenum]>-1))
if (side_dists[sidenum] < biggest_val)
{
biggest_val = side_dists[sidenum];
biggest_side = sidenum;
}
if (biggest_side != -1)
{
int check;
side_dists[biggest_side] = 0;
check = trace_segs(p0,seg->children[biggest_side], trace_segs_iterations+1); //trace into adjacent segment
if (check != -1) //we've found a segment
return check;
}
} while (biggest_side!=-1);
return -1; //we haven't found a segment
}
}
int Exhaustive_count=0, Exhaustive_failed_count=0;
//Tries to find a segment for a point, in the following way:
// 1. Check the given segment
// 2. Recursively trace through attached segments
// 3. Check all the segmentns
//Returns segnum if found, or -1
int find_point_seg(vms_vector *p,int segnum)
{
int newseg;
//allow segnum==-1, meaning we have no idea what segment point is in
Assert((segnum <= Highest_segment_index) && (segnum >= -1));
if (segnum != -1) {
newseg = trace_segs(p,segnum, 0);
if (newseg != -1) //we found a segment!
return newseg;
}
//couldn't find via attached segs, so search all segs
// MK: 10/15/94
// This Doing_lighting_hack_flag thing added by mk because the hundreds of scrolling messages were
// slowing down lighting, and in about 98% of cases, it would just return -1 anyway.
// Matt: This really should be fixed, though. We're probably screwing up our lighting in a few places.
if (!Doing_lighting_hack_flag) {
mprintf((1,"Warning: doing exhaustive search to find point segment (%i times)\n", ++Exhaustive_count));
for (newseg=0;newseg <= Highest_segment_index;newseg++)
if (get_seg_masks(p,newseg,0).centermask == 0)
return newseg;
mprintf((1,"Warning: could not find point segment (%i times)\n", ++Exhaustive_failed_count));
return -1; //no segment found
} else
return -1;
}
//--repair-- // ------------------------------------------------------------------------------
//--repair-- void clsd_repair_center(int segnum)
//--repair-- {
//--repair-- int sidenum;
//--repair--
//--repair-- // --- Set repair center bit for all repair center segments.
//--repair-- if (Segments[segnum].special == SEGMENT_IS_REPAIRCEN) {
//--repair-- Lsegments[segnum].special_type |= SS_REPAIR_CENTER;
//--repair-- Lsegments[segnum].special_segment = segnum;
//--repair-- }
//--repair--
//--repair-- // --- Set repair center bit for all segments adjacent to a repair center.
//--repair-- for (sidenum=0; sidenum < MAX_SIDES_PER_SEGMENT; sidenum++) {
//--repair-- int s = Segments[segnum].children[sidenum];
//--repair--
//--repair-- if ( (s != -1) && (Segments[s].special==SEGMENT_IS_REPAIRCEN) ) {
//--repair-- Lsegments[segnum].special_type |= SS_REPAIR_CENTER;
//--repair-- Lsegments[segnum].special_segment = s;
//--repair-- }
//--repair-- }
//--repair-- }
//--repair-- // ------------------------------------------------------------------------------
//--repair-- // --- Set destination points for all Materialization centers.
//--repair-- void clsd_materialization_center(int segnum)
//--repair-- {
//--repair-- if (Segments[segnum].special == SEGMENT_IS_ROBOTMAKER) {
//--repair--
//--repair-- }
//--repair-- }
//--repair--
//--repair-- int Lsegment_highest_segment_index, Lsegment_highest_vertex_index;
//--repair--
//--repair-- // ------------------------------------------------------------------------------
//--repair-- // Create data specific to mine which doesn't get written to disk.
//--repair-- // Highest_segment_index and Highest_object_index must be valid.
//--repair-- // 07/21: set repair center bit
//--repair-- void create_local_segment_data(void)
//--repair-- {
//--repair-- int segnum;
//--repair--
//--repair-- // --- Initialize all Lsegments.
//--repair-- for (segnum=0; segnum <= Highest_segment_index; segnum++) {
//--repair-- Lsegments[segnum].special_type = 0;
//--repair-- Lsegments[segnum].special_segment = -1;
//--repair-- }
//--repair--
//--repair-- for (segnum=0; segnum <= Highest_segment_index; segnum++) {
//--repair--
//--repair-- clsd_repair_center(segnum);
//--repair-- clsd_materialization_center(segnum);
//--repair--
//--repair-- }
//--repair--
//--repair-- // Set check variables.
//--repair-- // In main game loop, make sure these are valid, else Lsegments is not valid.
//--repair-- Lsegment_highest_segment_index = Highest_segment_index;
//--repair-- Lsegment_highest_vertex_index = Highest_vertex_index;
//--repair-- }
//--repair--
//--repair-- // ------------------------------------------------------------------------------------------
//--repair-- // Sort of makes sure create_local_segment_data has been called for the currently executing mine.
//--repair-- // It is not failsafe, as you will see if you look at the code.
//--repair-- // Returns 1 if Lsegments appears valid, 0 if not.
//--repair-- int check_lsegments_validity(void)
//--repair-- {
//--repair-- return ((Lsegment_highest_segment_index == Highest_segment_index) && (Lsegment_highest_vertex_index == Highest_vertex_index));
//--repair-- }
#define MAX_LOC_POINT_SEGS 64
int Connected_segment_distance;
#define MIN_CACHE_FCD_DIST (F1_0*80) // Must be this far apart for cache lookup to succeed. Recognizes small changes in distance matter at small distances.
#define MAX_FCD_CACHE 8
typedef struct {
int seg0, seg1, csd;
fix dist;
} fcd_data;
int Fcd_index = 0;
fcd_data Fcd_cache[MAX_FCD_CACHE];
fix Last_fcd_flush_time;
// ----------------------------------------------------------------------------------------------------------
void flush_fcd_cache(void)
{
int i;
Fcd_index = 0;
for (i=0; i<MAX_FCD_CACHE; i++)
Fcd_cache[i].seg0 = -1;
}
// ----------------------------------------------------------------------------------------------------------
void add_to_fcd_cache(int seg0, int seg1, int depth, fix dist)
{
if (dist > MIN_CACHE_FCD_DIST) {
Fcd_cache[Fcd_index].seg0 = seg0;
Fcd_cache[Fcd_index].seg1 = seg1;
Fcd_cache[Fcd_index].csd = depth;
Fcd_cache[Fcd_index].dist = dist;
Fcd_index++;
if (Fcd_index >= MAX_FCD_CACHE)
Fcd_index = 0;
// -- mprintf((0, "Adding seg0=%i, seg1=%i to cache.\n", seg0, seg1));
} else {
// If it's in the cache, remove it.
int i;
for (i=0; i<MAX_FCD_CACHE; i++)
if (Fcd_cache[i].seg0 == seg0)
if (Fcd_cache[i].seg1 == seg1) {
Fcd_cache[Fcd_index].seg0 = -1;
break;
}
}
}
// ----------------------------------------------------------------------------------------------------------
// Determine whether seg0 and seg1 are reachable in a way that allows sound to pass.
// Search up to a maximum depth of max_depth.
// Return the distance.
fix find_connected_distance(vms_vector *p0, int seg0, vms_vector *p1, int seg1, int max_depth, int wid_flag)
{
int cur_seg;
int sidenum;
int qtail = 0, qhead = 0;
int i;
int8_t visited[MAX_SEGMENTS];
seg_seg seg_queue[MAX_SEGMENTS];
short depth[MAX_SEGMENTS];
int cur_depth;
int num_points;
point_seg point_segs[MAX_LOC_POINT_SEGS];
fix dist;
// If > this, will overrun point_segs buffer
#ifdef WINDOWS
if (max_depth == -1) max_depth = 200;
#endif
if (max_depth > MAX_LOC_POINT_SEGS-2) {
mprintf((1, "Warning: In find_connected_distance, max_depth = %i, limited to %i\n", max_depth, MAX_LOC_POINT_SEGS-2));
max_depth = MAX_LOC_POINT_SEGS-2;
}
if (seg0 == seg1) {
Connected_segment_distance = 0;
return vm_vec_dist_quick(p0, p1);
} else {
int conn_side;
if ((conn_side = find_connect_side(&Segments[seg0], &Segments[seg1])) != -1) {
if (WALL_IS_DOORWAY(&Segments[seg1], conn_side) & wid_flag) {
Connected_segment_distance = 1;
//mprintf((0, "\n"));
return vm_vec_dist_quick(p0, p1);
}
}
}
// Periodically flush cache.
if ((GameTime - Last_fcd_flush_time > F1_0*2) || (GameTime < Last_fcd_flush_time)) {
flush_fcd_cache();
Last_fcd_flush_time = GameTime;
}
// Can't quickly get distance, so see if in Fcd_cache.
for (i=0; i<MAX_FCD_CACHE; i++)
if ((Fcd_cache[i].seg0 == seg0) && (Fcd_cache[i].seg1 == seg1)) {
Connected_segment_distance = Fcd_cache[i].csd;
// -- mprintf((0, "In cache, seg0=%i, seg1=%i. Returning.\n", seg0, seg1));
return Fcd_cache[i].dist;
}
num_points = 0;
memset(visited, 0, Highest_segment_index+1);
memset(depth, 0, sizeof(depth[0]) * (Highest_segment_index+1));
cur_seg = seg0;
visited[cur_seg] = 1;
cur_depth = 0;
while (cur_seg != seg1) {
segment *segp = &Segments[cur_seg];
for (sidenum = 0; sidenum < MAX_SIDES_PER_SEGMENT; sidenum++) {
int snum = sidenum;
if (WALL_IS_DOORWAY(segp, snum) & wid_flag) {
int this_seg = segp->children[snum];
if (!visited[this_seg]) {
seg_queue[qtail].start = cur_seg;
seg_queue[qtail].end = this_seg;
visited[this_seg] = 1;
depth[qtail++] = cur_depth+1;
if (max_depth != -1) {
if (depth[qtail-1] == max_depth) {
Connected_segment_distance = 1000;
add_to_fcd_cache(seg0, seg1, Connected_segment_distance, F1_0*1000);
return -1;
}
} else if (this_seg == seg1) {
goto fcd_done1;
}
}
}
} // for (sidenum...
if (qhead >= qtail) {
Connected_segment_distance = 1000;
add_to_fcd_cache(seg0, seg1, Connected_segment_distance, F1_0*1000);
return -1;
}
cur_seg = seg_queue[qhead].end;
cur_depth = depth[qhead];
qhead++;
fcd_done1: ;
} // while (cur_seg ...
// Set qtail to the segment which ends at the goal.
while (seg_queue[--qtail].end != seg1)
if (qtail < 0) {
Connected_segment_distance = 1000;
add_to_fcd_cache(seg0, seg1, Connected_segment_distance, F1_0*1000);
return -1;
}
while (qtail >= 0) {
int parent_seg, this_seg;
this_seg = seg_queue[qtail].end;
parent_seg = seg_queue[qtail].start;
point_segs[num_points].segnum = this_seg;
compute_segment_center(&point_segs[num_points].point,&Segments[this_seg]);
num_points++;
if (parent_seg == seg0)
break;
while (seg_queue[--qtail].end != parent_seg)
Assert(qtail >= 0);
}
point_segs[num_points].segnum = seg0;
compute_segment_center(&point_segs[num_points].point,&Segments[seg0]);
num_points++;
if (num_points == 1) {
Connected_segment_distance = num_points;
return vm_vec_dist_quick(p0, p1);
} else {
dist = vm_vec_dist_quick(p1, &point_segs[1].point);
dist += vm_vec_dist_quick(p0, &point_segs[num_points-2].point);
for (i=1; i<num_points-2; i++) {
fix ndist;
ndist = vm_vec_dist_quick(&point_segs[i].point, &point_segs[i+1].point);
dist += ndist;
}
}
Connected_segment_distance = num_points;
add_to_fcd_cache(seg0, seg1, num_points, dist);
return dist;
}
int8_t convert_to_byte(fix f)
{
if (f >= 0x00010000)
return MATRIX_MAX;
else if (f <= -0x00010000)
return -MATRIX_MAX;
else
return f >> MATRIX_PRECISION;
}
#define VEL_PRECISION 12
// Create a shortpos struct from an object.
// Extract the matrix into int8_t values.
// Create a position relative to vertex 0 with 1/256 normal "fix" precision.
// Stuff segment in a short.
void create_shortpos(shortpos *spp, object *objp, int swap_bytes)
{
// int segnum;
int8_t *sp;
sp = spp->bytemat;
*sp++ = convert_to_byte(objp->orient.rvec.x);
*sp++ = convert_to_byte(objp->orient.uvec.x);
*sp++ = convert_to_byte(objp->orient.fvec.x);
*sp++ = convert_to_byte(objp->orient.rvec.y);
*sp++ = convert_to_byte(objp->orient.uvec.y);
*sp++ = convert_to_byte(objp->orient.fvec.y);
*sp++ = convert_to_byte(objp->orient.rvec.z);
*sp++ = convert_to_byte(objp->orient.uvec.z);
*sp++ = convert_to_byte(objp->orient.fvec.z);
spp->xo = (objp->pos.x - Vertices[Segments[objp->segnum].verts[0]].x) >> RELPOS_PRECISION;
spp->yo = (objp->pos.y - Vertices[Segments[objp->segnum].verts[0]].y) >> RELPOS_PRECISION;
spp->zo = (objp->pos.z - Vertices[Segments[objp->segnum].verts[0]].z) >> RELPOS_PRECISION;
spp->segment = objp->segnum;
spp->velx = (objp->mtype.phys_info.velocity.x) >> VEL_PRECISION;
spp->vely = (objp->mtype.phys_info.velocity.y) >> VEL_PRECISION;
spp->velz = (objp->mtype.phys_info.velocity.z) >> VEL_PRECISION;
// swap the short values for the big-endian machines.
/*if (swap_bytes) {
spp->xo = INTEL_SHORT(spp->xo);
spp->yo = INTEL_SHORT(spp->yo);
spp->zo = INTEL_SHORT(spp->zo);
spp->segment = INTEL_SHORT(spp->segment);
spp->velx = INTEL_SHORT(spp->velx);
spp->vely = INTEL_SHORT(spp->vely);
spp->velz = INTEL_SHORT(spp->velz);
}*/
// mprintf((0, "Matrix: %08x %08x %08x %08x %08x %08x\n", objp->orient.m1,objp->orient.m2,objp->orient.m3,
// spp->bytemat[0] << MATRIX_PRECISION,spp->bytemat[1] << MATRIX_PRECISION,spp->bytemat[2] << MATRIX_PRECISION));
//
// mprintf((0, " %08x %08x %08x %08x %08x %08x\n", objp->orient.m4,objp->orient.m5,objp->orient.m6,
// spp->bytemat[3] << MATRIX_PRECISION,spp->bytemat[4] << MATRIX_PRECISION,spp->bytemat[5] << MATRIX_PRECISION));
//
// mprintf((0, " %08x %08x %08x %08x %08x %08x\n", objp->orient.m7,objp->orient.m8,objp->orient.m9,
// spp->bytemat[6] << MATRIX_PRECISION,spp->bytemat[7] << MATRIX_PRECISION,spp->bytemat[8] << MATRIX_PRECISION));
//
// mprintf((0, "Positn: %08x %08x %08x %08x %08x %08x\n", objp->pos.x, objp->pos.y, objp->pos.z,
// (spp->xo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].x,
// (spp->yo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].y,
// (spp->zo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].z));
// mprintf((0, "Segment: %3i %3i\n", objp->segnum, spp->segment));
}
void extract_shortpos(object *objp, shortpos *spp, int swap_bytes)
{
int segnum;
int8_t *sp;
sp = spp->bytemat;
objp->orient.rvec.x = *sp++ << MATRIX_PRECISION;
objp->orient.uvec.x = *sp++ << MATRIX_PRECISION;
objp->orient.fvec.x = *sp++ << MATRIX_PRECISION;
objp->orient.rvec.y = *sp++ << MATRIX_PRECISION;
objp->orient.uvec.y = *sp++ << MATRIX_PRECISION;
objp->orient.fvec.y = *sp++ << MATRIX_PRECISION;
objp->orient.rvec.z = *sp++ << MATRIX_PRECISION;
objp->orient.uvec.z = *sp++ << MATRIX_PRECISION;
objp->orient.fvec.z = *sp++ << MATRIX_PRECISION;
/*if (swap_bytes) {
spp->xo = INTEL_SHORT(spp->xo);
spp->yo = INTEL_SHORT(spp->yo);
spp->zo = INTEL_SHORT(spp->zo);
spp->segment = INTEL_SHORT(spp->segment);
spp->velx = INTEL_SHORT(spp->velx);
spp->vely = INTEL_SHORT(spp->vely);
spp->velz = INTEL_SHORT(spp->velz);
}*/
segnum = spp->segment;
Assert((segnum >= 0) && (segnum <= Highest_segment_index));
objp->pos.x = (spp->xo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].x;
objp->pos.y = (spp->yo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].y;
objp->pos.z = (spp->zo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].z;
objp->mtype.phys_info.velocity.x = (spp->velx << VEL_PRECISION);
objp->mtype.phys_info.velocity.y = (spp->vely << VEL_PRECISION);
objp->mtype.phys_info.velocity.z = (spp->velz << VEL_PRECISION);
obj_relink(objp-Objects, segnum);
// mprintf((0, "Matrix: %08x %08x %08x %08x %08x %08x\n", objp->orient.m1,objp->orient.m2,objp->orient.m3,
// spp->bytemat[0],spp->bytemat[1],spp->bytemat[2]));
//
// mprintf((0, " %08x %08x %08x %08x %08x %08x\n", objp->orient.m4,objp->orient.m5,objp->orient.m6,
// spp->bytemat[3],spp->bytemat[4],spp->bytemat[5]));
//
// mprintf((0, " %08x %08x %08x %08x %08x %08x\n", objp->orient.m7,objp->orient.m8,objp->orient.m9,
// spp->bytemat[6],spp->bytemat[7],spp->bytemat[8]));
//
// mprintf((0, "Positn: %08x %08x %08x %08x %08x %08x\n", objp->pos.x, objp->pos.y, objp->pos.z,
// (spp->xo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].x, (spp->yo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].y, (spp->zo << RELPOS_PRECISION) + Vertices[Segments[segnum].verts[0]].z));
// mprintf((0, "Segment: %3i %3i\n", objp->segnum, spp->segment));
}
//--unused-- void test_shortpos(void)
//--unused-- {
//--unused-- shortpos spp;
//--unused--
//--unused-- create_shortpos(&spp, &Objects[0]);
//--unused-- extract_shortpos(&Objects[0], &spp);
//--unused--
//--unused-- }
// -----------------------------------------------------------------------------
// Segment validation functions.
// Moved from editor to game so we can compute surface normals at load time.
// -------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// Extract a vector from a segment. The vector goes from the start face to the end face.
// The point on each face is the average of the four points forming the face.
void extract_vector_from_segment(segment *sp, vms_vector *vp, int start, int end)
{
int i;
vms_vector vs,ve;
vm_vec_zero(&vs);
vm_vec_zero(&ve);
for (i=0; i<4; i++) {
vm_vec_add2(&vs,&Vertices[sp->verts[Side_to_verts[start][i]]]);
vm_vec_add2(&ve,&Vertices[sp->verts[Side_to_verts[end][i]]]);
}
vm_vec_sub(vp,&ve,&vs);
vm_vec_scale(vp,F1_0/4);
}
//create a matrix that describes the orientation of the given segment
void extract_orient_from_segment(vms_matrix *m,segment *seg)
{
vms_vector fvec,uvec;
extract_vector_from_segment(seg,&fvec,WFRONT,WBACK);
extract_vector_from_segment(seg,&uvec,WBOTTOM,WTOP);
//vector to matrix does normalizations and orthogonalizations
vm_vector_2_matrix(m,&fvec,&uvec,NULL);
}
#ifdef EDITOR
// ------------------------------------------------------------------------------------------
// Extract the forward vector from segment *sp, return in *vp.
// The forward vector is defined to be the vector from the the center of the front face of the segment
// to the center of the back face of the segment.
void extract_forward_vector_from_segment(segment *sp,vms_vector *vp)
{
extract_vector_from_segment(sp,vp,WFRONT,WBACK);
}
// ------------------------------------------------------------------------------------------
// Extract the right vector from segment *sp, return in *vp.
// The forward vector is defined to be the vector from the the center of the left face of the segment
// to the center of the right face of the segment.
void extract_right_vector_from_segment(segment *sp,vms_vector *vp)
{
extract_vector_from_segment(sp,vp,WLEFT,WRIGHT);
}
// ------------------------------------------------------------------------------------------
// Extract the up vector from segment *sp, return in *vp.
// The forward vector is defined to be the vector from the the center of the bottom face of the segment
// to the center of the top face of the segment.
void extract_up_vector_from_segment(segment *sp,vms_vector *vp)
{
extract_vector_from_segment(sp,vp,WBOTTOM,WTOP);
}
#endif
void add_side_as_quad(segment *sp, int sidenum, vms_vector *normal)
{
side *sidep = &sp->sides[sidenum];
sidep->type = SIDE_IS_QUAD;
#ifdef COMPACT_SEGS
normal = normal; //avoid compiler warning
#else
sidep->normals[0] = *normal;
sidep->normals[1] = *normal;
#endif
// If there is a connection here, we only formed the faces for the purpose of determining segment boundaries,
// so don't generate polys, else they will get rendered.
// if (sp->children[sidenum] != -1)
// sidep->render_flag = 0;
// else
// sidep->render_flag = 1;
}
// -------------------------------------------------------------------------------
// Return v0, v1, v2 = 3 vertices with smallest numbers. If *negate_flag set, then negate normal after computation.
// Note, you cannot just compute the normal by treating the points in the opposite direction as this introduces
// small differences between normals which should merely be opposites of each other.
void get_verts_for_normal(int va, int vb, int vc, int vd, int *v0, int *v1, int *v2, int *v3, int *negate_flag)
{
int i,j;
int v[4],w[4];
// w is a list that shows how things got scrambled so we know if our normal is pointing backwards
for (i=0; i<4; i++)
w[i] = i;
v[0] = va;
v[1] = vb;
v[2] = vc;
v[3] = vd;
for (i=1; i<4; i++)
for (j=0; j<i; j++)
if (v[j] > v[i]) {
int t;
t = v[j]; v[j] = v[i]; v[i] = t;
t = w[j]; w[j] = w[i]; w[i] = t;
}
Assert((v[0] < v[1]) && (v[1] < v[2]) && (v[2] < v[3]));
// Now, if for any w[i] & w[i+1]: w[i+1] = (w[i]+3)%4, then must swap
*v0 = v[0];
*v1 = v[1];
*v2 = v[2];
*v3 = v[3];
if ( (((w[0]+3) % 4) == w[1]) || (((w[1]+3) % 4) == w[2]))
*negate_flag = 1;
else
*negate_flag = 0;
}
// -------------------------------------------------------------------------------
void add_side_as_2_triangles(segment *sp, int sidenum)
{
vms_vector norm;
int8_t *vs = Side_to_verts[sidenum];
fix dot;
vms_vector vec_13; // vector from vertex 1 to vertex 3
side *sidep = &sp->sides[sidenum];
// Choose how to triangulate.
// If a wall, then
// Always triangulate so segment is convex.
// Use Matt's formula: Na . AD > 0, where ABCD are vertices on side, a is face formed by A,B,C, Na is normal from face a.
// If not a wall, then triangulate so whatever is on the other side is triangulated the same (ie, between the same absoluate vertices)
if (!IS_CHILD(sp->children[sidenum])) {
vm_vec_normal(&norm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]]);
vm_vec_sub(&vec_13, &Vertices[sp->verts[vs[3]]], &Vertices[sp->verts[vs[1]]]);
dot = vm_vec_dot(&norm, &vec_13);
// Now, signifiy whether to triangulate from 0:2 or 1:3
if (dot >= 0)
sidep->type = SIDE_IS_TRI_02;
else
sidep->type = SIDE_IS_TRI_13;
#ifndef COMPACT_SEGS
// Now, based on triangulation type, set the normals.
if (sidep->type == SIDE_IS_TRI_02) {
vm_vec_normal(&norm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]]);
sidep->normals[0] = norm;
vm_vec_normal(&norm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
sidep->normals[1] = norm;
} else {
vm_vec_normal(&norm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[3]]]);
sidep->normals[0] = norm;
vm_vec_normal(&norm, &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
sidep->normals[1] = norm;
}
#endif
} else {
int i,v[4], vsorted[4];
int negate_flag;
for (i=0; i<4; i++)
v[i] = sp->verts[vs[i]];
get_verts_for_normal(v[0], v[1], v[2], v[3], &vsorted[0], &vsorted[1], &vsorted[2], &vsorted[3], &negate_flag);
if ((vsorted[0] == v[0]) || (vsorted[0] == v[2])) {
sidep->type = SIDE_IS_TRI_02;
#ifndef COMPACT_SEGS
// Now, get vertices for normal for each triangle based on triangulation type.
get_verts_for_normal(v[0], v[1], v[2], 32767, &vsorted[0], &vsorted[1], &vsorted[2], &vsorted[3], &negate_flag);
vm_vec_normal(&norm, &Vertices[vsorted[0]], &Vertices[vsorted[1]], &Vertices[vsorted[2]]);
if (negate_flag)
vm_vec_negate(&norm);
sidep->normals[0] = norm;
get_verts_for_normal(v[0], v[2], v[3], 32767, &vsorted[0], &vsorted[1], &vsorted[2], &vsorted[3], &negate_flag);
vm_vec_normal(&norm, &Vertices[vsorted[0]], &Vertices[vsorted[1]], &Vertices[vsorted[2]]);
if (negate_flag)
vm_vec_negate(&norm);
sidep->normals[1] = norm;
#endif
} else {
sidep->type = SIDE_IS_TRI_13;
#ifndef COMPACT_SEGS
// Now, get vertices for normal for each triangle based on triangulation type.
get_verts_for_normal(v[0], v[1], v[3], 32767, &vsorted[0], &vsorted[1], &vsorted[2], &vsorted[3], &negate_flag);
vm_vec_normal(&norm, &Vertices[vsorted[0]], &Vertices[vsorted[1]], &Vertices[vsorted[2]]);
if (negate_flag)
vm_vec_negate(&norm);
sidep->normals[0] = norm;
get_verts_for_normal(v[1], v[2], v[3], 32767, &vsorted[0], &vsorted[1], &vsorted[2], &vsorted[3], &negate_flag);
vm_vec_normal(&norm, &Vertices[vsorted[0]], &Vertices[vsorted[1]], &Vertices[vsorted[2]]);
if (negate_flag)
vm_vec_negate(&norm);
sidep->normals[1] = norm;
#endif
}
}
}
int sign(fix v)
{
if (v > PLANE_DIST_TOLERANCE)
return 1;
else if (v < -(PLANE_DIST_TOLERANCE+1)) //neg & pos round differently
return -1;
else
return 0;
}
// -------------------------------------------------------------------------------
void create_walls_on_side(segment *sp, int sidenum)
{
int vm0, vm1, vm2, vm3, negate_flag;
int v0, v1, v2, v3;
vms_vector vn;
fix dist_to_plane;
v0 = sp->verts[Side_to_verts[sidenum][0]];
v1 = sp->verts[Side_to_verts[sidenum][1]];
v2 = sp->verts[Side_to_verts[sidenum][2]];
v3 = sp->verts[Side_to_verts[sidenum][3]];
get_verts_for_normal(v0, v1, v2, v3, &vm0, &vm1, &vm2, &vm3, &negate_flag);
vm_vec_normal(&vn, &Vertices[vm0], &Vertices[vm1], &Vertices[vm2]);
dist_to_plane = abs(vm_dist_to_plane(&Vertices[vm3], &vn, &Vertices[vm0]));
//if ((sp-Segments == 0x7b) && (sidenum == 3)) {
// mprintf((0, "Verts = %3i %3i %3i %3i, negate flag = %3i, dist = %8x\n", vm0, vm1, vm2, vm3, negate_flag, dist_to_plane));
// mprintf((0, " Normal = %8x %8x %8x\n", vn.x, vn.y, vn.z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm0, Vertices[vm0].x, Vertices[vm0].y, Vertices[vm0].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm1, Vertices[vm1].x, Vertices[vm1].y, Vertices[vm1].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm2, Vertices[vm2].x, Vertices[vm2].y, Vertices[vm2].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm3, Vertices[vm3].x, Vertices[vm3].y, Vertices[vm3].z));
//}
//if ((sp-Segments == 0x86) && (sidenum == 5)) {
// mprintf((0, "Verts = %3i %3i %3i %3i, negate flag = %3i, dist = %8x\n", vm0, vm1, vm2, vm3, negate_flag, dist_to_plane));
// mprintf((0, " Normal = %8x %8x %8x\n", vn.x, vn.y, vn.z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm0, Vertices[vm0].x, Vertices[vm0].y, Vertices[vm0].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm1, Vertices[vm1].x, Vertices[vm1].y, Vertices[vm1].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm2, Vertices[vm2].x, Vertices[vm2].y, Vertices[vm2].z));
// mprintf((0, " Vert %3i = [%8x %8x %8x]\n", vm3, Vertices[vm3].x, Vertices[vm3].y, Vertices[vm3].z));
//}
if (negate_flag)
vm_vec_negate(&vn);
if (dist_to_plane <= PLANE_DIST_TOLERANCE)
add_side_as_quad(sp, sidenum, &vn);
else {
add_side_as_2_triangles(sp, sidenum);
//this code checks to see if we really should be triangulated, and
//de-triangulates if we shouldn't be.
{
int num_faces;
int vertex_list[6];
fix dist0,dist1;
int s0,s1;
int vertnum;
side *s;
create_abs_vertex_lists( &num_faces, vertex_list, sp-Segments, sidenum);
Assert(num_faces == 2);
s = &sp->sides[sidenum];
vertnum = std::min(vertex_list[0],vertex_list[2]);
#ifdef COMPACT_SEGS
{
vms_vector normals[2];
get_side_normals(sp, sidenum, &normals[0], &normals[1] );
dist0 = vm_dist_to_plane(&Vertices[vertex_list[1]],&normals[1],&Vertices[vertnum]);
dist1 = vm_dist_to_plane(&Vertices[vertex_list[4]],&normals[0],&Vertices[vertnum]);
}
#else
dist0 = vm_dist_to_plane(&Vertices[vertex_list[1]],&s->normals[1],&Vertices[vertnum]);
dist1 = vm_dist_to_plane(&Vertices[vertex_list[4]],&s->normals[0],&Vertices[vertnum]);
#endif
s0 = sign(dist0);
s1 = sign(dist1);
if (s0==0 || s1==0 || s0!=s1) {
sp->sides[sidenum].type = SIDE_IS_QUAD; //detriangulate!
#ifndef COMPACT_SEGS
sp->sides[sidenum].normals[0] = vn;
sp->sides[sidenum].normals[1] = vn;
#endif
}
}
}
}
#ifdef COMPACT_SEGS
//#define CACHE_DEBUG 1
#define MAX_CACHE_NORMALS 128
#define CACHE_MASK 127
typedef struct ncache_element {
short segnum;
uint8_t sidenum;
vms_vector normals[2];
} ncache_element;
int ncache_initialized = 0;
ncache_element ncache[MAX_CACHE_NORMALS];
#ifdef CACHE_DEBUG
int ncache_counter = 0;
int ncache_hits = 0;
int ncache_misses = 0;
#endif
void ncache_init()
{
ncache_flush();
ncache_initialized = 1;
}
void ncache_flush()
{
int i;
for (i=0; i<MAX_CACHE_NORMALS; i++ ) {
ncache[i].segnum = -1;
}
}
// -------------------------------------------------------------------------------
int find_ncache_element( int segnum, int sidenum, int face_flags )
{
uint i;
if (!ncache_initialized) ncache_init();
#ifdef CACHE_DEBUG
if (((++ncache_counter % 5000)==1) && (ncache_hits+ncache_misses > 0))
mprintf(( 0, "NCACHE %d%% missed, H:%d, M:%d\n", (ncache_misses*100)/(ncache_hits+ncache_misses), ncache_hits, ncache_misses ));
#endif
i = ((segnum<<2) ^ sidenum) & CACHE_MASK;
if ((ncache[i].segnum == segnum) && ((ncache[i].sidenum&0xf)==sidenum) ) {
uint f1;
#ifdef CACHE_DEBUG
ncache_hits++;
#endif
f1 = ncache[i].sidenum>>4;
if ( (f1&face_flags)==face_flags )
return i;
if ( f1 & 1 )
uncached_get_side_normal( &Segments[segnum], sidenum, 1, &ncache[i].normals[1] );
else
uncached_get_side_normal( &Segments[segnum], sidenum, 0, &ncache[i].normals[0] );
ncache[i].sidenum |= face_flags<<4;
return i;
}
#ifdef CACHE_DEBUG
ncache_misses++;
#endif
switch( face_flags ) {
case 1:
uncached_get_side_normal( &Segments[segnum], sidenum, 0, &ncache[i].normals[0] );
break;
case 2:
uncached_get_side_normal( &Segments[segnum], sidenum, 1, &ncache[i].normals[1] );
break;
case 3:
uncached_get_side_normals(&Segments[segnum], sidenum, &ncache[i].normals[0], &ncache[i].normals[1] );
break;
}
ncache[i].segnum = segnum;
ncache[i].sidenum = sidenum | (face_flags<<4);
return i;
}
void get_side_normal(segment *sp, int sidenum, int face_num, vms_vector * vm )
{
int i;
i = find_ncache_element( sp - Segments, sidenum, 1 << face_num );
*vm = ncache[i].normals[face_num];
if (0) {
vms_vector tmp;
uncached_get_side_normal(sp, sidenum, face_num, &tmp );
Assert( tmp.x == vm->x );
Assert( tmp.y == vm->y );
Assert( tmp.z == vm->z );
}
}
void get_side_normals(segment *sp, int sidenum, vms_vector * vm1, vms_vector * vm2 )
{
int i;
i = find_ncache_element( sp - Segments, sidenum, 3 );
*vm1 = ncache[i].normals[0];
*vm2 = ncache[i].normals[1];
if (0) {
vms_vector tmp;
uncached_get_side_normal(sp, sidenum, 0, &tmp );
Assert( tmp.x == vm1->x );
Assert( tmp.y == vm1->y );
Assert( tmp.z == vm1->z );
uncached_get_side_normal(sp, sidenum, 1, &tmp );
Assert( tmp.x == vm2->x );
Assert( tmp.y == vm2->y );
Assert( tmp.z == vm2->z );
}
}
void uncached_get_side_normal(segment *sp, int sidenum, int face_num, vms_vector * vm )
{
int vm0, vm1, vm2, vm3, negate_flag;
char *vs = Side_to_verts[sidenum];
switch( sp->sides[sidenum].type ) {
case SIDE_IS_QUAD:
get_verts_for_normal(sp->verts[vs[0]], sp->verts[vs[1]], sp->verts[vs[2]], sp->verts[vs[3]], &vm0, &vm1, &vm2, &vm3, &negate_flag);
vm_vec_normal(vm, &Vertices[vm0], &Vertices[vm1], &Vertices[vm2]);
if (negate_flag)
vm_vec_negate(vm);
break;
case SIDE_IS_TRI_02:
if ( face_num == 0 )
vm_vec_normal(vm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]]);
else
vm_vec_normal(vm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
break;
case SIDE_IS_TRI_13:
if ( face_num == 0 )
vm_vec_normal(vm, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[3]]]);
else
vm_vec_normal(vm, &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
break;
}
}
void uncached_get_side_normals(segment *sp, int sidenum, vms_vector * vm1, vms_vector * vm2 )
{
int vvm0, vvm1, vvm2, vvm3, negate_flag;
char *vs = Side_to_verts[sidenum];
switch( sp->sides[sidenum].type ) {
case SIDE_IS_QUAD:
get_verts_for_normal(sp->verts[vs[0]], sp->verts[vs[1]], sp->verts[vs[2]], sp->verts[vs[3]], &vvm0, &vvm1, &vvm2, &vvm3, &negate_flag);
vm_vec_normal(vm1, &Vertices[vvm0], &Vertices[vvm1], &Vertices[vvm2]);
if (negate_flag)
vm_vec_negate(vm1);
*vm2 = *vm1;
break;
case SIDE_IS_TRI_02:
vm_vec_normal(vm1, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]]);
vm_vec_normal(vm2, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
break;
case SIDE_IS_TRI_13:
vm_vec_normal(vm1, &Vertices[sp->verts[vs[0]]], &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[3]]]);
vm_vec_normal(vm2, &Vertices[sp->verts[vs[1]]], &Vertices[sp->verts[vs[2]]], &Vertices[sp->verts[vs[3]]]);
break;
}
}
#endif
// -------------------------------------------------------------------------------
void validate_removable_wall(segment *sp, int sidenum, int tmap_num)
{
create_walls_on_side(sp, sidenum);
sp->sides[sidenum].tmap_num = tmap_num;
// assign_default_uvs_to_side(sp, sidenum);
// assign_light_to_side(sp, sidenum);
}
// -------------------------------------------------------------------------------
// Make a just-modified segment side valid.
void validate_segment_side(segment *sp, int sidenum)
{
if (sp->sides[sidenum].wall_num == -1)
create_walls_on_side(sp, sidenum);
else
// create_removable_wall(sp, sidenum, sp->sides[sidenum].tmap_num);
validate_removable_wall(sp, sidenum, sp->sides[sidenum].tmap_num);
// Set render_flag.
// If side doesn't have a child, then render wall. If it does have a child, but there is a temporary
// wall there, then do render wall.
// if (sp->children[sidenum] == -1)
// sp->sides[sidenum].render_flag = 1;
// else if (sp->sides[sidenum].wall_num != -1)
// sp->sides[sidenum].render_flag = 1;
// else
// sp->sides[sidenum].render_flag = 0;
}
extern int check_for_degenerate_segment(segment *sp);
// -------------------------------------------------------------------------------
// Make a just-modified segment valid.
// check all sides to see how many faces they each should have (0,1,2)
// create new vector normals
void validate_segment(segment *sp)
{
int side;
#ifdef EDITOR
check_for_degenerate_segment(sp);
#endif
for (side = 0; side < MAX_SIDES_PER_SEGMENT; side++)
validate_segment_side(sp, side);
// assign_default_uvs_to_segment(sp);
}
// -------------------------------------------------------------------------------
// Validate all segments.
// Highest_segment_index must be set.
// For all used segments (number <= Highest_segment_index), segnum field must be != -1.
void validate_segment_all(void)
{
int s;
for (s=0; s<=Highest_segment_index; s++)
#ifdef EDITOR
if (Segments[s].segnum != -1)
#endif
validate_segment(&Segments[s]);
#ifdef EDITOR
{
int said=0;
for (s=Highest_segment_index+1; s<MAX_SEGMENTS; s++)
if (Segments[s].segnum != -1) {
if (!said) {
mprintf((0, "Segment %i has invalid segnum. Bashing to -1. Silently bashing all others...", s));
}
said++;
Segments[s].segnum = -1;
}
if (said)
mprintf((0, "%i fixed.\n", said));
}
#endif
#ifndef NDEBUG
#ifndef COMPACT_SEGS
if (check_segment_connections())
Int3(); //Get Matt, si vous plait.
#endif
#endif
}
// ------------------------------------------------------------------------------------------------------
// Picks a random point in a segment like so:
// From center, go up to 50% of way towards any of the 8 vertices.
void pick_random_point_in_seg(vms_vector *new_pos, int segnum)
{
int vnum;
vms_vector vec2;
compute_segment_center(new_pos, &Segments[segnum]);
vnum = (P_Rand() * MAX_VERTICES_PER_SEGMENT) >> 15;
vm_vec_sub(&vec2, &Vertices[Segments[segnum].verts[vnum]], new_pos);
vm_vec_scale(&vec2, P_Rand()); // P_Rand() always in 0..1/2
vm_vec_add2(new_pos, &vec2);
}
// ----------------------------------------------------------------------------------------------------------
// Set the segment depth of all segments from start_seg in *segbuf.
// Returns maximum depth value.
int set_segment_depths(int start_seg, uint8_t *segbuf)
{
int i, curseg;
uint8_t visited[MAX_SEGMENTS];
int queue[MAX_SEGMENTS];
int head, tail;
int depth;
int parent_depth;
depth = 1;
head = 0;
tail = 0;
for (i=0; i<=Highest_segment_index; i++)
visited[i] = 0;
if (segbuf[start_seg] == 0)
return 1;
queue[tail++] = start_seg;
visited[start_seg] = 1;
segbuf[start_seg] = depth++;
if (depth == 0)
depth = 255;
while (head < tail) {
curseg = queue[head++];
parent_depth = segbuf[curseg];
for (i=0; i<MAX_SIDES_PER_SEGMENT; i++) {
int childnum;
childnum = Segments[curseg].children[i];
if (childnum != -1)
if (segbuf[childnum])
if (!visited[childnum]) {
visited[childnum] = 1;
segbuf[childnum] = parent_depth+1;
queue[tail++] = childnum;
}
}
}
return parent_depth+1;
}
//these constants should match the ones in seguvs
#define LIGHT_DISTANCE_THRESHOLD (F1_0*80)
#define Magical_light_constant (F1_0*16)
#define MAX_CHANGED_SEGS 30
short changed_segs[MAX_CHANGED_SEGS];
int n_changed_segs;
// ------------------------------------------------------------------------------------------
//cast static light from a segment to nearby segments
void apply_light_to_segment(segment *segp,vms_vector *segment_center, fix light_intensity,int recursion_depth)
{
vms_vector r_segment_center;
fix dist_to_rseg;
int i,segnum=segp-Segments,sidenum;
for (i=0;i<n_changed_segs;i++)
if (changed_segs[i] == segnum)
break;
if (i == n_changed_segs) {
compute_segment_center(&r_segment_center, segp);
dist_to_rseg = vm_vec_dist_quick(&r_segment_center, segment_center);
if (dist_to_rseg <= LIGHT_DISTANCE_THRESHOLD) {
fix light_at_point;
if (dist_to_rseg > F1_0)
light_at_point = fixdiv(Magical_light_constant, dist_to_rseg);
else
light_at_point = Magical_light_constant;
if (light_at_point >= 0) {
segment2 *seg2p = &Segment2s[segnum];
light_at_point = fixmul(light_at_point, light_intensity);
if (light_at_point >= F1_0)
light_at_point = F1_0-1;
if (light_at_point <= -F1_0)
light_at_point = -(F1_0-1);
seg2p->static_light += light_at_point;
if (seg2p->static_light < 0) // if it went negative, saturate
seg2p->static_light = 0;
} // end if (light_at_point...
} // end if (dist_to_rseg...
changed_segs[n_changed_segs++] = segnum;
}
if (recursion_depth < 2)
for (sidenum=0; sidenum<6; sidenum++) {
if (WALL_IS_DOORWAY(segp,sidenum) & WID_RENDPAST_FLAG)
apply_light_to_segment(&Segments[segp->children[sidenum]],segment_center,light_intensity,recursion_depth+1);
}
}
extern object *old_viewer;
//update the static_light field in a segment, which is used for object lighting
//this code is copied from the editor routine calim_process_all_lights()
void change_segment_light(int segnum,int sidenum,int dir)
{
segment *segp = &Segments[segnum];
if (WALL_IS_DOORWAY(segp, sidenum) & WID_RENDER_FLAG) {
side *sidep = &segp->sides[sidenum];
fix light_intensity;
light_intensity = TmapInfo[sidep->tmap_num].lighting + TmapInfo[sidep->tmap_num2 & 0x3fff].lighting;
light_intensity *= dir;
n_changed_segs = 0;
if (light_intensity) {
vms_vector segment_center;
compute_segment_center(&segment_center, segp);
apply_light_to_segment(segp,&segment_center,light_intensity,0);
}
}
//this is a horrible hack to get around the horrible hack used to
//smooth lighting values when an object moves between segments
old_viewer = NULL;
}
// ------------------------------------------------------------------------------------------
// dir = +1 -> add light
// dir = -1 -> subtract light
// dir = 17 -> add 17x light
// dir = 0 -> you are dumb
void change_light(int segnum, int sidenum, int dir)
{
int i, j, k;
for (i=0; i<Num_static_lights; i++) {
if ((Dl_indices[i].segnum == segnum) && (Dl_indices[i].sidenum == sidenum)) {
delta_light *dlp;
dlp = &Delta_lights[Dl_indices[i].index];
for (j=0; j<Dl_indices[i].count; j++) {
for (k=0; k<4; k++) {
fix dl,new_l;
dl = dir * dlp->vert_light[k] * DL_SCALE;
Assert((dlp->segnum >= 0) && (dlp->segnum <= Highest_segment_index));
Assert((dlp->sidenum >= 0) && (dlp->sidenum < MAX_SIDES_PER_SEGMENT));
new_l = (Segments[dlp->segnum].sides[dlp->sidenum].uvls[k].l += dl);
if (new_l < 0)
Segments[dlp->segnum].sides[dlp->sidenum].uvls[k].l = 0;
}
dlp++;
}
}
}
//recompute static light for segment
change_segment_light(segnum,sidenum,dir);
}
// Subtract light cast by a light source from all surfaces to which it applies light.
// This is precomputed data, stored at static light application time in the editor (the slow lighting function).
// returns 1 if lights actually subtracted, else 0
int subtract_light(int segnum, int sidenum)
{
if (Light_subtracted[segnum] & (1 << sidenum)) {
//mprintf((0, "Warning: Trying to subtract light from a source twice!\n"));
return 0;
}
Light_subtracted[segnum] |= (1 << sidenum);
change_light(segnum, sidenum, -1);
return 1;
}
// Add light cast by a light source from all surfaces to which it applies light.
// This is precomputed data, stored at static light application time in the editor (the slow lighting function).
// You probably only want to call this after light has been subtracted.
// returns 1 if lights actually added, else 0
int add_light(int segnum, int sidenum)
{
if (!(Light_subtracted[segnum] & (1 << sidenum))) {
//mprintf((0, "Warning: Trying to add light which has never been subtracted!\n"));
return 0;
}
Light_subtracted[segnum] &= ~(1 << sidenum);
change_light(segnum, sidenum, 1);
return 1;
}
// Light_subtracted[i] contains bit indicators for segment #i.
// If bit n (1 << n) is set, then side #n in segment #i has had light subtracted from original (editor-computed) value.
uint8_t Light_subtracted[MAX_SEGMENTS];
// Parse the Light_subtracted array, turning on or off all lights.
void apply_all_changed_light(void)
{
int i,j;
for (i=0; i<=Highest_segment_index; i++) {
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++)
if (Light_subtracted[i] & (1 << j))
change_light(i, j, -1);
}
}
//@@// Scans Light_subtracted bit array.
//@@// For all light sources which have had their light subtracted, adds light back in.
//@@void restore_all_lights_in_mine(void)
//@@{
//@@ int i, j, k;
//@@
//@@ for (i=0; i<Num_static_lights; i++) {
//@@ int segnum, sidenum;
//@@ delta_light *dlp;
//@@
//@@ segnum = Dl_indices[i].segnum;
//@@ sidenum = Dl_indices[i].sidenum;
//@@ if (Light_subtracted[segnum] & (1 << sidenum)) {
//@@ dlp = &Delta_lights[Dl_indices[i].index];
//@@
//@@ Light_subtracted[segnum] &= ~(1 << sidenum);
//@@ for (j=0; j<Dl_indices[i].count; j++) {
//@@ for (k=0; k<4; k++) {
//@@ fix dl;
//@@ dl = dlp->vert_light[k] * DL_SCALE;
//@@ Assert((dlp->segnum >= 0) && (dlp->segnum <= Highest_segment_index));
//@@ Assert((dlp->sidenum >= 0) && (dlp->sidenum < MAX_SIDES_PER_SEGMENT));
//@@ Segments[dlp->segnum].sides[dlp->sidenum].uvls[k].l += dl;
//@@ }
//@@ dlp++;
//@@ }
//@@ }
//@@ }
//@@}
// Should call this whenever a new mine gets loaded.
// More specifically, should call this whenever something global happens
// to change the status of static light in the mine.
void clear_light_subtracted(void)
{
int i;
for (i=0; i<=Highest_segment_index; i++)
Light_subtracted[i] = 0;
}
// -----------------------------------------------------------------------------
fix find_connected_distance_segments( int seg0, int seg1, int depth, int wid_flag)
{
vms_vector p0, p1;
compute_segment_center(&p0, &Segments[seg0]);
compute_segment_center(&p1, &Segments[seg1]);
return find_connected_distance(&p0, seg0, &p1, seg1, depth, wid_flag);
}
#define AMBIENT_SEGMENT_DEPTH 5
// -----------------------------------------------------------------------------
// Do a bfs from segnum, marking slots in marked_segs if the segment is reachable.
void ambient_mark_bfs(int segnum, int8_t *marked_segs, int depth)
{
int i;
if (depth < 0)
return;
marked_segs[segnum] = 1;
for (i=0; i<MAX_SIDES_PER_SEGMENT; i++) {
int child = Segments[segnum].children[i];
if (IS_CHILD(child) && (WALL_IS_DOORWAY(&Segments[segnum],i) & WID_RENDPAST_FLAG) && !marked_segs[child])
ambient_mark_bfs(child, marked_segs, depth-1);
}
}
// -----------------------------------------------------------------------------
// Indicate all segments which are within audible range of falling water or lava,
// and so should hear ambient gurgles.
void set_ambient_sound_flags_common(int tmi_bit, int s2f_bit)
{
int i, j;
int8_t marked_segs[MAX_SEGMENTS];
// Now, all segments containing ambient lava or water sound makers are flagged.
// Additionally flag all segments which are within range of them.
for (i=0; i<=Highest_segment_index; i++) {
marked_segs[i] = 0;
Segment2s[i].s2_flags &= ~s2f_bit;
}
// Mark all segments which are sources of the sound.
for (i=0; i<=Highest_segment_index; i++) {
segment *segp = &Segments[i];
segment2 *seg2p = &Segment2s[i];
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++) {
side *sidep = &segp->sides[j];
if ((TmapInfo[sidep->tmap_num].flags & tmi_bit) || (TmapInfo[sidep->tmap_num2 & 0x3fff].flags & tmi_bit)) {
if (!IS_CHILD(segp->children[j]) || (sidep->wall_num != -1)) {
seg2p->s2_flags |= s2f_bit;
marked_segs[i] = 1; // Say it's itself that it is close enough to to hear something.
}
}
}
}
// Next mark all segments within N segments of a source.
for (i=0; i<=Highest_segment_index; i++) {
segment2 *seg2p = &Segment2s[i];
if (seg2p->s2_flags & s2f_bit)
ambient_mark_bfs(i, marked_segs, AMBIENT_SEGMENT_DEPTH);
}
// Now, flip bits in all segments which can hear the ambient sound.
for (i=0; i<=Highest_segment_index; i++)
if (marked_segs[i])
Segment2s[i].s2_flags |= s2f_bit;
}
// -----------------------------------------------------------------------------
// Indicate all segments which are within audible range of falling water or lava,
// and so should hear ambient gurgles.
// Bashes values in Segment2s array.
void set_ambient_sound_flags(void)
{
set_ambient_sound_flags_common(TMI_VOLATILE, S2F_AMBIENT_LAVA);
set_ambient_sound_flags_common(TMI_WATER, S2F_AMBIENT_WATER);
}
| 30.694581 | 219 | 0.634525 | Kreeblah |
968c396fc3be636ce57ca53eae55cc1abc49e699 | 358 | cpp | C++ | 6. Heaps/Function_operator.cpp | suraj0803/DSA | 6ea21e452d7662e2351ee2a7b0415722e1bbf094 | [
"MIT"
] | null | null | null | 6. Heaps/Function_operator.cpp | suraj0803/DSA | 6ea21e452d7662e2351ee2a7b0415722e1bbf094 | [
"MIT"
] | null | null | null | 6. Heaps/Function_operator.cpp | suraj0803/DSA | 6ea21e452d7662e2351ee2a7b0415722e1bbf094 | [
"MIT"
] | null | null | null | #include<iostream>
using namespace std;
class Func
{
public:
void operator()(){
cout<<"Having Fun inside Operator() func.";
}
};
int main()
{
Func f;// Constructor
f();// Overloaded() Operator = Function call f is an object. As it is a object but it is behaving like a functional call.
return 0;
} | 16.272727 | 126 | 0.583799 | suraj0803 |
968c4e4d936965d36e0e8e9fc2f6cf999205efaa | 3,579 | cpp | C++ | src/reduced_alphabet_coder.cpp | metaVariable/ghostz | 273cc1efe6278f8012fa9232d854e392b467477f | [
"BSD-2-Clause"
] | null | null | null | src/reduced_alphabet_coder.cpp | metaVariable/ghostz | 273cc1efe6278f8012fa9232d854e392b467477f | [
"BSD-2-Clause"
] | null | null | null | src/reduced_alphabet_coder.cpp | metaVariable/ghostz | 273cc1efe6278f8012fa9232d854e392b467477f | [
"BSD-2-Clause"
] | null | null | null | /*
* reduced_alphabet_coder.cpp
*
* Created on: 2012/11/29
* Author: shu
*/
#include <iostream>
#include <stdint.h>
#include <vector>
#include <string.h>
#include <string>
#include <algorithm>
#include <limits.h>
#include "alphabet_type.h"
#include "alphabet_coder.h"
#include "reduced_alphabet_coder.h"
using namespace std;
ReducedAlphabetCoder::ReducedAlphabetCoder()
{}
ReducedAlphabetCoder::ReducedAlphabetCoder(const AlphabetType &type) :
AlphabetCoder(type) {
}
ReducedAlphabetCoder::ReducedAlphabetCoder(const AlphabetType &type, const std::vector<std::string> &alphabet_sets) {
Set(type, alphabet_sets);
}
ReducedAlphabetCoder::~ReducedAlphabetCoder()
{}
bool ReducedAlphabetCoder::Set(const AlphabetType &type, const std::vector<std::string> &alphabet_sets) {
vector<string> upper_alphabet_sets(alphabet_sets.size());
for (size_t i = 0; i < upper_alphabet_sets.size(); ++i) {
upper_alphabet_sets[i].resize(alphabet_sets[i].size());
transform(alphabet_sets[i].begin(), alphabet_sets[i].end(), upper_alphabet_sets[i].begin(), ToUpper());
}
min_regular_letter_code_ = 0;
uint32_t number_codes = 0;
string letters("");
letters += type.GetRegularLetters();
size_t ambiguous_letters_offset = letters.size();
letters += type.GetAmbiguousLetters();
size_t unkown_letter_offset = letters.size();
letters += type.GetUnknownLetter();
unknown_letter_ = toupper(type.GetUnknownLetter());
transform(letters.begin(), letters.end(), letters.begin(), ToUpper());
for (size_t i = 0; i < ambiguous_letters_offset; ++i) {
char representative_alphabet = GetRepresentativeAlphabet(upper_alphabet_sets, letters[i]);
if(representative_alphabet == letters[i]) {
++number_codes;
}
}
max_regular_letter_code_ = number_codes - 1;
for (size_t i = ambiguous_letters_offset; i < unkown_letter_offset; ++i) {
char representative_alphabet = GetRepresentativeAlphabet(upper_alphabet_sets, letters[i]);
if(representative_alphabet == letters[i]) {
++number_codes;
}
}
char representative_alphabet = GetRepresentativeAlphabet(upper_alphabet_sets, letters[unkown_letter_offset]);
unknown_code_ = representative_alphabet;
if (representative_alphabet == letters[unkown_letter_offset]) {
++number_codes;
}
max_code_ = number_codes - 1;
for (int i = 0; i < UCHAR_MAX; ++i) {
code_map_[i] = unknown_code_;
}
Code code = 0;
decode_map_.resize(max_code_ + 1,unknown_letter_);
for (uint32_t i = 0; i < letters.length(); ++i) {
representative_alphabet = GetRepresentativeAlphabet(upper_alphabet_sets, letters[i]);
if (representative_alphabet == letters[i]) {
code_map_[static_cast<int>(letters[i])] = code;
code_map_[tolower(letters[i])] = code;
decode_map_[code] = toupper(letters[i]);
++code;
}
}
for (uint32_t i = 0; i < letters.length(); ++i) {
representative_alphabet = GetRepresentativeAlphabet(upper_alphabet_sets, letters[i]);
if (representative_alphabet != letters[i]) {
code = code_map_[static_cast<int>(representative_alphabet)];
code_map_[static_cast<int>(letters[i])] = code;
code_map_[tolower(letters[i])] = code;
}
}
return true;
}
char ReducedAlphabetCoder::GetRepresentativeAlphabet(const std::vector<std::string> &alphabet_sets, const char c) {
for (size_t i = 0; i < alphabet_sets.size(); ++i) {
size_t count = 0;
for (; count < alphabet_sets[i].size(); ++count) {
if (alphabet_sets[i][count] == c) {
return alphabet_sets[i][0];
}
}
}
return c;
}
| 31.955357 | 117 | 0.703828 | metaVariable |
f7b9a5ba0cc3bb12e0efd5f74638123a0b2f1f7b | 551 | cc | C++ | src/gb/utils/log.cc | jonatan-ekstrom/FreshBoy | 228302e720f4a8fe4bf5c911e86588e412c0ce0a | [
"MIT"
] | 3 | 2021-11-30T20:37:33.000Z | 2022-01-06T20:26:52.000Z | src/gb/utils/log.cc | jonatan-ekstrom/FreshBoy | 228302e720f4a8fe4bf5c911e86588e412c0ce0a | [
"MIT"
] | null | null | null | src/gb/utils/log.cc | jonatan-ekstrom/FreshBoy | 228302e720f4a8fe4bf5c911e86588e412c0ce0a | [
"MIT"
] | null | null | null | #include "log.h"
#include <iostream>
namespace {
bool Enabled{false};
}
namespace gb::log {
void Enable() { Enabled = true; }
std::string Hex(const u16 address) {
constexpr char c[]{"0123456789ABCDEF"};
std::string res{"0x"};
res.push_back(c[(address >> 12) & 0x0F]);
res.push_back(c[(address >> 8) & 0x0F]);
res.push_back(c[(address >> 4) & 0x0F]);
res.push_back(c[address & 0x0F]);
return res;
}
void Warning(const std::string& txt) {
if (!Enabled) return;
std::cout << "WARN: " + txt << std::endl;
}
}
| 19.678571 | 45 | 0.598911 | jonatan-ekstrom |
f7bd6786d3a823303b0c3fbfe741d49f43adf94d | 5,972 | hpp | C++ | include/svgpp/parser/external_function/parse_misc_impl.hpp | RichardCory/svgpp | 801e0142c61c88cf2898da157fb96dc04af1b8b0 | [
"BSL-1.0"
] | 428 | 2015-01-05T17:13:54.000Z | 2022-03-31T08:25:47.000Z | include/svgpp/parser/external_function/parse_misc_impl.hpp | andrew2015/svgpp | 1d2f15ab5e1ae89e74604da08f65723f06c28b3b | [
"BSL-1.0"
] | 61 | 2015-01-08T14:32:27.000Z | 2021-12-06T16:55:11.000Z | include/svgpp/parser/external_function/parse_misc_impl.hpp | andrew2015/svgpp | 1d2f15ab5e1ae89e74604da08f65723f06c28b3b | [
"BSL-1.0"
] | 90 | 2015-05-19T04:56:46.000Z | 2022-03-26T16:42:50.000Z | // Copyright Oleg Maximenko 2016.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://github.com/svgpp/svgpp for library home page.
#pragma once
#include <boost/spirit/include/qi.hpp>
#include <svgpp/config.hpp>
#include <svgpp/parser/detail/common.hpp>
#include <svgpp/parser/external_function/parse_misc.hpp>
#include <svgpp/parser/grammar/length.hpp>
#define SVGPP_PARSE_MISC_IMPL(IteratorType, CoordinateType) \
template bool svgpp::detail::parse_viewBox<IteratorType, CoordinateType>( \
IteratorType &, IteratorType, CoordinateType &, CoordinateType &, CoordinateType &, CoordinateType &); \
template bool svgpp::detail::parse_bbox<IteratorType, CoordinateType>( \
IteratorType &, IteratorType, CoordinateType &, CoordinateType &, CoordinateType &, CoordinateType &); \
template bool svgpp::detail::parse_enable_background<IteratorType, svgpp::tag::source::attribute, CoordinateType>( \
IteratorType &, IteratorType, svgpp::tag::source::attribute, CoordinateType &, CoordinateType &, CoordinateType &, CoordinateType &); \
template bool svgpp::detail::parse_enable_background<IteratorType, svgpp::tag::source::css, CoordinateType>( \
IteratorType &, IteratorType, svgpp::tag::source::css, CoordinateType &, CoordinateType &, CoordinateType &, CoordinateType &);
#define SVGPP_PARSE_CLIP_IMPL(IteratorType, LengthFactoryType) \
template bool svgpp::detail::parse_clip<LengthFactoryType, IteratorType, svgpp::tag::source::css>( \
LengthFactoryType const &, IteratorType &, IteratorType, svgpp::tag::source::css, \
LengthFactoryType::length_type *); \
template bool svgpp::detail::parse_clip<LengthFactoryType, IteratorType, svgpp::tag::source::attribute>( \
LengthFactoryType const &, IteratorType &, IteratorType, svgpp::tag::source::attribute, \
LengthFactoryType::length_type *);
namespace svgpp { namespace detail
{
template<class Iterator, class Coordinate>
bool parse_viewBox(Iterator & it, Iterator end, Coordinate & x, Coordinate & y, Coordinate & w, Coordinate & h)
{
namespace qi = boost::spirit::qi;
namespace phx = boost::phoenix;
using qi::_1;
SVGPP_STATIC_IF_SAFE const qi::real_parser<Coordinate, detail::svg_real_policies<Coordinate> > number;
SVGPP_STATIC_IF_SAFE const detail::comma_wsp_rule_no_skip<Iterator> comma_wsp;
return qi::parse(it, end,
number[phx::ref(x) = _1] >> comma_wsp >>
number[phx::ref(y) = _1] >> comma_wsp >>
number[phx::ref(w) = _1] >> comma_wsp >>
number[phx::ref(h) = _1]);
}
template<class Iterator, class Coordinate>
bool parse_bbox(Iterator & it, Iterator end, Coordinate & lo_x, Coordinate & lo_y, Coordinate & hi_x, Coordinate & hi_y)
{
namespace qi = boost::spirit::qi;
namespace phx = boost::phoenix;
using qi::_1;
SVGPP_STATIC_IF_SAFE const qi::real_parser<Coordinate, detail::svg_real_policies<Coordinate> > number;
return qi::parse(it, end,
number[phx::ref(lo_x) = _1] >> qi::lit(',') >>
number[phx::ref(lo_y) = _1] >> qi::lit(',') >>
number[phx::ref(hi_x) = _1] >> qi::lit(',') >>
number[phx::ref(hi_y) = _1]);
}
template<class Iterator, class PropertySource, class Coordinate>
bool parse_enable_background(Iterator & it, Iterator end,
PropertySource property_source,
Coordinate & x, Coordinate & y, Coordinate & width, Coordinate & height)
{
namespace qi = boost::spirit::qi;
namespace phx = boost::phoenix;
using qi::_1;
SVGPP_STATIC_IF_SAFE const qi::real_parser<Coordinate, detail::number_policies<Coordinate, PropertySource> > number;
const qi::rule<Iterator> rule =
detail::no_case_if_css(property_source)[qi::lit("new")]
>> +detail::character_encoding_namespace::space
>> number[phx::ref(x) = qi::_1]
>> +detail::character_encoding_namespace::space
>> number[phx::ref(y) = qi::_1]
>> +detail::character_encoding_namespace::space
>> number[phx::ref(width) = qi::_1]
>> +detail::character_encoding_namespace::space
>> number[phx::ref(height) = qi::_1];
// TODO: check for negative values
return qi::parse(it, end, rule);
}
template<class LengthFactory, class Iterator, class PropertySource>
bool parse_clip(
LengthFactory const & length_factory,
Iterator & it, Iterator end,
PropertySource property_source,
typename LengthFactory::length_type * out_rect)
{
// 'auto' and 'inherit' values must be checked outside
namespace qi = boost::spirit::qi;
namespace phx = boost::phoenix;
using qi::_1;
SVGPP_STATIC_IF_SAFE const length_grammar<
PropertySource,
Iterator,
LengthFactory,
tag::length_dimension::width
> length_grammar_x;
SVGPP_STATIC_IF_SAFE const length_grammar<
PropertySource,
Iterator,
LengthFactory,
tag::length_dimension::height
> length_grammar_y;
// Initializing with values for 'auto'
for (int i = 0; i<4; ++i)
out_rect[i] = length_factory.create_length(0, tag::length_units::none());
const qi::rule<Iterator> rule =
detail::no_case_if_css(property_source)
[
qi::lit("rect") >> *detail::character_encoding_namespace::space >> qi::lit('(')
>> *detail::character_encoding_namespace::space
>> (qi::lit("auto")
| length_grammar_y(phx::cref(length_factory))[phx::ref(out_rect[0]) = qi::_1]
)
>> +detail::character_encoding_namespace::space
>> (qi::lit("auto")
| length_grammar_x(phx::cref(length_factory))[phx::ref(out_rect[1]) = qi::_1]
)
>> +detail::character_encoding_namespace::space
>> (qi::lit("auto")
| length_grammar_y(phx::cref(length_factory))[phx::ref(out_rect[2]) = qi::_1]
)
>> +detail::character_encoding_namespace::space
>> (qi::lit("auto")
| length_grammar_x(phx::cref(length_factory))[phx::ref(out_rect[3]) = qi::_1]
)
>> *detail::character_encoding_namespace::space >> qi::lit(')')
];
return qi::parse(it, end, rule);
}
}} | 40.90411 | 139 | 0.708138 | RichardCory |
f7c0b4f3b57ecb89c975c1f0a90b0e89490bbaf1 | 3,477 | cpp | C++ | src/jaegertracing/thrift-gen/aggregation_validator_types.cpp | ankit-varma10/jaeger-client-cpp | 855cddb1352347f8199be7e10c69fe970a020e22 | [
"Apache-2.0"
] | null | null | null | src/jaegertracing/thrift-gen/aggregation_validator_types.cpp | ankit-varma10/jaeger-client-cpp | 855cddb1352347f8199be7e10c69fe970a020e22 | [
"Apache-2.0"
] | null | null | null | src/jaegertracing/thrift-gen/aggregation_validator_types.cpp | ankit-varma10/jaeger-client-cpp | 855cddb1352347f8199be7e10c69fe970a020e22 | [
"Apache-2.0"
] | 1 | 2020-03-09T04:52:07.000Z | 2020-03-09T04:52:07.000Z | /**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "aggregation_validator_types.h"
#include <algorithm>
#include <ostream>
#include <thrift/TToString.h>
namespace jaegertracing { namespace thrift {
ValidateTraceResponse::~ValidateTraceResponse() throw() {
}
void ValidateTraceResponse::__set_ok(const bool val) {
this->ok = val;
}
void ValidateTraceResponse::__set_traceCount(const int64_t val) {
this->traceCount = val;
}
const char* ValidateTraceResponse::ascii_fingerprint = "92DB7C08FAF226B322B117D193F35B5F";
const uint8_t ValidateTraceResponse::binary_fingerprint[16] = {0x92,0xDB,0x7C,0x08,0xFA,0xF2,0x26,0xB3,0x22,0xB1,0x17,0xD1,0x93,0xF3,0x5B,0x5F};
uint32_t ValidateTraceResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_ok = false;
bool isset_traceCount = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->ok);
isset_ok = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->traceCount);
isset_traceCount = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_ok)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_traceCount)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ValidateTraceResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
oprot->incrementRecursionDepth();
xfer += oprot->writeStructBegin("ValidateTraceResponse");
xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1);
xfer += oprot->writeBool(this->ok);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("traceCount", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->traceCount);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
oprot->decrementRecursionDepth();
return xfer;
}
void swap(ValidateTraceResponse &a, ValidateTraceResponse &b) {
using ::std::swap;
swap(a.ok, b.ok);
swap(a.traceCount, b.traceCount);
}
ValidateTraceResponse::ValidateTraceResponse(const ValidateTraceResponse& other0) {
ok = other0.ok;
traceCount = other0.traceCount;
}
ValidateTraceResponse& ValidateTraceResponse::operator=(const ValidateTraceResponse& other1) {
ok = other1.ok;
traceCount = other1.traceCount;
return *this;
}
std::ostream& operator<<(std::ostream& out, const ValidateTraceResponse& obj) {
using apache::thrift::to_string;
out << "ValidateTraceResponse(";
out << "ok=" << to_string(obj.ok);
out << ", " << "traceCount=" << to_string(obj.traceCount);
out << ")";
return out;
}
}} // namespace
| 26.746154 | 144 | 0.672131 | ankit-varma10 |
f7c4ab92496fa5c7064134eae25f005cc2e84a66 | 132 | hpp | C++ | InvalidCardException.hpp | FrankBotos/PokerHandStrength | bd11de0f90bbf517b3b4cd10d7d6c933478047a9 | [
"MIT"
] | null | null | null | InvalidCardException.hpp | FrankBotos/PokerHandStrength | bd11de0f90bbf517b3b4cd10d7d6c933478047a9 | [
"MIT"
] | null | null | null | InvalidCardException.hpp | FrankBotos/PokerHandStrength | bd11de0f90bbf517b3b4cd10d7d6c933478047a9 | [
"MIT"
] | null | null | null | #pragma once
#include <stdexcept>
class InvalidCardException : public std::runtime_error
{
public:
InvalidCardException();
};
| 13.2 | 54 | 0.75 | FrankBotos |
f7c4ed699c8b50d7aa69b2a6e9cdc331830bdc6e | 744 | hpp | C++ | cpp/include/example/AsioTcpClient.hpp | skydiveuas/skylync | 73db7fe4593e262a1fc1a7b61c18190275abe723 | [
"MIT"
] | 1 | 2018-06-06T20:33:28.000Z | 2018-06-06T20:33:28.000Z | cpp/include/example/AsioTcpClient.hpp | skydiveuas/skylync | 73db7fe4593e262a1fc1a7b61c18190275abe723 | [
"MIT"
] | null | null | null | cpp/include/example/AsioTcpClient.hpp | skydiveuas/skylync | 73db7fe4593e262a1fc1a7b61c18190275abe723 | [
"MIT"
] | 1 | 2020-07-31T03:39:15.000Z | 2020-07-31T03:39:15.000Z | #ifndef EXAMPLE_ASIOTCPCLIENT_HPP
#define EXAMPLE_ASIOTCPCLIENT_HPP
#include "ICommInterface.hpp"
#include "asio.hpp"
#include <array>
namespace sl
{
namespace example
{
class AsioTcpClient : public sl::ICommInterface
{
public:
AsioTcpClient(ICommInterface::Listener* _listener, asio::io_context& _ioContext);
void connect(const std::string& host, const int port) override;
void disconnect() override;
void send(const DataPacket dataPacket) override;
private:
static constexpr size_t READ_BUFFER_SIZE = 1024;
std::array<uint8_t, READ_BUFFER_SIZE> readBuffer;
asio::io_context& ioContext;
asio::ip::tcp::socket socket;
void doRead();
};
} // example
} // sl
#endif // EXAMPLE_ASIOTCPCLIENT_HPP
| 17.714286 | 85 | 0.735215 | skydiveuas |
f7cf9513215406093d090b3305e6927d77e21171 | 1,007 | hpp | C++ | doc/quickbook/oglplus/quickref/enums/ext/debug_output_source.hpp | matus-chochlik/oglplus | 76dd964e590967ff13ddff8945e9dcf355e0c952 | [
"BSL-1.0"
] | 364 | 2015-01-01T09:38:23.000Z | 2022-03-22T05:32:00.000Z | doc/quickbook/oglplus/quickref/enums/ext/debug_output_source.hpp | matus-chochlik/oglplus | 76dd964e590967ff13ddff8945e9dcf355e0c952 | [
"BSL-1.0"
] | 55 | 2015-01-06T16:42:55.000Z | 2020-07-09T04:21:41.000Z | doc/quickbook/oglplus/quickref/enums/ext/debug_output_source.hpp | matus-chochlik/oglplus | 76dd964e590967ff13ddff8945e9dcf355e0c952 | [
"BSL-1.0"
] | 57 | 2015-01-07T18:35:49.000Z | 2022-03-22T05:32:04.000Z | // File doc/quickbook/oglplus/quickref/enums/ext/debug_output_source.hpp
//
// Automatically generated file, DO NOT modify manually.
// Edit the source 'source/enums/oglplus/ext/debug_output_source.txt'
// or the 'source/enums/make_enum.py' script instead.
//
// Copyright 2010-2019 Matus Chochlik.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
//[oglplus_enums_ext_debug_output_source
enum class DebugOutputARBSource : GLenum {
API = GL_DEBUG_SOURCE_API_ARB,
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB,
ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER_ARB,
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_ARB,
Application = GL_DEBUG_SOURCE_APPLICATION_ARB,
Other = GL_DEBUG_SOURCE_OTHER_ARB,
DontCare = GL_DONT_CARE
};
template <>
__Range<DebugOutputARBSource> __EnumValueRange<DebugOutputARBSource>();
__StrCRef __EnumValueName(DebugOutputARBSource);
//]
| 33.566667 | 73 | 0.784508 | matus-chochlik |
f7cfff6dd03f729f81f5df153e563d7bb50caacf | 648 | cpp | C++ | MPAGS-CIPHER/writeOutput.cpp | MPAGS-CPP-2019/mpags-day-2-JamesDownsLab | 9039e31b21c46008b4759e06a9e2cadff1b05014 | [
"MIT"
] | null | null | null | MPAGS-CIPHER/writeOutput.cpp | MPAGS-CPP-2019/mpags-day-2-JamesDownsLab | 9039e31b21c46008b4759e06a9e2cadff1b05014 | [
"MIT"
] | 1 | 2019-10-31T18:00:48.000Z | 2019-10-31T18:00:48.000Z | MPAGS-CIPHER/writeOutput.cpp | MPAGS-CPP-2019/mpags-day-2-JamesDownsLab | 9039e31b21c46008b4759e06a9e2cadff1b05014 | [
"MIT"
] | 1 | 2019-10-31T09:23:24.000Z | 2019-10-31T09:23:24.000Z | #include "writeOutput.hpp"
#include <string>
#include <fstream>
#include <iostream>
void write_output(
const std::string &outputFile,
const std::string &outputText) {
/*
* Writes outputText to outputFile. If outputFile is an empty string
* write the output to the console.
*/
if (!outputFile.empty()) {
std::ofstream out_file{outputFile};
bool ok_to_write{out_file.good()};
if (ok_to_write) {
out_file << outputText;
} else {
std::cerr << "Error writing file" << std::endl;
}
} else {
std::cout << outputText << std::endl;
}
}
| 24.923077 | 72 | 0.57716 | MPAGS-CPP-2019 |
f7d09690c76197e30d4bb019fdd51dfe7b72b611 | 2,039 | cpp | C++ | samples/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp | hamarb123/dotnet-api-docs | 6aeb55784944a2f1f5e773b657791cbd73a92dd4 | [
"CC-BY-4.0",
"MIT"
] | 421 | 2018-04-01T01:57:50.000Z | 2022-03-28T15:24:42.000Z | samples/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp | hamarb123/dotnet-api-docs | 6aeb55784944a2f1f5e773b657791cbd73a92dd4 | [
"CC-BY-4.0",
"MIT"
] | 5,797 | 2018-04-02T21:12:23.000Z | 2022-03-31T23:54:38.000Z | samples/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp | hamarb123/dotnet-api-docs | 6aeb55784944a2f1f5e773b657791cbd73a92dd4 | [
"CC-BY-4.0",
"MIT"
] | 1,482 | 2018-03-31T11:26:20.000Z | 2022-03-30T22:36:45.000Z |
// <Snippet1>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
XmlTextWriter^ writer = nullptr;
String^ filename = "sampledata.xml";
writer = gcnew XmlTextWriter( filename, nullptr );
//Use indenting for readability.
writer->Formatting = Formatting::Indented;
//Write the XML delcaration
writer->WriteStartDocument();
//Write the ProcessingInstruction node.
String^ PItext = "type=\"text/xsl\" href=\"book.xsl\"";
writer->WriteProcessingInstruction( "xml-stylesheet", PItext );
//Write the DocumentType node.
writer->WriteDocType( "book", nullptr, nullptr, "<!ENTITY h \"hardcover\">" );
//Write a Comment node.
writer->WriteComment( "sample XML" );
//Write the root element.
writer->WriteStartElement( "book" );
//Write the genre attribute.
writer->WriteAttributeString( "genre", "novel" );
//Write the ISBN attribute.
writer->WriteAttributeString( "ISBN", "1-8630-014" );
//Write the title.
writer->WriteElementString( "title", "The Handmaid's Tale" );
//Write the style element.
writer->WriteStartElement( "style" );
writer->WriteEntityRef( "h" );
writer->WriteEndElement();
//Write the price.
writer->WriteElementString( "price", "19.95" );
//Write CDATA.
writer->WriteCData( "Prices 15% off!!" );
//Write the close tag for the root element.
writer->WriteEndElement();
writer->WriteEndDocument();
//Write the XML to file and close the writer.
writer->Flush();
writer->Close();
//Load the file into an XmlDocument to ensure well formed XML.
XmlDocument^ doc = gcnew XmlDocument;
//Preserve white space for readability.
doc->PreserveWhitespace = true;
//Load the file.
doc->Load( filename );
//Display the XML content to the console.
Console::Write( doc->InnerXml );
}
// </Snippet1>
| 26.828947 | 82 | 0.62972 | hamarb123 |
f7d0a156d1a840df1a733e12ecaeb962021e42c7 | 1,522 | cpp | C++ | shared/vkRenderers/VulkanClear.cpp | adoug/3D-Graphics-Rendering-Cookbook | dabffed670b8be5a619f0f62b10e0cc8ccdd5a36 | [
"MIT"
] | 399 | 2021-06-03T02:42:20.000Z | 2022-03-27T23:23:15.000Z | shared/vkRenderers/VulkanClear.cpp | adoug/3D-Graphics-Rendering-Cookbook | dabffed670b8be5a619f0f62b10e0cc8ccdd5a36 | [
"MIT"
] | 7 | 2021-07-13T02:36:01.000Z | 2022-03-26T03:46:37.000Z | shared/vkRenderers/VulkanClear.cpp | adoug/3D-Graphics-Rendering-Cookbook | dabffed670b8be5a619f0f62b10e0cc8ccdd5a36 | [
"MIT"
] | 53 | 2021-06-02T20:02:24.000Z | 2022-03-29T15:36:30.000Z | #include "shared/Utils.h"
#include "shared/UtilsMath.h"
#include "shared/vkRenderers/VulkanClear.h"
#include "shared/EasyProfilerWrapper.h"
VulkanClear::VulkanClear(VulkanRenderDevice& vkDev, VulkanImage depthTexture)
: RendererBase(vkDev, depthTexture)
, shouldClearDepth(depthTexture.image != VK_NULL_HANDLE)
{
if (!createColorAndDepthRenderPass(
vkDev, shouldClearDepth, &renderPass_, RenderPassCreateInfo{ .clearColor_ = true, .clearDepth_ = true, .flags_ = eRenderPassBit_First }))
{
printf("VulkanClear: failed to create render pass\n");
exit(EXIT_FAILURE);
}
createColorAndDepthFramebuffers(vkDev, renderPass_, depthTexture.imageView, swapchainFramebuffers_);
}
void VulkanClear::fillCommandBuffer(VkCommandBuffer commandBuffer, size_t swapFramebuffer)
{
EASY_FUNCTION();
const VkClearValue clearValues[2] =
{
VkClearValue { .color = { 1.0f, 1.0f, 1.0f, 1.0f } },
VkClearValue { .depthStencil = { 1.0f, 0 } }
};
const VkRect2D screenRect = {
.offset = { 0, 0 },
.extent = {.width = framebufferWidth_, .height = framebufferHeight_ }
};
const VkRenderPassBeginInfo renderPassInfo = {
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
.renderPass = renderPass_,
.framebuffer = swapchainFramebuffers_[swapFramebuffer],
.renderArea = screenRect,
.clearValueCount = static_cast<uint32_t>(shouldClearDepth ? 2 : 1),
.pClearValues = &clearValues[0]
};
vkCmdBeginRenderPass( commandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE );
vkCmdEndRenderPass( commandBuffer );
}
| 32.382979 | 139 | 0.761498 | adoug |
f7d69ac314df9f0d7e36c1472107ed435f235080 | 1,384 | cc | C++ | tests/elle/Printable.cc | infinitio/elle | d9bec976a1217137436db53db39cda99e7024ce4 | [
"Apache-2.0"
] | 521 | 2016-02-14T00:39:01.000Z | 2022-03-01T22:39:25.000Z | tests/elle/Printable.cc | infinitio/elle | d9bec976a1217137436db53db39cda99e7024ce4 | [
"Apache-2.0"
] | 8 | 2017-02-21T11:47:33.000Z | 2018-11-01T09:37:14.000Z | tests/elle/Printable.cc | infinitio/elle | d9bec976a1217137436db53db39cda99e7024ce4 | [
"Apache-2.0"
] | 48 | 2017-02-21T10:18:13.000Z | 2022-03-25T02:35:20.000Z | #include <elle/test.hh>
#include <elle/Printable.hh>
#include <iostream>
#include <sstream>
namespace elle
{
class ComplexNumber : public Printable
{
public:
ComplexNumber(int real, int imag);
~ComplexNumber();
void
set(int real, int imag);
void
print(std::ostream& stream) const;
private:
int _real, _imag;
};
ComplexNumber::ComplexNumber(int real, int imag)
{
_real = real;
_imag = imag;
}
ComplexNumber::~ComplexNumber()
{
}
void
ComplexNumber::set(int real, int imag)
{
_real = real;
_imag = imag;
}
void
ComplexNumber::print(std::ostream& stream) const
{
if (_imag >= 0)
stream << _real << " + " << _imag << "j";
if (_imag < 0)
stream << _real << " - " << abs(_imag) << "j";
}
}
static
void
test_generic(int x, int y)
{
elle::ComplexNumber testPositive(x, y);
std::stringstream output, expected;
if (y >= 0)
expected << x << " + " << y << "j";
if (y < 0)
expected << x << " - " << abs(y) << "j";
testPositive.print(output);
BOOST_CHECK_EQUAL(output.str(), expected.str());
}
ELLE_TEST_SUITE()
{
boost::unit_test::test_suite* basics = BOOST_TEST_SUITE("Basics");
boost::unit_test::framework::master_test_suite().add(basics);
basics->add(BOOST_TEST_CASE(std::bind(test_generic, 1, 2)));
basics->add(BOOST_TEST_CASE(std::bind(test_generic, 3, -5)));
}
| 17.74359 | 67 | 0.615607 | infinitio |
f7d7561837a92999a315ff140df0d9893a61cd26 | 1,109 | cpp | C++ | Engine/Source/Rendering/VertexArray.cpp | wdrDarx/DEngine3 | 27e2de3b56b6d4c8705e8a0e36f5911d8651caa2 | [
"MIT"
] | 2 | 2022-01-11T21:15:31.000Z | 2022-02-22T21:14:33.000Z | Engine/Source/Rendering/VertexArray.cpp | wdrDarx/DEngine3 | 27e2de3b56b6d4c8705e8a0e36f5911d8651caa2 | [
"MIT"
] | null | null | null | Engine/Source/Rendering/VertexArray.cpp | wdrDarx/DEngine3 | 27e2de3b56b6d4c8705e8a0e36f5911d8651caa2 | [
"MIT"
] | null | null | null | #pragma once
#include "VertexArray.h"
#include "VertexBufferLayout.h"
#include "Vertexbuffer.h"
VertexArray::VertexArray()
{
glGenVertexArrays(1, &m_RendererID);
}
VertexArray::~VertexArray()
{
glDeleteVertexArrays(1, &m_RendererID);
}
void VertexArray::Addbuffer(const VertexBuffer& vb, const VertexBufferLayout& layout)
{
Bind();
vb.Bind();
const auto& elements = layout.GetElements();
uptr offset = 0;
for (uint i = 0; i < elements.size(); i++)
{
const auto& element = elements[i];
uint AttribLayoutIndex = i + layout.m_InitialLayoutOffset;
glEnableVertexAttribArray(AttribLayoutIndex);
glVertexAttribPointer(AttribLayoutIndex, element.count, element.type, element.normalized, layout.GetStride(), (const void*)offset);
glVertexAttribDivisor(AttribLayoutIndex, element.instanceCounter); //0 = per vertex, 1 = per instance, 2 = per 2 instances etc
offset += element.count * VertexBufferElement::GetSizeOfType(element.type);
}
m_VertexBuffer = &vb;
}
void VertexArray::Bind() const
{
glBindVertexArray(m_RendererID);
}
void VertexArray::Unbind() const
{
glBindVertexArray(0);
}
| 24.644444 | 133 | 0.74752 | wdrDarx |
f7d813c47898857d7f483f3d86bcdc4f637aac01 | 1,447 | cpp | C++ | exercises/C01-Beginner_Exercises/S06-fwcTools2/Solutions/160_ChangeTextSOLN.cpp | rdholder/FeetWetCoding | c0106009eae0ff0fadd7e96b8adfe3a815d5dcfb | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2016-04-28T19:31:51.000Z | 2016-05-22T06:57:47.000Z | exercises/C01-Beginner_Exercises/S06-fwcTools2/Solutions/160_ChangeTextSOLN.cpp | rdholder/FeetWetCoding | c0106009eae0ff0fadd7e96b8adfe3a815d5dcfb | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | exercises/C01-Beginner_Exercises/S06-fwcTools2/Solutions/160_ChangeTextSOLN.cpp | rdholder/FeetWetCoding | c0106009eae0ff0fadd7e96b8adfe3a815d5dcfb | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | // copyright (c) 2011 Robert Holder, Janice Dugger.
// See HELP.html included in this distribution.
#include <exercises/C01_S06.h>
// ==========================================
// = THIS IS THE SOLUTION CODE =
// = THIS IS *NOT* THE EXERCISE CODE =
// = (If you meant to look at the exercise =
// = it's in the directory above this one.) =
// ==========================================
void ChangeTextSoln::runExercise()
{
std::string key;
seeout << "Press keys R, G or B to change circle color and text color description, or q to quit.\n";
int circle = fwcCircle(200,200,75,BLUE,1,true);
fwcText("Circle color is:", 100, 300, BLUE, 24);
int circle_color_text = fwcText("BLUE",180,350,BLUE,20);
while ( key != "q" && key != "Q" )
{
key = waitForKeyPress(); // = is pronounced "GETS"
if ( key == "r" || key == "R" ) // == is pronounced "EQUALS" :-)
{
fwcChangeColor(circle,RED,true);
fwcChangeText(circle_color_text,"RED");
}
if ( key == "g" || key == "G" )
{
fwcChangeColor(circle,GREEN,true);
fwcChangeText(circle_color_text,"GREEN");
}
if ( key == "b" || key == "B" )
{
fwcChangeColor(circle,BLUE,true);
fwcChangeText(circle_color_text,"BLUE");
}
}
fwcClearItems();
fwcText("DONE!", 60, 150, DARKBLUE, 60);
}
| 30.787234 | 104 | 0.514858 | rdholder |
f7e15c976119ea8f370ce1e1037c6aeb883717a6 | 4,000 | cpp | C++ | server/Server/Packets/CGUnEquipHandler.cpp | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | 3 | 2018-06-19T21:37:38.000Z | 2021-07-31T21:51:40.000Z | server/Server/Packets/CGUnEquipHandler.cpp | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | null | null | null | server/Server/Packets/CGUnEquipHandler.cpp | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | 13 | 2015-01-30T17:45:06.000Z | 2022-01-06T02:29:34.000Z | #include "stdafx.h"
#include "CGUnEquip.h"
#include "Type.h"
#include "Log.h"
#include "GamePlayer.h"
#include "Scene.h"
#include "Obj_Human.h"
#include "GCUnEquipResult.h"
#include "GCCharEquipment.h"
#include "HumanItemLogic.h"
#include "ItemOperator.h"
extern UINT GetEquipmentMaxLevelGemID(Item *pEquipment);
UINT CGUnEquipHandler::Execute( CGUnEquip* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
Assert( pGamePlayer ) ;
Obj_Human* pHuman = pGamePlayer->GetHuman() ;
Assert( pHuman ) ;
Scene* pScene = pHuman->getScene() ;
if( pScene==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
//检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
HUMAN_EQUIP EquipPoint = (HUMAN_EQUIP)pPacket->getEquipPoint();
//Assert( pHuman->GetDB()->GetEquipDB()->IsSet(EquipPoint) ) ;
Item* pEquipItem = HumanItemLogic::GetEquip(pHuman,EquipPoint);
if(!pEquipItem)
{
Assert(pEquipItem);
return PACKET_EXE_CONTINUE;
}
if(pEquipItem->IsEmpty())
{
return PACKET_EXE_CONTINUE;
}
UCHAR itemClass = pEquipItem->GetItemClass();
if(itemClass == ICLASS_EQUIP)
{
INT BagIndex;// = pHuman->GetFirstEmptyBagIndex();
ItemContainer* pEquipContainer = pHuman->GetEquipContain();
ItemContainer* pBaseContainer = pHuman->GetBaseContain();
if(!pEquipContainer)
{
Assert(pEquipItem);
return PACKET_EXE_CONTINUE;
}
BYTE DeliverBagIndex = pPacket->getBagIndex();
if(DeliverBagIndex<pBaseContainer->GetContainerSize())
{
BagIndex = g_ItemOperator.MoveItem(pEquipContainer,
EquipPoint,
pBaseContainer,DeliverBagIndex);
}
else
{
BagIndex = g_ItemOperator.MoveItem(pEquipContainer,
EquipPoint,
pBaseContainer);
}
GCUnEquipResult Msg;
if(BagIndex>=0
&& BagIndex<pBaseContainer->GetContainerSize())
{
Msg.setEquipPoint(EquipPoint);
Msg.setBagIndex(BagIndex);
Msg.setItemID(pEquipItem->GetGUID());
Msg.setItemTableIndex(pEquipItem->GetItemTableIndex());
Msg.setResult(UNEQUIP_SUCCESS);
pHuman->SetEquipVer(pHuman->GetEquipVer()+1);
pHuman->ItemEffectFlush();
pGamePlayer->SendPacket( &Msg ) ;
//如果可见
if(pHuman->IsVisualPart(EquipPoint))
{
GCCharEquipment OtherMsg;
OtherMsg.setObjID(pHuman->GetID());
//if(EquipPoint == HEQUIP_WEAPON)
//{
// UINT uGemID = GetEquipmentMaxLevelGemID(pEquipItem);
// OtherMsg.setID(EquipPoint,pEquipItem->GetItemTableIndex(), uGemID);
//}
//else
//{
OtherMsg.setID(EquipPoint,pEquipItem->GetItemTableIndex(), -1);
//}
pScene->BroadCast(&OtherMsg,pHuman,TRUE);
}
}
else
{
if(ITEMOE_DESTOPERATOR_HASITEM == BagIndex)
{
Msg.setResult(UNEQUIP_HAS_ITEM);
pGamePlayer->SendPacket( &Msg );
}
else if(ITEMOE_DESTOPERATOR_FULL == BagIndex)
{
Msg.setResult(UNEQUIP_BAG_FULL);
pGamePlayer->SendPacket( &Msg );
}
}
}
else
{
Assert(FALSE);
//装备为什么不是 ICLASS_EQUIP
}
g_pLog->FastSaveLog( LOG_FILE_1, "CGUnEquipHandler EquipPoint=%d itemClass=%d",
EquipPoint, itemClass ) ;
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
} | 27.39726 | 89 | 0.5575 | viticm |
f7e9ec9db344b25b9553fee2fdad35f3de141b20 | 464 | hpp | C++ | renderboi/toolbox/mesh_generators/mesh_type.hpp | deqyra/GLSandbox | 40d641ebbf6af694e8640a584d283876d128748c | [
"MIT"
] | null | null | null | renderboi/toolbox/mesh_generators/mesh_type.hpp | deqyra/GLSandbox | 40d641ebbf6af694e8640a584d283876d128748c | [
"MIT"
] | null | null | null | renderboi/toolbox/mesh_generators/mesh_type.hpp | deqyra/GLSandbox | 40d641ebbf6af694e8640a584d283876d128748c | [
"MIT"
] | null | null | null | #ifndef RENDERBOI__TOOLBOX__MESH_GENERATORS__MESH_TYPE_HPP
#define RENDERBOI__TOOLBOX__MESH_GENERATORS__MESH_TYPE_HPP
namespace Renderboi
{
/// @brief Collection of literals describing the different shapes a mesh can
// come in. Each of these can be mapped to a concrete MeshGenerator subclass.
enum class MeshType
{
Axes,
Cube,
Plane,
Tetrahedron,
Torus
};
}//namespace Renderboi
#endif//RENDERBOI__TOOLBOX__MESH_GENERATORS__MESH_TYPE_HPP | 23.2 | 77 | 0.797414 | deqyra |
f7ed264042caccf0b2df1c7d7acfbb8d9262ae47 | 918 | cpp | C++ | C_CPP/final/tree.cpp | dengchongsen/study_codes | 29d74c05d340117f76aafcc320766248a0f8386b | [
"MulanPSL-1.0"
] | null | null | null | C_CPP/final/tree.cpp | dengchongsen/study_codes | 29d74c05d340117f76aafcc320766248a0f8386b | [
"MulanPSL-1.0"
] | null | null | null | C_CPP/final/tree.cpp | dengchongsen/study_codes | 29d74c05d340117f76aafcc320766248a0f8386b | [
"MulanPSL-1.0"
] | null | null | null | #include<iostream>
#include<cstring>
#include<queue>
using namespace std;
char ans[99];
int lans = 0;
char ca[99];
char cb[99];
int la, lb;
void dfs(int index){
if( ca[index] == '\0' || ca[index] == '#') {
ans[lans++] = '#';
return ;
}
ans[lans++] = ca[index];
dfs( 2*index+1 );
dfs( 2*index+2);
}
int main(){
int n;
cin >> n;
while(n--){
memset(ca,'\0',sizeof(ca));
memset(cb, '\0', sizeof(cb));
memset(ans, '\0', sizeof(ans));
lans = 0;
cin >> ca >> cb;
la = strlen(ca);
lb = strlen(cb);
dfs(0);
// for(int i=0; i<lans; i++){
// cout<<ans[i];
// }
// cout<<endl;
int flag = 0;
for( int i=0; i<lb; i++){
// cout<<ans[i]<<" "<<cb[i]<<endl;
if( ans[i] != cb[i] ){
flag = 1;
break;
};
}
if(flag==0){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
} | 16.105263 | 46 | 0.446623 | dengchongsen |
f7edf7b2b27d08a886d369f0bf63b52a5fe87b87 | 5,030 | cpp | C++ | PrinterContextNativeRuntimeComponent/PrinterProperty.cpp | Ganeshcoep/print-oem-samples | 0508c31e2881ee0d4379cd7ff830e0062e818a6c | [
"MIT"
] | 4 | 2020-03-25T20:39:20.000Z | 2021-04-20T16:11:17.000Z | PrinterContextNativeRuntimeComponent/PrinterProperty.cpp | Ganeshcoep/print-oem-samples | 0508c31e2881ee0d4379cd7ff830e0062e818a6c | [
"MIT"
] | 2 | 2017-12-13T16:44:29.000Z | 2018-11-14T16:01:37.000Z | PrinterContextNativeRuntimeComponent/PrinterProperty.cpp | Ganeshcoep/print-oem-samples | 0508c31e2881ee0d4379cd7ff830e0062e818a6c | [
"MIT"
] | 7 | 2019-06-13T23:15:42.000Z | 2020-08-05T14:57:37.000Z | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
* PARTICULAR PURPOSE.
*
* This class represents a specific printer property
* as described in https://msdn.microsoft.com/library/windows/hardware/hh439547
*/
#include "pch.h"
#include "PrinterProperty.h"
// Namespaces
using namespace Windows::Foundation;
namespace PrinterContextNativeRuntimeComponent
{
namespace Printing
{
namespace PrinterExtension
{
PrinterProperty::PrinterProperty(IPrinterPropertyBag* bag, Platform::String^ printerName)
{
m_printerPropertyBag = bag;
m_printerName = AutoBSTR(printerName);
}
bool PrinterProperty::GetBool(IPrinterPropertyBag* bag, BSTR name)
{
BOOL b;
ThrowIf(bag->GetBool(name, &b));
return b ? true : false;
}
void PrinterProperty::SetBool(IPrinterPropertyBag* bag, BSTR name, bool value)
{
ThrowIf(bag->SetBool(name, value));
}
int PrinterProperty::GetInt(IPrinterPropertyBag* bag, BSTR name)
{
LONG u;
ThrowIf(bag->GetInt32(name, &u));
return u;
}
void PrinterProperty::SetInt(IPrinterPropertyBag* bag, BSTR name, int value)
{
LONG u = value;
ThrowIf(bag->SetInt32(name, u));
}
String^ PrinterProperty::GetString(IPrinterPropertyBag* bag, BSTR name)
{
BSTR u = NULL;
StringNonZeroCheck(bag->GetString(name, &u));
Platform::String^ s = ref new Platform::String(u);
return s;
}
void PrinterProperty::SetString(IPrinterPropertyBag* bag, BSTR name, Platform::String^ value)
{
AutoBSTR b(value);
ThrowIf(bag->SetString(name, b));
}
Array<byte>^ PrinterProperty::GetBytes(IPrinterPropertyBag* bag, BSTR name)
{
DWORD count;
BYTE* val = NULL;
StringNonZeroCheck(bag->GetBytes(name, &count, &val));
return ref new Array<byte, 1>(val, count); //TODO:Test that this is OK
}
void PrinterProperty::SetBytes(IPrinterPropertyBag* bag, BSTR name, const Array<byte>^ value)
{
ThrowIf(bag->SetBytes(name, value->Length, value->Data));
}
IStream* PrinterProperty::GetReadStream(IPrinterPropertyBag* bag, BSTR name)
{
IStream* s = NULL;
ThrowIf(bag->GetReadStream(name, &s));
return s;
}
IStream* PrinterProperty::GetWriteStream(IPrinterPropertyBag* bag, BSTR name)
{
IStream* s = NULL;
ThrowIf(bag->GetWriteStream(name, &s));
return s;
}
// Properties
bool PrinterProperty::Bool::get()
{
return GetBool(m_printerPropertyBag.Get(), m_printerName);
}
void PrinterProperty::Bool::set(bool value)
{
SetBool(m_printerPropertyBag.Get(), m_printerName, value);
}
int PrinterProperty::Int::get()
{
return GetInt(m_printerPropertyBag.Get(), m_printerName);
}
void PrinterProperty::Int::set(int value)
{
SetInt(m_printerPropertyBag.Get(), m_printerName, value);
}
Platform::String^ PrinterProperty::String::get()
{
return GetString(m_printerPropertyBag.Get(), m_printerName);
}
void PrinterProperty::String::set(Platform::String^ value)
{
SetString(m_printerPropertyBag.Get(), m_printerName, value);
}
Array<byte>^ PrinterProperty::Bytes::get()
{
return GetBytes(m_printerPropertyBag.Get(), m_printerName);
}
void PrinterProperty::Bytes::set(const Array<byte>^ value)
{
SetBytes(m_printerPropertyBag.Get(), m_printerName, value);
}
//Actually an IStream* return value
ULONGLONG PrinterProperty::ReadStream2::get()
{
return (ULONGLONG)GetReadStream(m_printerPropertyBag.Get(), m_printerName);
}
//Actually an IStream* return value
ULONGLONG PrinterProperty::WriteStream2::get()
{
return (ULONGLONG)GetWriteStream(m_printerPropertyBag.Get(), m_printerName);
}
}
}
} | 33.986486 | 105 | 0.541948 | Ganeshcoep |
f7ef46b21439489c8caa208e04fb2175b74b4130 | 11,891 | cpp | C++ | MQUVCopyByVCol.cpp | devil-tamachan/MQUVCopyByVCol | d1a2d16df137a7759b7b13d2dcd2573c2ddf47d7 | [
"BSD-3-Clause"
] | null | null | null | MQUVCopyByVCol.cpp | devil-tamachan/MQUVCopyByVCol | d1a2d16df137a7759b7b13d2dcd2573c2ddf47d7 | [
"BSD-3-Clause"
] | null | null | null | MQUVCopyByVCol.cpp | devil-tamachan/MQUVCopyByVCol | d1a2d16df137a7759b7b13d2dcd2573c2ddf47d7 | [
"BSD-3-Clause"
] | null | null | null | //---------------------------------------------------------------------------
//
// MQUVCopyByVCol
//
// Copyright(C) 1999-2013, tetraface Inc.
//
// Sample for Object plug-in for deleting faces with reserving lines
// in the faces.
// Created DLL must be installed in "Plugins\Object" directory.
//
// オブジェクト中の辺のみを残して面を削除するオブジェクトプラグイン
// のサンプル。
// 作成したDLLは"Plugins\Object"フォルダに入れる必要がある。
//
//
//---------------------------------------------------------------------------
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <atlbase.h>
#include <atlstr.h>
#include <atlcoll.h>
#include "MQPlugin.h"
#include "MQBasePlugin.h"
#include "MQWidget.h"
HINSTANCE hInstance;
//---------------------------------------------------------------------------
// DllMain
//---------------------------------------------------------------------------
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
// リソース表示に必要なので、インスタンスを保存しておく
// Store the instance because it is necessary for displaying resources.
hInstance = (HINSTANCE)hModule;
// プラグインとしては特に必要な処理はないので、何もせずにTRUEを返す
// There is nothing to do for a plugin. So just return TRUE.
return TRUE;
}
//---------------------------------------------------------------------------
// class MQUVCopyByVColPlugin
//---------------------------------------------------------------------------
class MQUVCopyByVColPlugin : public MQObjectPlugin
{
public:
MQUVCopyByVColPlugin();
~MQUVCopyByVColPlugin();
void GetPlugInID(DWORD *Product, DWORD *ID) override;
const char *GetPlugInName(void) override;
const char *EnumString(int index) override;
BOOL Execute(int index, MQDocument doc) override;
private:
BOOL MQUVCopyByVCol(MQDocument doc);
BOOL DeleteLines(MQDocument doc);
};
MQBasePlugin *GetPluginClass()
{
static MQUVCopyByVColPlugin plugin;
return &plugin;
}
MQUVCopyByVColPlugin::MQUVCopyByVColPlugin()
{
}
MQUVCopyByVColPlugin::~MQUVCopyByVColPlugin()
{
}
//---------------------------------------------------------------------------
// MQGetPlugInID
// プラグインIDを返す。
// この関数は起動時に呼び出される。
//---------------------------------------------------------------------------
void MQUVCopyByVColPlugin::GetPlugInID(DWORD *Product, DWORD *ID)
{
// プロダクト名(制作者名)とIDを、全部で64bitの値として返す
// 値は他と重複しないようなランダムなもので良い
*Product = 0x8AFEA457;
*ID = 0x9F57C622;
}
//---------------------------------------------------------------------------
// MQGetPlugInName
// プラグイン名を返す。
// この関数は[プラグインについて]表示時に呼び出される。
//---------------------------------------------------------------------------
const char *MQUVCopyByVColPlugin::GetPlugInName(void)
{
// プラグイン名
return "MQUVCopyByVCol Copyright(C) 2016, tamachan";
}
//---------------------------------------------------------------------------
// MQEnumString
// ポップアップメニューに表示される文字列を返す。
// この関数は起動時に呼び出される。
//---------------------------------------------------------------------------
const char *MQUVCopyByVColPlugin::EnumString(int index)
{
static char buffer[256];
switch(index){
case 0:
// Note: following $res$ means the string uses system resource string.
return "頂点色が同じUVをコピー";
}
return NULL;
}
//---------------------------------------------------------------------------
// MQModifyObject
// メニューから選択されたときに呼び出される。
//---------------------------------------------------------------------------
BOOL MQUVCopyByVColPlugin::Execute(int index, MQDocument doc)
{
switch(index){
case 0: return MQUVCopyByVCol(doc);
}
return FALSE;
}
int compare_VCols(const void *a, const void *b)
{
return memcmp(a, b, 13/*rgb*4+fTri*/);
}
int compare_VCol1(const void *a, const void *b)
{
return memcmp(a, b, 3/*rgb*/);
}
static const DWORD g_VColUVs_OneSetSize = 3/*RGB*/*4/*角形*/+1/*fTri*/ + sizeof(MQCoordinate)*4/*角形*/;
int SearchVCols(BYTE *pVColUVs, DWORD numSet, BYTE *vcols)
{
int mid;
int left = 0;
int right = numSet-1;
while (left < right) {
mid = (left + right) / 2;
if (compare_VCols((const void*)(pVColUVs + g_VColUVs_OneSetSize * mid), vcols) < 0) left = mid + 1; else right = mid;
}
if (compare_VCols((const void*)(pVColUVs + g_VColUVs_OneSetSize * left), vcols) == 0) return left;
return -1;
}
void rotateL(BYTE *arr, int unitSize, int numUnit, int shift)
{
if(shift>=numUnit)shift%=numUnit;
if(shift==0)return;
BYTE *t = NULL;
if(numUnit/2 < shift)
{//right rotate
shift = numUnit - shift;
int tSize = shift*unitSize;
BYTE *t = (BYTE *)malloc(tSize);
memcpy(t, arr+(numUnit-shift)*unitSize, tSize);
memmove(arr+shift*unitSize, arr, (numUnit-shift)*unitSize);
memcpy(arr, t, tSize);
} else {//left rotate
int tSize = shift*unitSize;
BYTE *t = (BYTE *)malloc(tSize);
memcpy(t, arr, tSize);
memmove(arr, arr+shift*unitSize, (numUnit-shift)*unitSize);
memcpy(arr+(numUnit-shift)*unitSize, t, tSize);
}
free(t);
}
void rotateR(BYTE *arr, int unitSize, int numUnit, int shift)
{
if(shift>=numUnit)shift%=numUnit;
if(shift==0)return;
int lshift = numUnit-shift;
rotateL(arr, unitSize, numUnit, lshift);
}
int SearchMinVColIdx(BYTE *vcols, int numV)
{
int minIdx=0;
int minCnt=0;
for(int i=1;i<numV;i++)
{
int result = compare_VCol1(vcols+i*3, vcols+minIdx*3);
if(result<0)
{
minIdx=i;
minCnt=1;
} else if(result==0)
{
minCnt++;
}
}
if(minCnt>1)
{
int unitSize = 3*numV;
BYTE *vcolsArr = (BYTE*)malloc(unitSize*numV);
memcpy(vcolsArr, vcols, unitSize);
for(int i=1;i<numV;i++)
{
BYTE *dst = vcolsArr+unitSize*i;
memcpy(dst, vcols, unitSize);
rotateL(dst, 3, numV, i+1);
}
minIdx=0;
for(int i=1;i<numV;i++)
{
int result = memcmp(vcols+i*unitSize, vcols+minIdx*unitSize, unitSize);
if(result<0)minIdx=i;
}
free(vcolsArr);
}
return minIdx;
}
int SortVCols(BYTE *vcols, int numV)
{
int minIdx = SearchMinVColIdx(vcols, numV);
if(minIdx==0)return minIdx;
rotateL(vcols, 3, numV, minIdx);
return minIdx;
}
void SortUVs(BYTE *pVColUVs, int numV, int minIdx)
{
rotateL(pVColUVs + 13, sizeof(MQCoordinate), numV, minIdx);
}
int SortVColUV(BYTE *pVColUVs)
{
int numV = pVColUVs[12]==1?3:4;
int minIdx = SortVCols(pVColUVs, numV);
if(minIdx>0)SortUVs(pVColUVs, numV, minIdx);
return minIdx;
}
void DbgVColUVs(BYTE *p)
{
CString s;
s.Format("%02X%02X%02X %02X%02X%02X %02X%02X%02X %02X%02X%02X %02X %f,%f %f,%f %f,%f %f,%f", p[0],p[1],p[2], p[3],p[4],p[5], p[6],p[7],p[8], p[9],p[10],p[11], p[12], *(float*)(p+13),*(float*)(p+17), *(float*)(p+21),*(float*)(p+25), *(float*)(p+29),*(float*)(p+33), *(float*)(p+37),*(float*)(p+41));
OutputDebugString(s);
}
void DbgVCols(BYTE *p)
{
CString s;
s.Format("%02X%02X%02X %02X%02X%02X %02X%02X%02X %02X%02X%02X %02X", p[0],p[1],p[2], p[3],p[4],p[5], p[6],p[7],p[8], p[9],p[10],p[11], p[12]);
OutputDebugString(s);
}
DWORD ReadVColUVs(MQObject oBrush, BYTE *pVColUVs)
{
DWORD numSet = 0;
BYTE *pCur = pVColUVs;
for(int fi=0;fi<oBrush->GetFaceCount();fi++)
{
int numV = oBrush->GetFacePointCount(fi);
if(numV>=5)
{
MessageBox(NULL, "brushオブジェクトに5角以上のポリゴンが含まれています", "エラー", MB_ICONSTOP);
return 0;
}
if(numV<=2)continue;
for(int j=0;j<numV;j++)
{
DWORD c = oBrush->GetFaceVertexColor(fi, j);
memcpy(pCur, &c, 3);
pCur+=3;
}
if(numV==3)
{
memset(pCur, 0, 3);
pCur+=3;
*pCur=1;
} else *pCur=0;
pCur++;
oBrush->GetFaceCoordinateArray(fi, (MQCoordinate*)pCur);
pCur+=sizeof(MQCoordinate)*4;
numSet++;
}
pCur = pVColUVs;
for(int i=0;i<numSet;i++)
{
//OutputDebugString(pCur[12]?"3":"4");
//DbgVColUVs(pCur);
SortVColUV(pCur);
//DbgVColUVs(pCur);
pCur+=g_VColUVs_OneSetSize;
}
//OutputDebugString("++++++++++++++++++++++Sorted src");
/*pCur = pVColUVs;
for(int i=0;i<numSet;i++)
{
DbgVColUVs(pCur);
pCur+=g_VColUVs_OneSetSize;
}*/
//OutputDebugString("----------------------Sorted src");
/*FILE *fp = fopen("C:\\tmp\\dbg2.bin", "wb");
if(fp!=NULL)
{
fwrite(pVColUVs, g_VColUVs_OneSetSize, numSet, fp);
fclose(fp);
}*/
qsort(pVColUVs, numSet, g_VColUVs_OneSetSize, compare_VCols);
OutputDebugString("++++++++++++++++++++++Sorted src2");
pCur = pVColUVs;
for(int i=0;i<numSet;i++)
{
DbgVColUVs(pCur);
pCur+=g_VColUVs_OneSetSize;
}
OutputDebugString("----------------------Sorted src2");
return numSet;
}
void SetUVs(MQObject o, int fi, BYTE *pVColUVs, int idx, int rshift)
{
MQCoordinate uvs[4];
/*{
CString s;
s.Format("idx==%d\n", idx);
OutputDebugString(s);
}*/
int numV = pVColUVs[12]==1 ? 3:4;
if(numV!=o->GetFacePointCount(fi))return;
void *pStart = (pVColUVs + idx*g_VColUVs_OneSetSize + 13);
memcpy(uvs, pStart, sizeof(MQCoordinate)*numV);
/*for(int i=0;i<numV;i++)
{
CString s;
s.Format("%f,%f\n", uvs[i].u, uvs[i].v);
OutputDebugString(s);
}*/
//OutputDebugString("------------------");
rotateR((BYTE*)uvs, sizeof(MQCoordinate), numV, rshift);
/*for(int i=0;i<numV;i++)
{
CString s;
s.Format("%f,%f\n", uvs[i].u, uvs[i].v);
OutputDebugString(s);
}*/
//OutputDebugString("------------------");
o->SetFaceCoordinateArray(fi, uvs);
}
BOOL MQUVCopyByVColPlugin::MQUVCopyByVCol(MQDocument doc)
{
BYTE *pVColUVs = NULL;
CAtlArray<MQObject> targetObjArr;
MQObject oBrush = NULL;
int numObj = doc->GetObjectCount();
for(int i=0;i<numObj;i++)
{
MQObject o = doc->GetObject(i);
if(o!=NULL)
{
CString objName;
o->GetName(objName.GetBufferSetLength(151), 150);
objName.ReleaseBuffer();
if(objName==_T("brush"))oBrush = o;
else {
targetObjArr.Add(o);
}
}
}
if(oBrush == NULL || oBrush->GetFaceCount()==0 ||targetObjArr.GetCount()==0)return FALSE;
pVColUVs = (BYTE*)calloc(oBrush->GetFaceCount(), g_VColUVs_OneSetSize);
if(pVColUVs==NULL)goto failed_MQUVCopyByVCol;
DWORD numSetSrc = ReadVColUVs(oBrush, pVColUVs);
if(numSetSrc==0)goto failed_MQUVCopyByVCol;
//OutputDebugString("src readed-----------------\n");
/*FILE *fp = fopen("C:\\tmp\\dbg.bin", "wb");
if(fp!=NULL)
{
fwrite(pVColUVs, g_VColUVs_OneSetSize, numSetSrc, fp);
fclose(fp);
}*/
BYTE vcols[13] = {0};
for(int oi=0;oi<targetObjArr.GetCount();oi++)
{
MQObject o = targetObjArr[oi];
int numFace = o->GetFaceCount();
//CString s;
//s.Format("g_VColUVs_OneSetSize==%d\n", g_VColUVs_OneSetSize);
//OutputDebugString(s);
//s.Format("sizeof(MQCoordinate)==%d\n", sizeof(MQCoordinate));
//OutputDebugString(s);
//o->GetName(s.GetBufferSetLength(255), 255);
//OutputDebugString(s);
//s.Format("numFace == %d\n", numFace);
//OutputDebugString(s);
for(int fi=0;fi<numFace;fi++)
{
int numV = o->GetFacePointCount(fi);
//s.Format("numV == %d\n", numV);
//OutputDebugString(s);
if(numV!=3 && numV!=4)continue;
memset(vcols, 0, sizeof(vcols));
for(int j=0;j<numV;j++)
{
*((DWORD*)(vcols+3*j)) = o->GetFaceVertexColor(fi, j);
}
if(numV==3)vcols[9]=0;
vcols[12] = numV==3?1:0;
OutputDebugString("-------------\n");
DbgVCols(vcols);
int minIdx = SortVCols(vcols, numV);
DbgVCols(vcols);
int idx = SearchVCols(pVColUVs, numSetSrc, vcols);
if(idx>=0)
{
DbgVColUVs(pVColUVs+idx*g_VColUVs_OneSetSize);
SetUVs(o, fi, pVColUVs, idx, minIdx);
} else OutputDebugString("ERR: vcol not found\n");
}
}
if(pVColUVs!=NULL)free(pVColUVs);
return TRUE;
failed_MQUVCopyByVCol:
if(pVColUVs!=NULL)free(pVColUVs);
return FALSE;
}
| 26.307522 | 305 | 0.570516 | devil-tamachan |
f7f14c072123066b3863735cf881deb6aecd6db0 | 1,411 | cpp | C++ | lib/mayaUsd/undo/UsdUndoManager.cpp | smithw-adsk/maya-usd | 3a2278111e631423ffa9bae28158a6d2299a200e | [
"Apache-2.0"
] | null | null | null | lib/mayaUsd/undo/UsdUndoManager.cpp | smithw-adsk/maya-usd | 3a2278111e631423ffa9bae28158a6d2299a200e | [
"Apache-2.0"
] | 4 | 2020-05-04T19:21:26.000Z | 2020-05-08T15:30:38.000Z | lib/mayaUsd/undo/UsdUndoManager.cpp | smithw-adsk/maya-usd | 3a2278111e631423ffa9bae28158a6d2299a200e | [
"Apache-2.0"
] | 1 | 2020-05-04T22:14:09.000Z | 2020-05-04T22:14:09.000Z | //
// Copyright 2020 Autodesk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "UsdUndoManager.h"
#include "UsdUndoBlock.h"
#include "UsdUndoStateDelegate.h"
PXR_NAMESPACE_USING_DIRECTIVE
namespace MAYAUSD_NS_DEF {
UsdUndoManager& UsdUndoManager::instance()
{
static UsdUndoManager undoManager;
return undoManager;
}
void UsdUndoManager::trackLayerStates(const SdfLayerHandle& layer)
{
layer->SetStateDelegate(UsdUndoStateDelegate::New());
}
void UsdUndoManager::addInverse(InvertFunc func)
{
if (UsdUndoBlock::depth() == 0) {
TF_CODING_ERROR("Collecting invert functions outside of undoblock is not allowed!");
return;
}
_invertFuncs.emplace_back(func);
}
void UsdUndoManager::transferEdits(UsdUndoableItem& undoableItem)
{
// transfer the edits
undoableItem._invertFuncs = std::move(_invertFuncs);
}
} // namespace MAYAUSD_NS_DEF
| 26.12963 | 92 | 0.744862 | smithw-adsk |
f7f4961c679525497c2980665598f0c615d4197d | 5,802 | inl | C++ | Core/DianYing/Include/Dy/Management/Inline/MWindowImpl.inl | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | 4 | 2019-03-17T19:46:54.000Z | 2019-12-09T20:11:01.000Z | Core/DianYing/Include/Dy/Management/Inline/MWindowImpl.inl | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | Core/DianYing/Include/Dy/Management/Inline/MWindowImpl.inl | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | #ifndef GUARD_DY_MANAGEMENT_WINDOWMANAGER_IMPL_INL
#define GUARD_DY_MANAGEMENT_WINDOWMANAGER_IMPL_INL
///
/// MIT License
/// Copyright (c) 2018-2019 Jongmin Yun
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
///
namespace dy
{
inline MWindow::Impl::Impl(MWindow& parent) : mImplParent{parent}
{
/// @brief Initialize OpenGL Context.
/// This function must be returned `EDySuccess::DY_SUCCESS`.
static auto InitializeOpenGL = [this]()
{
glfwInit();
// Create descriptor.
PDyGLWindowContextDescriptor descriptor{};
descriptor.mWindowName = "DianYing";
descriptor.mIsWindowResizable = false;
descriptor.mIsWindowVisible = true;
descriptor.mIsWindowShouldFocus = true;
descriptor.mIsUsingDefaultDoubleBuffer = true;
const auto& settingManager = MSetting::GetInstance();
descriptor.mWindowSize = DIVec2{
settingManager.GetWindowSizeWidth(),
settingManager.GetWindowSizeHeight()
};
this->mGlfwWindow = XGLWrapper::CreateGLWindow(descriptor);
// Create window instance for giving context to I/O worker thread.
descriptor.mIsWindowShouldFocus = false;
descriptor.mIsWindowVisible = false;
descriptor.mSharingContext = this->mGlfwWindow;
for (auto& ptrWindow : this->mGlfwWorkerWnds) { ptrWindow = XGLWrapper::CreateGLWindow(descriptor); }
// Check validity
if (this->mGlfwWindow == nullptr) { glfwTerminate(); return EDySuccess::DY_FAILURE; }
XGLWrapper::CreateGLContext(this->mGlfwWindow);
gladLoadGLLoader(reinterpret_cast<GLADloadproc>(glfwGetProcAddress));
glfwSetInputMode(this->mGlfwWindow, GLFW_STICKY_KEYS, GL_FALSE);
glfwSetFramebufferSizeCallback(this->mGlfwWindow, &DyGlCallbackFrameBufferSize);
glfwSetWindowCloseCallback(this->mGlfwWindow, &DyGlCallbackWindowClose);
// If in debug build environment, enable debug output logging.
#if defined(_DEBUG) || !defined(_NDEBUG)
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(DyGlMessageCallback, nullptr);
GLuint unusedIds = 0;
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, &unusedIds, GL_TRUE);
glfwSetErrorCallback(&DyGLFWErrorFunction);
#endif
// Setting rendering.
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
{ // Make initialized screen to black for giving liability to users XD
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.f, 0.f, 0.f, 1.0f);
glfwSwapBuffers(this->mGlfwWindow);
glfwPollEvents();
}
return EDySuccess::DY_SUCCESS;
};
//! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//! FUNCTIONBODY ∨
//! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DyPushLogDebugInfo("{} | MWindow::Impl::pfInitialize().", "FunctionCall");
// If we should create console window...
if (MSetting::GetInstance().IsEnabledSubFeatureLoggingToConsole() == true)
{
const auto flag = gEngine->GetPlatformInfo().CreateConsoleWindow();
MDY_ASSERT(flag == true);
}
// @TODO TEMP
switch (MSetting::GetInstance().GetRenderingType())
{
default: MDY_UNEXPECTED_BRANCH(); break;
case EDyRenderingApi::DirectX12: MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::Vulkan: MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::DirectX11: MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::OpenGL:
DyPushLogDebugInfo("Initialize OpenGL Context.");
MDY_CALL_ASSERT_SUCCESS(InitializeOpenGL());
break;
}
}
inline MWindow::Impl::~Impl()
{
DyPushLogDebugInfo("{} | MWindow::Impl::pfRelease().", "FunctionCall");
switch (MSetting::GetInstance().GetRenderingType())
{
default: MDY_UNEXPECTED_BRANCH();
case EDyRenderingApi::DirectX11: DyPushLogDebugInfo("Release DirectX11 Context."); MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::DirectX12: DyPushLogDebugInfo("Release DirectX12 Context."); MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::Vulkan: DyPushLogDebugInfo("Release Vulkan Context."); MDY_NOT_IMPLEMENTED_ASSERT(); break;
case EDyRenderingApi::OpenGL:
glfwTerminate();
break;
}
if (gEngine->GetPlatformInfo().IsConsoleWindowCreated() == true)
{
const auto flag = gEngine->GetPlatformInfo().RemoveConsoleWindow();
MDY_ASSERT(flag == true);
}
}
inline bool MWindow::Impl::IsWindowShouldClose() const noexcept
{
return glfwWindowShouldClose(this->mGlfwWindow);
}
inline EDySuccess MWindow::Impl::MDY_PRIVATE(TerminateWindow)() noexcept
{
glfwSetWindowShouldClose(this->GetGLMainWindow(), GLFW_TRUE);
return EDySuccess::DY_SUCCESS;
}
inline GLFWwindow* MWindow::Impl::GetGLMainWindow() const noexcept
{
MDY_ASSERT_MSG(MDY_CHECK_ISNOTNULL(this->mGlfwWindow), "GlfwWindow is not initiailized.");
return this->mGlfwWindow;
}
inline const std::array<GLFWwindow*, 2>& MWindow::Impl::GetGLWorkerWindowList() const noexcept
{
#if defined (NDEBUG) == false
for (const auto& ptrWindow : this->mGlfwWorkerWnds)
{ // Validation check.
MaybeNotUsed(ptrWindow);
MDY_ASSERT_MSG(MDY_CHECK_ISNOTNULL(ptrWindow), "GLFWwindow must be valid.");
}
#endif
return this->mGlfwWorkerWnds;
}
} /// ::dy namespace
#endif /// GUARD_DY_MANAGEMENT_WINDOWMANAGER_IMPL_INL | 35.814815 | 121 | 0.715615 | liliilli |
f7f5e739d6d881d28940dd7fe11e1b1508d19b4a | 749 | cpp | C++ | Sources/LibRT/source/RTBufferDescriptor.cpp | Rominitch/MouCaLab | d8c24de479b1bc11509df8456e0071d394fbeab9 | [
"Unlicense"
] | null | null | null | Sources/LibRT/source/RTBufferDescriptor.cpp | Rominitch/MouCaLab | d8c24de479b1bc11509df8456e0071d394fbeab9 | [
"Unlicense"
] | null | null | null | Sources/LibRT/source/RTBufferDescriptor.cpp | Rominitch/MouCaLab | d8c24de479b1bc11509df8456e0071d394fbeab9 | [
"Unlicense"
] | null | null | null | /// https://github.com/Rominitch/MouCaLab
/// \author Rominitch
/// \license No license
#include "Dependencies.h"
#include <LibRT/include/RTBufferDescriptor.h>
namespace RT
{
ComponentDescriptor::ComponentDescriptor(const uint64_t nbComponents, const Type formatType, const ComponentUsage componentUsage, const bool bNormalized) :
_formatType(formatType), _nbComponents(nbComponents), _sizeInByte(0), _componentUsage(componentUsage), _isNormalized(bNormalized)
{
//Check error
MOUCA_PRE_CONDITION(nbComponents > 0);
MOUCA_PRE_CONDITION(formatType < Type::NbTypes);
MOUCA_PRE_CONDITION(componentUsage < ComponentUsage::NbUsages);
//Compute Size of descriptor
_sizeInByte = computeSizeOf(_formatType) * _nbComponents;
}
} | 32.565217 | 155 | 0.781041 | Rominitch |
f7f811321f9e8fc5459641b58262b596b9d77852 | 2,524 | cpp | C++ | application/game.cpp | YoeyT/IPASS-SSD1351-Tron | 9f01b8ac84fe3304bcc711dd43e3211b178bb9c0 | [
"BSL-1.0"
] | null | null | null | application/game.cpp | YoeyT/IPASS-SSD1351-Tron | 9f01b8ac84fe3304bcc711dd43e3211b178bb9c0 | [
"BSL-1.0"
] | null | null | null | application/game.cpp | YoeyT/IPASS-SSD1351-Tron | 9f01b8ac84fe3304bcc711dd43e3211b178bb9c0 | [
"BSL-1.0"
] | null | null | null | #include "game.hpp"
void StartGame(SSD1351& screen, hwlib::pin_in& upKey, hwlib::pin_in& downKey, hwlib::pin_in& leftKey, hwlib::pin_in& rightKey)
{
//setup
screen.Init();
screen.FillScreen(0);
//player
bike player(12, 12, color(0, 0xFF, 0xFF));
player.Draw(screen);
//AI
AIBike AI(111, 111, color(0xF8, 0x00, 0x00));
AI.Draw(screen);
//Borders
wall borderLeft(0, 0, 2, 127, 0x001F);
wall borderDown(0, 125, 127, 127, 0x001F);
wall borderUp(0, 0, 127, 2, 0x001F);
wall borderRight(125, 0, 127, 127, 0x001F);
borderLeft.Draw(screen);
borderDown.Draw(screen);
borderUp.Draw(screen);
borderRight.Draw(screen);
const std::array<wall , 4> borderWalls = {borderLeft, borderDown, borderUp, borderRight};
bool gameQuit = false;
uint16_t colorWon;
//gameloop, this runs every "frame"
while(!gameQuit)
{
//read player inputs and move accordingly
player.ReadAndMove(!upKey.read(), !downKey.read(), !leftKey.read(), !rightKey.read());
player.Draw(screen);
//Make a decision and move accordingly
AI.MakeDecision(player, borderWalls);
AI.Draw(screen);
//check for collisions
if(CheckCollisions(AI, player, borderWalls))
{
gameQuit = true;
colorWon = 0x07FF;
}
else if(CheckCollisions(player, AI, borderWalls))
{
gameQuit = true;
colorWon = 0xF800;
}
//limit frames per second, otherwise the game is too fast
hwlib::wait_ms(50);
}
screen.FillScreen(colorWon);
}
bool CheckCollisions(const bike& player, const bike& otherPlayer, const std::array<wall, 4>& borderWalls)
{
//check for wall collision
for(wall wallObject : borderWalls)
{
if(Collision(player, wallObject))
{
return true;
}
}
//check bike trail collisions
for(uint8_t trail = 0; trail < (player.GetBikeTrailIterator() - 1); trail++)
{
if(Collision(player, player.GetBikeTrail()[trail]))
{
return true;
}
}
//check other player bike trail collisions
for(uint8_t trail = 0; trail < (otherPlayer.GetBikeTrailIterator() - 1); trail++)
{
if(Collision(player, otherPlayer.GetBikeTrail()[trail]))
{
return true;
}
}
//check bike to bike collision
if(Collision(player, otherPlayer))
{
return true;
}
return false;
} | 26.020619 | 126 | 0.596276 | YoeyT |
f7fab0ab8126e6982361b4bbd2a0ea4f501bb302 | 5,085 | cpp | C++ | tests/lexy/dsl/capture.cpp | netcan/lexy | 775e3d6bf1169ce13b08598d774e707c253f0792 | [
"BSL-1.0"
] | null | null | null | tests/lexy/dsl/capture.cpp | netcan/lexy | 775e3d6bf1169ce13b08598d774e707c253f0792 | [
"BSL-1.0"
] | null | null | null | tests/lexy/dsl/capture.cpp | netcan/lexy | 775e3d6bf1169ce13b08598d774e707c253f0792 | [
"BSL-1.0"
] | null | null | null | // Copyright (C) 2020 Jonathan Müller <[email protected]>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#include <lexy/dsl/capture.hpp>
#include "verify.hpp"
#include <lexy/callback.hpp>
#include <lexy/dsl/label.hpp>
#include <lexy/dsl/sequence.hpp>
TEST_CASE("dsl::capture()")
{
SUBCASE("basic")
{
constexpr auto rule = capture(LEXY_LIT("abc"));
CHECK(lexy::is_rule<decltype(rule)>);
CHECK(!lexy::is_pattern<decltype(rule)>);
struct callback
{
const char* str;
constexpr int success(const char* cur, lexy::lexeme_for<test_input> lex)
{
CONSTEXPR_CHECK(lex.begin() == str);
CONSTEXPR_CHECK(lex.end() == cur);
return 0;
}
constexpr int error(test_error<lexy::expected_literal> e)
{
CONSTEXPR_CHECK(e.string() == "abc");
return -1;
}
};
constexpr auto empty = rule_matches<callback>(rule, "");
CHECK(empty == -1);
constexpr auto success = rule_matches<callback>(rule, "abc");
CHECK(success == 0);
}
SUBCASE("capture label")
{
constexpr auto rule = capture(lexy::dsl::label<struct lab>);
CHECK(lexy::is_rule<decltype(rule)>);
CHECK(!lexy::is_pattern<decltype(rule)>);
struct callback
{
const char* str;
constexpr int success(const char* cur, lexy::lexeme_for<test_input> lex,
lexy::label<lab>)
{
CONSTEXPR_CHECK(str == cur);
CONSTEXPR_CHECK(lex.empty());
return 0;
}
};
constexpr auto empty = rule_matches<callback>(rule, "");
CHECK(empty == 0);
constexpr auto string = rule_matches<callback>(rule, "abc");
CHECK(string == 0);
}
SUBCASE("directly nested")
{
constexpr auto rule = capture(capture(LEXY_LIT("abc")));
CHECK(lexy::is_rule<decltype(rule)>);
CHECK(!lexy::is_pattern<decltype(rule)>);
struct callback
{
const char* str;
constexpr int success(const char*, lexy::lexeme_for<test_input> outer,
lexy::lexeme_for<test_input> inner)
{
CONSTEXPR_CHECK(lexy::as_string<lexy::_detail::string_view>(outer) == "abc");
CONSTEXPR_CHECK(lexy::as_string<lexy::_detail::string_view>(inner) == "abc");
return 0;
}
constexpr int error(test_error<lexy::expected_literal> e)
{
CONSTEXPR_CHECK(e.string() == "abc");
return -1;
}
};
constexpr auto empty = rule_matches<callback>(rule, "");
CHECK(empty == -1);
constexpr auto success = rule_matches<callback>(rule, "abc");
CHECK(success == 0);
}
SUBCASE("indirectly nested")
{
constexpr auto rule = capture(LEXY_LIT("(") + capture(LEXY_LIT("abc")) + LEXY_LIT(")"));
CHECK(lexy::is_rule<decltype(rule)>);
struct callback
{
const char* str;
constexpr int success(const char*, lexy::lexeme_for<test_input> outer,
lexy::lexeme_for<test_input> inner)
{
CONSTEXPR_CHECK(lexy::as_string<lexy::_detail::string_view>(outer) == "(abc)");
CONSTEXPR_CHECK(lexy::as_string<lexy::_detail::string_view>(inner) == "abc");
return 0;
}
constexpr int error(test_error<lexy::expected_literal>)
{
return -1;
}
};
constexpr auto empty = rule_matches<callback>(rule, "");
CHECK(empty == -1);
constexpr auto success = rule_matches<callback>(rule, "(abc)");
CHECK(success == 0);
}
SUBCASE("whitespace")
{
constexpr auto rule = capture(LEXY_LIT("abc"))[LEXY_LIT(" ")];
CHECK(lexy::is_rule<decltype(rule)>);
CHECK(!lexy::is_pattern<decltype(rule)>);
struct callback
{
const char* str;
constexpr int success(const char* cur, lexy::lexeme_for<test_input> lex)
{
CONSTEXPR_CHECK(lex.end() == cur);
CONSTEXPR_CHECK(lexy::_detail::string_view(lex.data(), lex.size()) == "abc");
return 0;
}
constexpr int error(test_error<lexy::expected_literal> e)
{
CONSTEXPR_CHECK(e.string() == "abc");
return -1;
}
};
constexpr auto empty = rule_matches<callback>(rule, "");
CHECK(empty == -1);
constexpr auto success = rule_matches<callback>(rule, "abc");
CHECK(success == 0);
constexpr auto with_space = rule_matches<callback>(rule, " abc");
CHECK(with_space == 0);
}
}
| 31.006098 | 96 | 0.532153 | netcan |
7901240c1580bfaa28c775b4e754cdbd074a422a | 270 | cpp | C++ | frontend/typing/types/meta.cpp | NicolaiLS/becarre | cf23e80041f856f50b9f96c087819780dfe1792c | [
"MIT"
] | null | null | null | frontend/typing/types/meta.cpp | NicolaiLS/becarre | cf23e80041f856f50b9f96c087819780dfe1792c | [
"MIT"
] | null | null | null | frontend/typing/types/meta.cpp | NicolaiLS/becarre | cf23e80041f856f50b9f96c087819780dfe1792c | [
"MIT"
] | null | null | null | #include <becarre/frontend/typing/types/meta.hpp>
#include <becarre/frontend/typing/types.hpp>
namespace becarre::frontend::typing::types
{
Type meta(Type const & value) noexcept
{
return Type(types::Meta{value});
}
} // namespace becarre::frontend::typing::types
| 19.285714 | 49 | 0.740741 | NicolaiLS |
7903fcb0a505e1afe2adbec3030a92f354b3c8dd | 36,384 | cpp | C++ | plugins/Rembed/Rembed.cpp | oxhead/HPCC-Platform | 62e092695542a9bbea1bb3672f0d1ff572666cfc | [
"Apache-2.0"
] | null | null | null | plugins/Rembed/Rembed.cpp | oxhead/HPCC-Platform | 62e092695542a9bbea1bb3672f0d1ff572666cfc | [
"Apache-2.0"
] | null | null | null | plugins/Rembed/Rembed.cpp | oxhead/HPCC-Platform | 62e092695542a9bbea1bb3672f0d1ff572666cfc | [
"Apache-2.0"
] | null | null | null | /*##############################################################################
HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
Licensed under the GPL, Version 2.0 or later
you may not use this file except in compliance with the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
############################################################################## */
#include "platform.h"
#ifdef RCPP_HEADER_ONLY
// NOTE - these symbols need to be hidden from being exported from the Rembed .so file as RInside tries to dynamically
// load them from Rcpp.so
// If future versions of Rcpp add any (in Rcpp/routines.h) they may need to be added here too.
#define type2name HIDE_RCPP_type2name
#define enterRNGScope HIDE_RCPP_enterRNGScope
#define exitRNGScope HIDE_RCPP_exitRNGScope
#define get_string_buffer HIDE_RCPP_get_string_buffer
#define get_Rcpp_namespace HIDE_RCPP_get_Rcpp_namespace
#define mktime00 HIDE_RCPP_mktime00_
#define gmtime_ HIDE_RCPP_gmtime_
#define rcpp_get_stack_trace HIDE_RCPP_rcpp_get_stack_trace
#define rcpp_set_stack_trace HIDE_RCPP_rcpp_set_stack_trace
#define demangle HIDE_RCPP_demangle
#define short_file_name HIDE_RCPP_short_file_name
#define stack_trace HIDE_RCPP_stack_trace
#define get_string_elt HIDE_RCPP_get_string_elt
#define char_get_string_elt HIDE_RCPP_char_get_string_elt
#define set_string_elt HIDE_RCPP_set_string_elt
#define char_set_string_elt HIDE_RCPP_char_set_string_elt
#define get_string_ptr HIDE_RCPP_get_string_ptr
#define get_vector_elt HIDE_RCPP_get_vector_elt
#define set_vector_elt HIDE_RCPP_set_vector_elt
#define get_vector_ptr HIDE_RCPP_get_vector_ptr
#define char_nocheck HIDE_RCPP_char_nocheck
#define dataptr HIDE_RCPP_dataptr
#define getCurrentScope HIDE_RCPP_getCurrentScope
#define setCurrentScope HIDE_RCPP_setCurrentScope
#define get_cache HIDE_RCPP_get_cache
#define reset_current_error HIDE_RCPP_reset_current_error
#define error_occured HIDE_RCPP_error_occured
#define rcpp_get_current_error HIDE_RCPP_rcpp_get_current_error
#endif
#include "RInside.h"
#include "Rinterface.h"
#include "jexcept.hpp"
#include "jthread.hpp"
#include "hqlplugins.hpp"
#include "deftype.hpp"
#include "eclrtl.hpp"
#include "eclrtl_imp.hpp"
#include "rtlds_imp.hpp"
#include "rtlfield_imp.hpp"
#include "nbcd.hpp"
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
static const char * compatibleVersions[] =
{ "R Embed Helper 1.0.0", NULL };
static const char *version = "R Embed Helper 1.0.0";
extern "C" EXPORT bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb)
{
if (pb->size == sizeof(ECLPluginDefinitionBlockEx))
{
ECLPluginDefinitionBlockEx * pbx = (ECLPluginDefinitionBlockEx *) pb;
pbx->compatibleVersions = compatibleVersions;
}
else if (pb->size != sizeof(ECLPluginDefinitionBlock))
return false;
pb->magicVersion = PLUGIN_VERSION;
pb->version = version;
pb->moduleName = "+R+"; // Hack - we don't want to export any ECL, but if we don't export something,
pb->ECL = ""; // Hack - the dll is unloaded at startup when compiling, and the R runtime closes stdin when unloaded
pb->flags = PLUGIN_MULTIPLE_VERSIONS;
pb->description = "R Embed Helper";
return true;
}
#ifdef _WIN32
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#endif
#define UNSUPPORTED(feature) throw MakeStringException(MSGAUD_user, 0, "Rembed: UNSUPPORTED feature: %s", feature)
#define FAIL(msg) throw MakeStringException(MSGAUD_user, 0, "Rembed: Rcpp error: %s", msg)
namespace Rembed
{
class OwnedRoxieRowSet : public ConstPointerArray
{
public:
~OwnedRoxieRowSet()
{
ForEachItemIn(idx, *this)
rtlReleaseRow(item(idx));
}
};
// Use a global object to ensure that the R instance is initialized only once
// Because of R's dodgy stack checks, we also have to do so on main thread
static class RGlobalState
{
public:
RGlobalState()
{
const char *args[] = {"R", "--slave" };
R = new RInside(2, args, true, false, true); // Setting interactive mode=true prevents R syntax errors from terminating the process
// The R code for checking stack limits assumes that all calls are on the same thread
// as the original context was created on - this will not always be true in ECL (and hardly
// ever true in Roxie
// Setting the stack limit to -1 disables this check
R_CStackLimit = -1;
// Make sure we are never unloaded (as R does not support it)
// we do this by doing a dynamic load of the Rembed library
#ifdef _WIN32
char path[_MAX_PATH];
::GetModuleFileName((HINSTANCE)&__ImageBase, path, _MAX_PATH);
if (strstr(path, "Rembed"))
{
HINSTANCE h = LoadSharedObject(path, false, false);
DBGLOG("LoadSharedObject returned %p", h);
}
#else
FILE *diskfp = fopen("/proc/self/maps", "r");
if (diskfp)
{
char ln[_MAX_PATH];
while (fgets(ln, sizeof(ln), diskfp))
{
if (strstr(ln, "libRembed"))
{
const char *fullName = strchr(ln, '/');
if (fullName)
{
char *tail = (char *) strstr(fullName, SharedObjectExtension);
if (tail)
{
tail[strlen(SharedObjectExtension)] = 0;
HINSTANCE h = LoadSharedObject(fullName, false, false);
break;
}
}
}
}
fclose(diskfp);
}
#endif
}
~RGlobalState()
{
delete R;
}
RInside *R;
}* globalState = NULL;
static CriticalSection RCrit; // R is single threaded - need to own this before making any call to R
static RGlobalState *queryGlobalState()
{
CriticalBlock b(RCrit);
if (!globalState)
globalState = new RGlobalState;
return globalState;
}
extern void unload()
{
CriticalBlock b(RCrit);
if (globalState)
delete globalState;
globalState = NULL;
}
MODULE_INIT(INIT_PRIORITY_STANDARD)
{
queryGlobalState(); // make sure gets loaded by main thread
return true;
}
MODULE_EXIT()
{
// Don't unload, because R seems to have problems with being reloaded, i.e. crashes on next use
// unload();
}
// A RDataFrameHeaderBuilder object is used to construct the header for an R dataFrame from an ECL row
class RDataFrameHeaderBuilder : public CInterfaceOf<IFieldProcessor>
{
public:
RDataFrameHeaderBuilder()
{
}
virtual void processString(unsigned len, const char *value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processBool(bool value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processData(unsigned len, const void *value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processInt(__int64 value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processUInt(unsigned __int64 value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processReal(double value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processUDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processUnicode(unsigned len, const UChar *value, const RtlFieldInfo * field)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual void processQString(unsigned len, const char *value, const RtlFieldInfo * field)
{
addField(field);
}
virtual void processSetAll(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processUtf8(unsigned len, const char *value, const RtlFieldInfo * field)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual bool processBeginSet(const RtlFieldInfo * field, unsigned elements, bool isAll, const byte *data)
{
UNSUPPORTED("SET fields");
}
virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned rows)
{
UNSUPPORTED("Nested datasets");
}
virtual bool processBeginRow(const RtlFieldInfo * field)
{
return true;
}
virtual void processEndSet(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processEndDataset(const RtlFieldInfo * field)
{
UNSUPPORTED("Nested datasets");
}
virtual void processEndRow(const RtlFieldInfo * field)
{
}
Rcpp::CharacterVector namevec;
protected:
void addField(const RtlFieldInfo * field)
{
namevec.push_back(field->name->queryStr());
}
};
// A RDataFrameHeaderBuilder object is used to construct the header for an R dataFrame from an ECL row
class RDataFrameAppender : public CInterfaceOf<IFieldProcessor>
{
public:
RDataFrameAppender(Rcpp::List &_list) : list(_list)
{
colIdx = 0;
rowIdx = 0;
}
inline void setRowIdx(unsigned _idx)
{
colIdx = 0;
rowIdx = _idx;
}
virtual void processString(unsigned len, const char *value, const RtlFieldInfo * field)
{
std::string s(value, len);
Rcpp::List column = list[colIdx];
column[rowIdx] = s;
colIdx++;
}
virtual void processBool(bool value, const RtlFieldInfo * field)
{
Rcpp::List column = list[colIdx];
column[rowIdx] = value;
colIdx++;
}
virtual void processData(unsigned len, const void *value, const RtlFieldInfo * field)
{
std::vector<byte> vval;
const byte *cval = (const byte *) value;
vval.assign(cval, cval+len);
Rcpp::List column = list[colIdx];
column[rowIdx] = vval;
colIdx++;
}
virtual void processInt(__int64 value, const RtlFieldInfo * field)
{
Rcpp::List column = list[colIdx];
column[rowIdx] = (long int) value; // Rcpp does not support int64
colIdx++;
}
virtual void processUInt(unsigned __int64 value, const RtlFieldInfo * field)
{
Rcpp::List column = list[colIdx];
column[rowIdx] = (unsigned long int) value; // Rcpp does not support int64
colIdx++;
}
virtual void processReal(double value, const RtlFieldInfo * field)
{
Rcpp::List column = list[colIdx];
column[rowIdx] = value;
colIdx++;
}
virtual void processDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field)
{
Decimal val;
val.setDecimal(digits, precision, value);
Rcpp::List column = list[colIdx];
column[rowIdx] = val.getReal();
colIdx++;
}
virtual void processUDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field)
{
Decimal val;
val.setUDecimal(digits, precision, value);
Rcpp::List column = list[colIdx];
column[rowIdx] = val.getReal();
colIdx++;
}
virtual void processUnicode(unsigned len, const UChar *value, const RtlFieldInfo * field)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual void processQString(unsigned len, const char *value, const RtlFieldInfo * field)
{
size32_t charCount;
rtlDataAttr text;
rtlQStrToStrX(charCount, text.refstr(), len, value);
processString(charCount, text.getstr(), field);
}
virtual void processSetAll(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processUtf8(unsigned len, const char *value, const RtlFieldInfo * field)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual bool processBeginSet(const RtlFieldInfo * field, unsigned elements, bool isAll, const byte *data)
{
UNSUPPORTED("SET fields");
}
virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned rows)
{
UNSUPPORTED("Nested datasets");
}
virtual bool processBeginRow(const RtlFieldInfo * field)
{
return true;
}
virtual void processEndSet(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processEndDataset(const RtlFieldInfo * field)
{
UNSUPPORTED("Nested datasets");
}
virtual void processEndRow(const RtlFieldInfo * field)
{
}
protected:
unsigned rowIdx;
unsigned colIdx;
Rcpp::List &list;
};
// A RRowBuilder object is used to construct an ECL row from a R dataframe and row index
class RRowBuilder : public CInterfaceOf<IFieldSource>
{
public:
RRowBuilder(Rcpp::DataFrame &_frame)
: frame(_frame)
{
rowIdx = 0;
colIdx = 0;
}
inline void setRowIdx(unsigned _rowIdx)
{
rowIdx = _rowIdx;
colIdx = 0;
}
virtual bool getBooleanResult(const RtlFieldInfo *field)
{
nextField(field);
return ::Rcpp::as<bool>(elem);
}
virtual void getDataResult(const RtlFieldInfo *field, size32_t &__len, void * &__result)
{
nextField(field);
std::vector<byte> vval = ::Rcpp::as<std::vector<byte> >(elem);
rtlStrToDataX(__len, __result, vval.size(), vval.data());
}
virtual double getRealResult(const RtlFieldInfo *field)
{
nextField(field);
return ::Rcpp::as<double>(elem);
}
virtual __int64 getSignedResult(const RtlFieldInfo *field)
{
nextField(field);
return ::Rcpp::as<long int>(elem); // Should really be long long, but RInside does not support that
}
virtual unsigned __int64 getUnsignedResult(const RtlFieldInfo *field)
{
nextField(field);
return ::Rcpp::as<unsigned long int>(elem); // Should really be long long, but RInside does not support that
}
virtual void getStringResult(const RtlFieldInfo *field, size32_t &__len, char * &__result)
{
nextField(field);
std::string str = ::Rcpp::as<std::string>(elem);
rtlStrToStrX(__len, __result, str.length(), str.data());
}
virtual void getUTF8Result(const RtlFieldInfo *field, size32_t &chars, char * &result)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual void getUnicodeResult(const RtlFieldInfo *field, size32_t &chars, UChar * &result)
{
UNSUPPORTED("Unicode/UTF8 fields");
}
virtual void getDecimalResult(const RtlFieldInfo *field, Decimal &value)
{
nextField(field);
double ret = ::Rcpp::as<double>(elem);
value.setReal(ret);
}
virtual void processBeginSet(const RtlFieldInfo * field, bool &isAll)
{
UNSUPPORTED("SET fields");
}
virtual bool processNextSet(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processBeginDataset(const RtlFieldInfo * field)
{
UNSUPPORTED("Nested datasets");
}
virtual void processBeginRow(const RtlFieldInfo * field)
{
}
virtual bool processNextRow(const RtlFieldInfo * field)
{
UNSUPPORTED("Nested datasets");
}
virtual void processEndSet(const RtlFieldInfo * field)
{
UNSUPPORTED("SET fields");
}
virtual void processEndDataset(const RtlFieldInfo * field)
{
UNSUPPORTED("Nested datasets");
}
virtual void processEndRow(const RtlFieldInfo * field)
{
}
protected:
void nextField(const RtlFieldInfo * field)
{
// NOTE - we could put support for looking up columns by name here, but for efficiency reasons we only support matching by position
Rcpp::RObject colObject = frame[colIdx];
Rcpp::List column = ::Rcpp::as<Rcpp::List>(colObject); // MORE - this can crash if wrong type came from R. But I can't work out how to test that
Rcpp::RObject t = column[rowIdx];
elem = t;
colIdx++;
}
Rcpp::DataFrame frame;
unsigned rowIdx;
unsigned colIdx;
Rcpp::RObject elem;
};
static size32_t getRowResult(RInside::Proxy &result, ARowBuilder &builder)
{
// To return a single row, we expect a dataframe (with 1 row)...
Rcpp::DataFrame dFrame = ::Rcpp::as<Rcpp::DataFrame>(result); // Note that this will also accept (and convert) a list
RRowBuilder myRRowBuilder(dFrame);
const RtlTypeInfo *typeInfo = builder.queryAllocator()->queryOutputMeta()->queryTypeInfo();
assertex(typeInfo);
RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
return typeInfo->build(builder, 0, &dummyField, myRRowBuilder);
}
// A R function that returns a dataset will return a RRowStream object that can be
// interrogated to return each row of the result in turn
class RRowStream : public CInterfaceOf<IRowStream>
{
public:
RRowStream(RInside::Proxy &_result, IEngineRowAllocator *_resultAllocator)
: dFrame(::Rcpp::as<Rcpp::DataFrame>(_result)),
myRRowBuilder(dFrame)
{
resultAllocator.set(_resultAllocator);
// A DataFrame is a list of columns
// Each column is a vector (and all columns should be the same length)
unsigned numColumns = dFrame.length();
assertex(numColumns > 0);
Rcpp::List col1 = dFrame[0];
numRows = col1.length();
idx = 0;
}
virtual const void *nextRow()
{
CriticalBlock b(RCrit);
if (!resultAllocator)
return NULL;
if (idx >= numRows)
{
stop();
return NULL;
}
RtlDynamicRowBuilder builder(resultAllocator);
const RtlTypeInfo *typeInfo = builder.queryAllocator()->queryOutputMeta()->queryTypeInfo();
assertex(typeInfo);
RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
myRRowBuilder.setRowIdx(idx);
try
{
size32_t len = typeInfo->build(builder, 0, &dummyField, myRRowBuilder);
idx++;
return builder.finalizeRowClear(len);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual void stop()
{
resultAllocator.clear();
}
protected:
Rcpp::DataFrame dFrame;
Linked<IEngineRowAllocator> resultAllocator;
RRowBuilder myRRowBuilder;
unsigned numRows;
unsigned idx;
};
// Each call to a R function will use a new REmbedFunctionContext object
// This takes care of ensuring that the critsec is locked while we are executing R code,
// and released when we are not
class REmbedFunctionContext: public CInterfaceOf<IEmbedFunctionContext>
{
public:
REmbedFunctionContext(RInside &_R, const char *options)
: R(_R), block(RCrit), result(R_NilValue)
{
}
~REmbedFunctionContext()
{
}
virtual IInterface *bindParamWriter(IInterface *esdl, const char *esdlservice, const char *esdltype, const char *name)
{
return NULL;
}
virtual void paramWriterCommit(IInterface *writer)
{
}
virtual void writeResult(IInterface *esdl, const char *esdlservice, const char *esdltype, IInterface *writer)
{
}
virtual bool getBooleanResult()
{
try
{
return ::Rcpp::as<bool>(result);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual void getDataResult(size32_t &__len, void * &__result)
{
try
{
std::vector<byte> vval = ::Rcpp::as<std::vector<byte> >(result);
rtlStrToDataX(__len, __result, vval.size(), vval.data());
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual double getRealResult()
{
try
{
return ::Rcpp::as<double>(result);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual __int64 getSignedResult()
{
try
{
return ::Rcpp::as<long int>(result); // Should really be long long, but RInside does not support that
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual unsigned __int64 getUnsignedResult()
{
try
{
return ::Rcpp::as<unsigned long int>(result); // Should really be long long, but RInside does not support that
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual void getStringResult(size32_t &__len, char * &__result)
{
try
{
std::string str = ::Rcpp::as<std::string>(result);
rtlStrToStrX(__len, __result, str.length(), str.data());
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual void getUTF8Result(size32_t &chars, char * &result)
{
UNSUPPORTED("Unicode/UTF8 results");
}
virtual void getUnicodeResult(size32_t &chars, UChar * &result)
{
UNSUPPORTED("Unicode/UTF8 results");
}
virtual void getSetResult(bool & __isAllResult, size32_t & __resultBytes, void * & __result, int _elemType, size32_t elemSize)
{
try
{
type_t elemType = (type_t) _elemType;
__isAllResult = false;
switch(elemType)
{
#define FETCH_ARRAY(type) \
{ \
std::vector<type> vval = ::Rcpp::as< std::vector<type> >(result); \
rtlStrToDataX(__resultBytes, __result, vval.size()*elemSize, (const void *) vval.data()); \
}
case type_boolean:
{
std::vector<bool> vval = ::Rcpp::as< std::vector<bool> >(result);
size32_t size = vval.size();
// Vector of bool is odd, and can't be retrieved via data()
// Instead we need to iterate, I guess
rtlDataAttr out(size);
bool *outData = (bool *) out.getdata();
for (std::vector<bool>::iterator iter = vval.begin(); iter < vval.end(); iter++)
{
*outData++ = *iter;
}
__resultBytes = size;
__result = out.detachdata();
break;
}
case type_int:
/* if (elemSize == sizeof(signed char)) // rcpp does not seem to support...
FETCH_ARRAY(signed char)
else */ if (elemSize == sizeof(short))
FETCH_ARRAY(short)
else if (elemSize == sizeof(int))
FETCH_ARRAY(int)
else if (elemSize == sizeof(long)) // __int64 / long long does not work...
FETCH_ARRAY(long)
else
rtlFail(0, "Rembed: Unsupported result type");
break;
case type_unsigned:
if (elemSize == sizeof(byte))
FETCH_ARRAY(byte)
else if (elemSize == sizeof(unsigned short))
FETCH_ARRAY(unsigned short)
else if (elemSize == sizeof(unsigned int))
FETCH_ARRAY(unsigned int)
else if (elemSize == sizeof(unsigned long)) // __int64 / long long does not work...
FETCH_ARRAY(unsigned long)
else
rtlFail(0, "Rembed: Unsupported result type");
break;
case type_real:
if (elemSize == sizeof(float))
FETCH_ARRAY(float)
else if (elemSize == sizeof(double))
FETCH_ARRAY(double)
else
rtlFail(0, "Rembed: Unsupported result type");
break;
case type_string:
case type_varstring:
{
std::vector<std::string> vval = ::Rcpp::as< std::vector<std::string> >(result);
size32_t numResults = vval.size();
rtlRowBuilder out;
byte *outData = NULL;
size32_t outBytes = 0;
if (elemSize != UNKNOWN_LENGTH)
{
outBytes = numResults * elemSize; // MORE - check for overflow?
out.ensureAvailable(outBytes);
outData = out.getbytes();
}
for (std::vector<std::string>::iterator iter = vval.begin(); iter < vval.end(); iter++)
{
size32_t lenBytes = (*iter).size();
const char *text = (*iter).data();
if (elemType == type_string)
{
if (elemSize == UNKNOWN_LENGTH)
{
out.ensureAvailable(outBytes + lenBytes + sizeof(size32_t));
outData = out.getbytes() + outBytes;
* (size32_t *) outData = lenBytes;
rtlStrToStr(lenBytes, outData+sizeof(size32_t), lenBytes, text);
outBytes += lenBytes + sizeof(size32_t);
}
else
{
rtlStrToStr(elemSize, outData, lenBytes, text);
outData += elemSize;
}
}
else
{
if (elemSize == UNKNOWN_LENGTH)
{
out.ensureAvailable(outBytes + lenBytes + 1);
outData = out.getbytes() + outBytes;
rtlStrToVStr(0, outData, lenBytes, text);
outBytes += lenBytes + 1;
}
else
{
rtlStrToVStr(elemSize, outData, lenBytes, text); // Fixed size null terminated strings... weird.
outData += elemSize;
}
}
}
__resultBytes = outBytes;
__result = out.detachdata();
break;
}
default:
rtlFail(0, "REmbed: Unsupported result type");
break;
}
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual IRowStream *getDatasetResult(IEngineRowAllocator * _resultAllocator)
{
try
{
return new RRowStream(result, _resultAllocator);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual byte * getRowResult(IEngineRowAllocator * _resultAllocator)
{
try
{
RtlDynamicRowBuilder rowBuilder(_resultAllocator);
size32_t len = Rembed::getRowResult(result, rowBuilder);
return (byte *) rowBuilder.finalizeRowClear(len);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual size32_t getTransformResult(ARowBuilder & builder)
{
try
{
return Rembed::getRowResult(result, builder);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
virtual void bindBooleanParam(const char *name, bool val)
{
R[name] = val;
}
virtual void bindDataParam(const char *name, size32_t len, const void *val)
{
std::vector<byte> vval;
const byte *cval = (const byte *) val;
vval.assign(cval, cval+len);
R[name] = vval;
}
virtual void bindFloatParam(const char *name, float val)
{
R[name] = val;
}
virtual void bindRealParam(const char *name, double val)
{
R[name] = val;
}
virtual void bindSignedSizeParam(const char *name, int size, __int64 val)
{
R[name] = (long int) val;
}
virtual void bindSignedParam(const char *name, __int64 val)
{
R[name] = (long int) val;
}
virtual void bindUnsignedSizeParam(const char *name, int size, unsigned __int64 val)
{
R[name] = (long int) val;
}
virtual void bindUnsignedParam(const char *name, unsigned __int64 val)
{
R[name] = (unsigned long int) val;
}
virtual void bindStringParam(const char *name, size32_t len, const char *val)
{
std::string s(val, len);
R[name] = s;
}
virtual void bindVStringParam(const char *name, const char *val)
{
R[name] = val;
}
virtual void bindUTF8Param(const char *name, size32_t chars, const char *val)
{
rtlFail(0, "Rembed: Unsupported parameter type UTF8");
}
virtual void bindUnicodeParam(const char *name, size32_t chars, const UChar *val)
{
rtlFail(0, "Rembed: Unsupported parameter type UNICODE");
}
virtual void bindSetParam(const char *name, int _elemType, size32_t elemSize, bool isAll, size32_t totalBytes, void *setData)
{
if (isAll)
rtlFail(0, "Rembed: Unsupported parameter type ALL");
type_t elemType = (type_t) _elemType;
int numElems = totalBytes / elemSize;
switch(elemType)
{
#define BIND_ARRAY(type) \
{ \
std::vector<type> vval; \
const type *start = (const type *) setData; \
vval.assign(start, start+numElems); \
R[name] = vval; \
}
case type_boolean:
BIND_ARRAY(bool)
break;
case type_int:
/* if (elemSize == sizeof(signed char)) // No binding exists in rcpp
BIND_ARRAY(signed char)
else */ if (elemSize == sizeof(short))
BIND_ARRAY(short)
else if (elemSize == sizeof(int))
BIND_ARRAY(int)
else if (elemSize == sizeof(long)) // __int64 / long long does not work...
BIND_ARRAY(long)
else
rtlFail(0, "Rembed: Unsupported parameter type");
break;
case type_unsigned:
if (elemSize == sizeof(unsigned char))
BIND_ARRAY(unsigned char)
else if (elemSize == sizeof(unsigned short))
BIND_ARRAY(unsigned short)
else if (elemSize == sizeof(unsigned int))
BIND_ARRAY(unsigned int)
else if (elemSize == sizeof(unsigned long)) // __int64 / long long does not work...
BIND_ARRAY(unsigned long)
else
rtlFail(0, "Rembed: Unsupported parameter type");
break;
case type_real:
if (elemSize == sizeof(float))
BIND_ARRAY(float)
else if (elemSize == sizeof(double))
BIND_ARRAY(double)
else
rtlFail(0, "Rembed: Unsupported parameter type");
break;
case type_string:
case type_varstring:
{
std::vector<std::string> vval;
const byte *inData = (const byte *) setData;
const byte *endData = inData + totalBytes;
while (inData < endData)
{
int thisSize;
if (elemSize == UNKNOWN_LENGTH)
{
if (elemType==type_varstring)
thisSize = strlen((const char *) inData) + 1;
else
{
thisSize = * (size32_t *) inData;
inData += sizeof(size32_t);
}
}
else
thisSize = elemSize;
std::string s((const char *) inData, thisSize);
vval.push_back(s);
inData += thisSize;
numElems++;
}
R[name] = vval;
break;
}
default:
rtlFail(0, "REmbed: Unsupported parameter type");
break;
}
}
virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *row)
{
// We create a single-row dataframe
const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();
assertex(typeInfo);
RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
RDataFrameHeaderBuilder headerBuilder;
typeInfo->process(row, row, &dummyField, headerBuilder); // Sets up the R dataframe from the first ECL row
Rcpp::List myList(headerBuilder.namevec.length());
myList.attr("names") = headerBuilder.namevec;
for (int i=0; i<myList.length(); i++)
{
Rcpp::List column(1);
myList[i] = column;
}
RDataFrameAppender frameBuilder(myList);
Rcpp::StringVector row_names(1);
frameBuilder.setRowIdx(0);
typeInfo->process(row, row, &dummyField, frameBuilder);
row_names(0) = "1";
myList.attr("class") = "data.frame";
myList.attr("row.names") = row_names;
R[name] = myList;
}
virtual void bindDatasetParam(const char *name, IOutputMetaData & metaVal, IRowStream * val)
{
const RtlTypeInfo *typeInfo = metaVal.queryTypeInfo();
assertex(typeInfo);
RtlFieldStrInfo dummyField("<row>", NULL, typeInfo);
OwnedRoxieRowSet rows;
loop
{
const byte *row = (const byte *) val->ungroupedNextRow();
if (!row)
break;
rows.append(row);
}
const byte *firstrow = (const byte *) rows.item(0);
RDataFrameHeaderBuilder headerBuilder;
typeInfo->process(firstrow, firstrow, &dummyField, headerBuilder); // Sets up the R dataframe from the first ECL row
Rcpp::List myList(headerBuilder.namevec.length());
myList.attr("names") = headerBuilder.namevec;
for (int i=0; i<myList.length(); i++)
{
Rcpp::List column(rows.length());
myList[i] = column;
}
RDataFrameAppender frameBuilder(myList);
Rcpp::StringVector row_names(rows.length());
ForEachItemIn(idx, rows)
{
const byte * row = (const byte *) rows.item(idx);
frameBuilder.setRowIdx(idx);
typeInfo->process(row, row, &dummyField, frameBuilder);
StringBuffer rowname;
rowname.append(idx+1);
row_names(idx) = rowname.str();
}
myList.attr("class") = "data.frame";
myList.attr("row.names") = row_names;
R[name] = myList;
}
virtual void importFunction(size32_t lenChars, const char *utf)
{
throwUnexpected();
}
virtual void compileEmbeddedScript(size32_t lenChars, const char *utf)
{
StringBuffer text(rtlUtf8Size(lenChars, utf), utf);
text.stripChar('\r');
func.assign(text.str());
}
virtual void callFunction()
{
try
{
result = R.parseEval(func);
}
catch (std::exception &E)
{
FAIL(E.what());
}
}
private:
RInside &R;
RInside::Proxy result;
std::string func;
CriticalBlock block;
};
class REmbedContext: public CInterfaceOf<IEmbedContext>
{
public:
virtual IEmbedFunctionContext *createFunctionContext(unsigned flags, const char *options)
{
return createFunctionContextEx(NULL, flags, options);
}
virtual IEmbedFunctionContext *createFunctionContextEx(ICodeContext * ctx, unsigned flags, const char *options)
{
return new REmbedFunctionContext(*queryGlobalState()->R, options);
}
virtual IEmbedServiceContext *createServiceContext(const char *service, unsigned flags, const char *options)
{
throwUnexpected();
}
};
extern IEmbedContext* getEmbedContext()
{
return new REmbedContext;
}
extern bool syntaxCheck(const char *script)
{
return true; // MORE
}
} // namespace
| 32.572963 | 152 | 0.587456 | oxhead |
790447cc78fa125da041f588d6d0229913035315 | 1,628 | cpp | C++ | leetcode.com/0710 Random Pick with Blacklist/main.cpp | sky-bro/AC | 29bfa3f13994612887e18065fa6e854b9a29633d | [
"MIT"
] | 1 | 2020-08-20T11:02:49.000Z | 2020-08-20T11:02:49.000Z | leetcode.com/0710 Random Pick with Blacklist/main.cpp | sky-bro/AC | 29bfa3f13994612887e18065fa6e854b9a29633d | [
"MIT"
] | null | null | null | leetcode.com/0710 Random Pick with Blacklist/main.cpp | sky-bro/AC | 29bfa3f13994612887e18065fa6e854b9a29633d | [
"MIT"
] | 1 | 2022-01-01T23:23:13.000Z | 2022-01-01T23:23:13.000Z | #include <iostream>
#include <vector>
#include <random>
#include <unordered_map>
using namespace std;
// ref: Java O(B) / O(1), HashMap
// https://leetcode.com/problems/random-pick-with-blacklist/discuss/144624/Java-O(B)-O(1)-HashMap
// this should be the right way to approch this problem
// I don't think other binary search solution is right...
class Solution {
private:
mt19937 prng;
uniform_int_distribution<> dis;
unordered_map<int, int> mp;
public:
Solution(int N, vector<int>& blacklist) {
// for seed (this is a rng: random number generator)
random_device rd;
// prng: pseudo random number generator
// prng will be more efficent than randome_device
prng = mt19937(rd());
int n = N - blacklist.size();
dis = uniform_int_distribution<>(0, n-1);
for (int b: blacklist) {
// these don't need remap
// but take the place: prevent others remap here
if (b >= n) mp.emplace(b, -1);
}
--N; // number picked in [0, N)
for (int b: blacklist) {
if (b < n) { // remap these
// place taken by some number in bloacklist
while (mp.count(N)) --N;
// place available
mp.emplace(b, N--);
}
}
}
int pick() {
int k = dis(prng);
auto it = mp.find(k);
return it == mp.end() ? k : it->second;
}
};
/**
* Your Solution object will be instantiated and called as such:
* Solution* obj = new Solution(N, blacklist);
* int param_1 = obj->pick();
*/
| 27.59322 | 97 | 0.562039 | sky-bro |
79071baa18a4f9615d7747c08a4ed592dbb72c5f | 132 | cpp | C++ | Modules/Nulstar/NulstarMain/NPluginManger.cpp | Berzeck/Nulstar | d3a7f59ee617e045966071d19c39d1ab63b23114 | [
"MIT"
] | 17 | 2018-08-13T23:37:31.000Z | 2019-04-25T18:31:22.000Z | Modules/Nulstar/NulstarMain/NPluginManger.cpp | Berzeck/Nulstar-v0 | d3a7f59ee617e045966071d19c39d1ab63b23114 | [
"MIT"
] | 7 | 2018-09-03T22:43:15.000Z | 2019-07-14T06:57:16.000Z | Modules/Nulstar/NulstarMain/NPluginManger.cpp | CCC-NULS/Nulstar | f48d869254f4adb60e7c95f0e313bfb44ab8dc84 | [
"MIT"
] | 7 | 2018-09-07T10:05:08.000Z | 2020-02-03T12:18:49.000Z | #include "NPluginManger.h"
NPluginManger::NPluginManger(QObject* parent)
: QObject(parent)
{
}
void NPluginManger::scan()
{
}
| 12 | 45 | 0.712121 | Berzeck |
790e3b95739046c5c4aa15e12e5f987bc2b75c5f | 1,501 | cpp | C++ | examples/NUCLEO-G070RB/ADC/Main.cpp | marangisto/HAL | fa56b539f64b277fa122a010e4ee643463f58498 | [
"MIT"
] | 2 | 2019-09-12T04:12:16.000Z | 2020-09-23T19:13:06.000Z | examples/NUCLEO-G070RB/ADC/Main.cpp | marangisto/HAL | fa56b539f64b277fa122a010e4ee643463f58498 | [
"MIT"
] | 2 | 2019-09-10T13:47:50.000Z | 2020-02-24T03:27:47.000Z | examples/NUCLEO-G070RB/ADC/Main.cpp | marangisto/HAL | fa56b539f64b277fa122a010e4ee643463f58498 | [
"MIT"
] | 3 | 2019-08-31T12:58:28.000Z | 2020-03-26T22:56:34.000Z | #include <timer.h>
#include <dac.h>
#include <adc.h>
#include <dma.h>
using hal::sys_tick;
using hal::sys_clock;
using namespace hal::gpio;
using namespace hal::timer;
using namespace hal::adc;
using namespace hal::dma;
typedef hal::timer::timer_t<3> trig;
typedef hal::dac::dac_t<1> dac;
typedef hal::dma::dma_t<1> dma;
typedef hal::adc::adc_t<1> adc;
typedef analog_t<PA0> ain0;
typedef analog_t<PA1> ain1;
typedef output_t<PA10> probe;
static const uint8_t adc_dma_ch = 2;
static const uint16_t half_buffer_size = 32;
static const uint16_t buffer_size = half_buffer_size * 2;
static uint16_t adc_buf[buffer_size];
template<> void handler<interrupt::DMA_CHANNEL2_3>()
{
uint32_t sts = dma::interrupt_status<adc_dma_ch>();
dma::clear_interrupt_flags<adc_dma_ch>();
if (sts & (dma_half_transfer | dma_transfer_complete))
probe::write(sts & dma_transfer_complete);
}
int main()
{
ain0::setup();
ain1::setup();
probe::setup();
dac::setup();
dac::enable<1>();
dac::enable<2>();
interrupt::enable();
dma::setup();
hal::nvic<interrupt::DMA_CHANNEL2_3>::enable();
trig::setup(0, 64);
trig::master_mode<trig::mm_update>();
adc::setup();
adc::sequence<1, 0>();
adc::dma<dma, adc_dma_ch, uint16_t>(adc_buf, buffer_size);
adc::trigger<0x3>();
adc::enable();
adc::start_conversion();
for (;;)
{
dac::write<1>(adc_buf[0]);
dac::write<2>(adc_buf[1]);
sys_tick::delay_ms(1);
}
}
| 22.402985 | 62 | 0.655563 | marangisto |
7912e35c058c92610901e5d8cbd7a53cc35be4be | 1,965 | cpp | C++ | engine/source/Actions/ActionParallel.cpp | MaxSigma/SGEngine | 68a01012911b8d91c9ff6d960a0f7d1163940e09 | [
"MIT"
] | 11 | 2020-10-21T15:03:41.000Z | 2020-11-03T09:15:28.000Z | engine/source/Actions/ActionParallel.cpp | MaxSigma/SGEngine | 68a01012911b8d91c9ff6d960a0f7d1163940e09 | [
"MIT"
] | null | null | null | engine/source/Actions/ActionParallel.cpp | MaxSigma/SGEngine | 68a01012911b8d91c9ff6d960a0f7d1163940e09 | [
"MIT"
] | 1 | 2020-10-27T00:13:41.000Z | 2020-10-27T00:13:41.000Z | /////////////////////////////////////////////////////
// 2016 © Max Gittel //
/////////////////////////////////////////////////////
// SGEngine
#include "ActionParallel.h"
namespace sge {
ActionParallel::ActionParallel(){
_time=0;
}
ActionParallel::~ActionParallel(){}
void ActionParallel::updateEntity(Entity* entity){
for (int i=0; i<_actions.size(); i++) {
if(_time>_actions[i]->_endTime){
if( _actions[i]->_isRunning==true){
_actions[i]->_time=_actions[i]->_endTime;
_actions[i]->end(entity);
_actions[i]->_isRunning=false;
}
}else{
_actions[i]->_time= _time;
_actions[i]->updateEntity(entity);
}
}
}
void ActionParallel::start(Entity* entity){
for (int i=0; i<_actions.size(); i++) {
_actions[i]->_isRunning=true;
_actions[i]->_time= 0;
_actions[i]->start(entity);
}
}
void ActionParallel::end(Entity* entity){
}
ActionParallel* ActionParallel::create(std::vector<Action*> actions){
ActionParallel* actionParallel= new ActionParallel();
actionParallel->_actions=actions;
for (int i=0; i<actions.size(); i++) {
actions[i]->_startTime= 0;
actions[i]->_endTime= actions[i]->_duration;
if(actionParallel->_duration<actions[i]->_duration){
actionParallel->_duration= actions[i]->_duration;
}
}
return actionParallel;
}
}
| 23.674699 | 73 | 0.410178 | MaxSigma |
79197bd50f1a481121720400a0547845e64b525d | 233 | cpp | C++ | atcoder/92B.cpp | freedomDR/coding | 310a68077de93ef445ccd2929e90ba9c22a9b8eb | [
"MIT"
] | null | null | null | atcoder/92B.cpp | freedomDR/coding | 310a68077de93ef445ccd2929e90ba9c22a9b8eb | [
"MIT"
] | null | null | null | atcoder/92B.cpp | freedomDR/coding | 310a68077de93ef445ccd2929e90ba9c22a9b8eb | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,d,x,ans;
cin>>n>>d>>x;
ans = 0;
while(n--){
int a;
cin>>a;
ans += ((d-1)/a + 1);
}
cout<<ans+x<<endl;
return 0;
}
| 12.944444 | 29 | 0.424893 | freedomDR |
791a8085867aca9e5606d061a6769ac8bb911637 | 2,066 | cpp | C++ | Tropelet.cpp | mls-m5/NoMaintenance | c54c702b658c6a3abe36ff2d175b5c923d4ca55f | [
"Apache-2.0"
] | null | null | null | Tropelet.cpp | mls-m5/NoMaintenance | c54c702b658c6a3abe36ff2d175b5c923d4ca55f | [
"Apache-2.0"
] | null | null | null | Tropelet.cpp | mls-m5/NoMaintenance | c54c702b658c6a3abe36ff2d175b5c923d4ca55f | [
"Apache-2.0"
] | null | null | null | /*
* Tropelet.cpp
*
* Created on: 6 feb 2013
* Author: mattias
*/
#include "Tropelet.h"
#include "Screen.h"
struct Position{
double X, Y;
};
Tropelet::Tropelet() {
// TODO Auto-generated constructor stub
}
Tropelet::~Tropelet() {
// TODO Auto-generated destructor stub
}
void Tropelet::Fire(double X, double Y, double XAim, double YAim, int Turn, bool isFire){
if (!isFire) { return;;}
if (MyPlayer->getItem(1) < 20 || MyPlayer->getItem(2) < 220) { return;;}
MyPlayer->setItem (1, 0);
MyPlayer->CalcItem(2, -250);
long i; Position Speed; Position Pos; long HitPlayer;
Speed.X = XAim / 10 * Turn;
Speed.Y = YAim / 10;
Pos.X = X + XAim / 3 * Turn;
Pos.Y = Y + YAim / 3;
for(i = 0; i <= 30; ++i){
Pos.X = Pos.X + Speed.X;
Pos.Y = Pos.Y + Speed.Y;
HitPlayer = FrmScreen.isPlayer((Pos.X), (Pos.Y));
if (FrmScreen.GetMap((Pos.X), (Pos.Y)) || HitPlayer) { break;}
FrmScreen.MakeSmoke(Pos.X, Pos.Y, 0, -3, 1);
}
PlaySound(dsFire4);
if (i == 31) { return;;}
Pos.X = Pos.X - Speed.X;
Pos.Y = Pos.Y - Speed.Y;
if (HitPlayer) {
MakeWarp (HitPlayer - 1);
FrmScreen.HitPlayer(HitPlayer- 1, 20);
}else{
FrmScreen.DrawCircleToMap((Pos.X), (Pos.Y), 30, mAir);
}
}
void Tropelet::MakeWarp(long Player){
long i; long X; long Y;
long MapX; long MapY;
auto PlayerToWarp = frmScreen.getPlayer(Player);
MapX = frmScreen.GetMapWidth();
MapY = frmScreen.GetMapHeight();
FrmScreen.MakeSmoke(PlayerToWarp->XPos, PlayerToWarp->YPos, -3, 0, 1);
FrmScreen.MakeSmoke(PlayerToWarp->XPos, PlayerToWarp->YPos, 3, 0, 1);
for(i = 0; i <= 1000; ++i){
X = (MapX - 20) * Rnd() + 10;
Y = (MapY - 20) * Rnd() + 10;
if (FrmScreen.GetMap(X, Y) == mAir) { break;}
}
PlayerToWarp->XPos = X;
PlayerToWarp->YPos = Y;
FrmScreen.MakeSmoke(PlayerToWarp->XPos, PlayerToWarp->YPos, -3, 0, 1);
FrmScreen.MakeSmoke(PlayerToWarp->XPos, PlayerToWarp->YPos, 3, 0, 1);
}
| 29.098592 | 89 | 0.580348 | mls-m5 |
791f9f712e7bfca11b7601af6cfffbcd9ae19c64 | 3,784 | hpp | C++ | include/navigation.hpp | maarufvazifdar/shamazon_robot | ffdbacf649dcac604e5366e9ac8ae3b519b9599d | [
"BSD-3-Clause"
] | null | null | null | include/navigation.hpp | maarufvazifdar/shamazon_robot | ffdbacf649dcac604e5366e9ac8ae3b519b9599d | [
"BSD-3-Clause"
] | 1 | 2021-12-13T21:15:09.000Z | 2021-12-13T21:15:09.000Z | include/navigation.hpp | maarufvazifdar/shamazon_robot | ffdbacf649dcac604e5366e9ac8ae3b519b9599d | [
"BSD-3-Clause"
] | 8 | 2021-11-28T00:00:03.000Z | 2021-12-13T18:59:55.000Z | /**
* BSD-3 Clause
*
* Copyright (c) 2021 Maaruf Vazifdar, Maitreya Kulkarni, Pratik Bhujnbal
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* @file navigation.hpp
* @author Maaruf Vazifdar
* @author Maitreya Kulkarni
* @author Pratik Bhujnbal
* @brief Class to hold robot's navigation related attributes and members.
* @version 1.0
* @date 11/26/2021
* @copyright Copyright (c) 2021
*
*/
#include<ros/ros.h>
#include<nav_msgs/Odometry.h>
#include<move_base_msgs/MoveBaseAction.h>
#include<actionlib/client/simple_action_client.h>
#include <tf/tf.h>
#include <vector>
#include "nav_msgs/OccupancyGrid.h"
#pragma once
/**
* @brief Class to hold robot's navigation related attributes and members.
*/
class Navigation {
public:
// ros::init(argc, argv,"shamazon_robot");
ros::NodeHandle nh;
std::vector<double> pickup_goal = { 3.4, 3.4, -2 };
std::vector<std::vector<double>> delivery_goal = { { 7.5, 0, 1.57 }, { 7.5, 0,
1.57 } };
/**
* @brief Constrctor of Class Navigation to initialize attributes.
*/
Navigation() {
_goal_status = true;
current_position_x;
current_position_y;
ros::Subscriber sub =
nh.subscribe < nav_msgs::OccupancyGrid
> ("/multimap_server/maps/level_2/localization/map",
1, &Navigation::mapCallback, this);
}
/**
* @brief Destructor of class Navigation.
*/
~Navigation() {
}
/**
* @brief Callback for current robot's pose.
* @param const nav_msgs::Odometry::ConstPtr &msg - Robot odometry data.
* @return void
*/
void PoseCallback(const nav_msgs::Odometry::ConstPtr &msg);
/**
* @brief Send desired goal to move_base action server.
* @param const nav_msgs::Odometry::ConstPtr &msg.
* @return void
*/
void sendGoalsToActionServer(float goal_x, float goal_y, float goal_theta);
/**
* @brief Command package feed conveyor to drop package on the robot.
* @param void
* @return true - package feed conveyor status.
*/
bool activateConveyor();
/**
* @brief Command robot's conveyor to drop package on the delivery location.
* @param void
* @return true - robot's conveyor status.
*/
bool activateRobotConveyor();
/**
* @brief Update global map in the map server.
* @param none.
* @return void
*/
void mapCallback(nav_msgs::OccupancyGrid msg);
void updateGlobalMap();
private:
/**
* Class local variables.
*/
bool _goal_status;
double current_position_x;
double current_position_y;
double current_quat[3];
typedef actionlib::SimpleActionClient
<move_base_msgs::MoveBaseAction> _move_base_client;
move_base_msgs::MoveBaseGoal _goal;
nav_msgs::Odometry _robot_pose;
nav_msgs::OccupancyGrid map;
};
| 29.795276 | 80 | 0.701903 | maarufvazifdar |
7920a3179398f183c0a1fd5e77ff82528aa06912 | 2,355 | cpp | C++ | PhysicsSandbox/SandboxGeometry/Shapes2d/SatShape2d.cpp | jodavis42/PhysicsSandbox | 3119caaa77721041440cdc1b3cf96d4bd9e2d98b | [
"MIT"
] | 1 | 2022-03-26T21:08:19.000Z | 2022-03-26T21:08:19.000Z | PhysicsSandbox/SandboxGeometry/Shapes2d/SatShape2d.cpp | jodavis42/PhysicsSandbox | 3119caaa77721041440cdc1b3cf96d4bd9e2d98b | [
"MIT"
] | null | null | null | PhysicsSandbox/SandboxGeometry/Shapes2d/SatShape2d.cpp | jodavis42/PhysicsSandbox | 3119caaa77721041440cdc1b3cf96d4bd9e2d98b | [
"MIT"
] | null | null | null | #include "Precompiled.hpp"
#include "SatShape2d.hpp"
#include "SandboxGeometry/Shapes2d/Line2d.hpp"
namespace SandboxGeometry
{
//-------------------------------------------------------------------SatShape2d
size_t SatShape2d::PointCount() const
{
return mPoints.Size();
}
size_t SatShape2d::EdgeCount() const
{
return PointCount();
}
size_t SatShape2d::FaceCount() const
{
return EdgeCount();
}
Vector2 SatShape2d::GetPoint(size_t index) const
{
return mPoints[index];
}
Line2d SatShape2d::GetEdge(size_t index) const
{
size_t index0 = index;
size_t index1 = (index + 1) % PointCount();
Line2d result;
result.mPoints[0] = GetPoint(index0);
result.mPoints[1] = GetPoint(index1);
return result;
}
Vector2 SatShape2d::GetNormal(size_t index) const
{
Line2d line = GetEdge(index);
Vector2 edge = line.mPoints[1] - line.mPoints[0];
Vector2 normal = Vector2(edge.y, -edge.x);
return Math::Normalized(normal);
}
SatShape2d::Face SatShape2d::GetFace(size_t index) const
{
Line2d edge = GetEdge(index);
Face result;
result.mPoints[0] = edge.mPoints[0];
result.mPoints[1] = edge.mPoints[1];
result.mEdge = result.mPoints[1] - result.mPoints[0];
result.mNormal = Math::Normalized(Vector2(result.mEdge.y, -result.mEdge.x));
return result;
}
Vector2 SatShape2d::Search(const Vector2& direction) const
{
float maxDistance = -Math::PositiveMax();
size_t maxIndex = 0;
for(size_t i = 0; i < PointCount(); ++i)
{
Vector2 point = GetPoint(i);
float distance = Math::Dot(direction, point);
if(distance > maxDistance)
{
maxDistance = distance;
maxIndex = i;
}
}
return GetPoint(maxIndex);
}
void BuildObbSatShape2d(const Vector2& obbCenter, const Matrix2& obbRotation, const Vector2& obbHalfExtents, SatShape2d& shape)
{
shape.mPoints.Resize(4);
shape.mPoints[0] = obbCenter + obbRotation.GetBasis(0) * obbHalfExtents[0] + obbRotation.GetBasis(1) * obbHalfExtents[1];
shape.mPoints[1] = obbCenter - obbRotation.GetBasis(0) * obbHalfExtents[0] + obbRotation.GetBasis(1) * obbHalfExtents[1];
shape.mPoints[2] = obbCenter - obbRotation.GetBasis(0) * obbHalfExtents[0] - obbRotation.GetBasis(1) * obbHalfExtents[1];
shape.mPoints[3] = obbCenter + obbRotation.GetBasis(0) * obbHalfExtents[0] - obbRotation.GetBasis(1) * obbHalfExtents[1];
}
}//namespace SandboxGeometry
| 27.068966 | 127 | 0.693418 | jodavis42 |
792286095a28e6b42b9bd4b8b9efe1c808a9d413 | 6,038 | cpp | C++ | LibXDK/src/_BaseXValue.cpp | sim9108/SDKS | 2823124fa0a22f8a77d131e7a2fb7f4aba59129c | [
"MIT"
] | 2 | 2015-03-23T01:08:49.000Z | 2015-03-23T02:28:17.000Z | LibXDK/src/_BaseXValue.cpp | sim9108/SDKS | 2823124fa0a22f8a77d131e7a2fb7f4aba59129c | [
"MIT"
] | null | null | null | LibXDK/src/_BaseXValue.cpp | sim9108/SDKS | 2823124fa0a22f8a77d131e7a2fb7f4aba59129c | [
"MIT"
] | null | null | null | #include <LibXtra/_BaseXValue.h>
_BaseXValue::_BaseXValue(_MOAFactory* mobj, const char* title)
:refcnt_(1), moa_obj_{ mobj }, utils_{ moa_obj_ }, xtra_name_{ title }
{
this->moa_obj_->AddRef();
++DllgXtraInterfaceCount;
}
_BaseXValue::~_BaseXValue(void)
{
this->moa_obj_->Release();
--DllgXtraInterfaceCount;
}
HRESULT
__stdcall _BaseXValue::QueryInterface(ConstPMoaInterfaceID pInterfaceID, PPMoaVoid ppv)
{
if (*pInterfaceID == IID_IMoaMmXValue){
this->AddRef();
*ppv = (IMoaMmXValue*)this;
return S_OK;
}
if(*pInterfaceID==IID_IMoaUnknown){
this->AddRef();
*ppv =(IMoaUnknown*)this;
return S_OK;
}
return E_NOINTERFACE;
}
MoaUlong
__stdcall _BaseXValue::AddRef() {
return InterlockedIncrement(&this->refcnt_);
}
MoaUlong
__stdcall _BaseXValue::Release() {
MoaUlong result;
result = InterlockedDecrement(&this->refcnt_);
if (!result) delete this;
return result;
}
HRESULT __stdcall
_BaseXValue::SetData(PMoaVoid pDataum){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::GetPropCount(MoaLong* pCount){
*pCount = 0;
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::GetPropDescriptionByIndex(MoaLong index, PMoaMmValueDescription pDescription){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::GetCount(MoaMmSymbol propName, MoaLong* pCount){
*pCount = 0;
return kMoaMmErr_PropertyNotFound;
}
///!!!!
HRESULT __stdcall
_BaseXValue::GetProp(ConstPMoaMmValue selfRef, MoaMmSymbol propName, MoaLong indexCount, ConstPMoaMmValue pIndexValues, PMoaMmValue pResult){
return kMoaMmErr_PropertyNotFound;
}
HRESULT __stdcall
_BaseXValue::SetProp(MoaMmSymbol propName, MoaLong indexCount, ConstPMoaMmValue pIndexValues, ConstPMoaMmValue pNewValue){
return kMoaMmErr_PropertyNotFound;
}
////!!!!!!
//!!!! important !!!
HRESULT __stdcall
_BaseXValue::AccessPropRef(ConstPMoaMmValue selfRef, MoaMmSymbol propName, MoaLong indexCount, ConstPMoaMmValue pIndexValues, PMoaMmValue pResult){
return this->GetProp(selfRef, propName, indexCount, pIndexValues, pResult);
}
HRESULT __stdcall
_BaseXValue::GetContents(ConstPMoaMmValue selfRef, PMoaMmValue pResult){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::SetContents(PMoaMmValue pNewValue){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::SetContentsBefore(PMoaMmValue pNewValue){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::SetContentsAfter(PMoaMmValue pNewValue){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::Ilk(PMoaMmValue pArgument, PMoaMmValue pResult){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::StringRep(PMoaMmValue pStringVal){
std::stringstream ss;
ss << "<Xtra child \"" << xtra_name_ <<"\" 0x"<<std::hex<<(void*) this << ">";
this->utils_.write_string(ss, *pStringVal);
return kMoaErr_NoErr;
}
HRESULT __stdcall
_BaseXValue::SymbolRep(PMoaMmSymbol pSymbol){
*pSymbol = this->utils_.make_symbol(xtra_name_);
return kMoaErr_NoErr;
}
HRESULT __stdcall
_BaseXValue::IntegerRep(PMoaLong pIntVal){
*pIntVal = 0;
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::StreamOut(PIMoaStream2 pStream){
return kMoaMmErr_AccessNotSupported;
}
HRESULT __stdcall
_BaseXValue::StreamIn(PIMoaStream2 pStream){
return kMoaMmErr_AccessNotSupported;
}
//ImageCrop
ImageCrop::ImageCrop(ImageLock& org_image, RECT& roi_rect, RECT& intersect_rect)
:org_image_{ org_image },
roi_rect_( roi_rect ),
intersect_rect_(intersect_rect)
{
width_ = roi_rect_.right - roi_rect_.left + 1;
height_ = roi_rect_.bottom - roi_rect_.top + 1;
}
const RECT& ImageCrop::intersect_rect() const{
return this->intersect_rect_;
}
MoaLong ImageCrop::width() const{
return this->width_;
}
MoaLong ImageCrop::height() const{
return this->height_;
}
// ImageLock
ImageLock::ImageLock(_BaseXValue& mobj, MoaMmValue& mv)
:mobj_(mobj), ready_{false}
{
auto mtype = mobj.utils_.is_type(mv);
if (kMoaMmValueType_Other != mtype) return;
ready_ = true;
this->mv_ = mv;
this->raw_update_info();
this->mobj_.utils_.LockPixels(&this->mv_, (PMoaVoid*)&this->data_);
}
ImageLock::ImageLock(_BaseXValue& mobj, MoaMmCallInfo& callPtr, int idx)
:mobj_(mobj), ready_{ false }
{
auto mtype = mobj.utils_.is_type(callPtr, idx);
if (kMoaMmValueType_Other != mtype) return;
ready_ = true;
this->mv_ = this->mobj_.utils_.get_index(callPtr, idx);
this->raw_update_info();
this->mobj_.utils_.LockPixels(&this->mv_, (PMoaVoid*)&this->data_);
}
void
ImageLock::raw_update_info(){
MoaMmImageInfo info;
mobj_.utils_.GetImageInfo(&this->mv_, &info);
this->width_ = info.iWidth;
this->height_ = info.iHeight;
this->image_row_bytes_ = info.iRowBytes;
this->pitch_bytes_ = info.iRowBytes;
this->pixel_bytes_ = info.iTotalDepth / 8;
this->alpha_pixel_bytes_ = info.iAlphaDepth / 8;
}
ImageCrop
ImageLock::get_crop(RECT& rect){
RECT full_rect = { 0, 0, this->width() - 1, this->height() - 1 };
RECT intersect_rect;
::IntersectRect(&intersect_rect, &full_rect, &rect);
intersect_rect.left -= rect.left;
intersect_rect.right -= rect.left;
intersect_rect.top -= rect.top;
intersect_rect.bottom -= rect.top;
return ImageCrop(*this, rect, intersect_rect);
}
ImageLock::operator ImageCrop(){
RECT full_rect = { 0, 0, this->width() - 1, this->height() - 1 };
return this->get_crop(full_rect);
}
ImageLock::~ImageLock(){
this->reset();
}
void
ImageLock::reset(){
if (!ready_) return;
this->mobj_.utils_.UnlockPixels(&this->mv_);
ready_ = false;
this->data_ = nullptr;
width_ = height_ = image_row_bytes_ = pitch_bytes_ = pixel_bytes_ = alpha_pixel_bytes_ = 0;
}
BYTE*
ImageLock::data() const{
return this->data_;
}
MoaLong
ImageLock::width() const{
return this->width_;
}
MoaLong
ImageLock::height() const {
return this->height_;
}
MoaLong
ImageLock::total_depth() const{
return this->pixel_bytes_;
}
MoaLong
ImageLock::row_bytes() const{
return this->image_row_bytes_;
} | 22.784906 | 147 | 0.753395 | sim9108 |
7924f71f624649dd618883c3138e8cfb96b4f59d | 6,030 | cpp | C++ | lib/Analysis/Memory/BitMemoryTrait.cpp | yukatan1701/tsar | a6f95cdaeb117ccd5fcb775b471b1aa17c45f4e8 | [
"Apache-2.0"
] | 14 | 2019-11-04T15:03:40.000Z | 2021-09-07T17:29:40.000Z | lib/Analysis/Memory/BitMemoryTrait.cpp | yukatan1701/tsar | a6f95cdaeb117ccd5fcb775b471b1aa17c45f4e8 | [
"Apache-2.0"
] | 11 | 2019-11-29T21:18:12.000Z | 2021-12-22T21:36:40.000Z | lib/Analysis/Memory/BitMemoryTrait.cpp | yukatan1701/tsar | a6f95cdaeb117ccd5fcb775b471b1aa17c45f4e8 | [
"Apache-2.0"
] | 17 | 2019-10-15T13:56:35.000Z | 2021-10-20T17:21:14.000Z | //=== BitMemoryTrait.cpp Bitwise Representation of Memory Traits *- C++ -*===//
//
// Traits Static Analyzer (SAPFOR)
//
// Copyright 2018 DVM System Group
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
//
// This file implements bitwise representation of memory traits.
//
//===----------------------------------------------------------------------===//
#include "BitMemoryTrait.h"
using namespace tsar;
BitMemoryTrait::BitMemoryTrait(const MemoryDescriptor &Dptr) : mId(NoAccess) {
if (Dptr.is<trait::AddressAccess>())
mId &= AddressAccess;
if (Dptr.is<trait::HeaderAccess>())
mId &= HeaderAccess;
if (Dptr.is<trait::NoPromotedScalar>())
mId &= NoPromotedScalar;
if (Dptr.is<trait::ExplicitAccess>())
mId &= ExplicitAccess;
if (Dptr.is<trait::Redundant>())
mId &= Redundant;
if (Dptr.is<trait::NoRedundant>())
mId &= NoRedundant;
if (Dptr.is<trait::DirectAccess>())
mId &= DirectAccess;
if (Dptr.is<trait::IndirectAccess>())
mId &= IndirectAccess;
if (Dptr.is<trait::Lock>())
mId &= Lock;
if (Dptr.is<trait::NoAccess>())
return;
if (Dptr.is<trait::Flow>() ||
Dptr.is<trait::Anti>() ||
Dptr.is<trait::Output>()) {
mId &= Dependency;
} else if (Dptr.is<trait::Reduction>()) {
mId &= Reduction;
} else if (Dptr.is<trait::Induction>()) {
mId &= Induction;
} else if (Dptr.is<trait::Readonly>()) {
mId &= Readonly;
} else {
auto SharedFlag = Dptr.is<trait::Shared>() ? SharedJoin : ~NoAccess;
auto SharedTrait = Dptr.is<trait::Shared>() ? Shared : Dependency;
if (Dptr.is<trait::Private>()) {
mId &= Private | SharedFlag;
} else {
if (Dptr.is<trait::FirstPrivate>())
mId &= FirstPrivate | SharedFlag;
if (Dptr.is<trait::LastPrivate>())
mId &= LastPrivate | SharedFlag;
else if (Dptr.is<trait::SecondToLastPrivate>())
mId &= SecondToLastPrivate | SharedFlag;
else if (Dptr.is<trait::DynamicPrivate>())
mId &= DynamicPrivate | SharedFlag;
else if (!Dptr.is<trait::FirstPrivate>()) {
mId &= SharedTrait;
}
}
}
}
MemoryDescriptor BitMemoryTrait::toDescriptor(unsigned TraitNumber,
MemoryStatistic &Stat) const {
MemoryDescriptor Dptr;
if (!(get() & ~AddressAccess)) {
Dptr.set<trait::AddressAccess>();
Stat.get<trait::AddressAccess>() += TraitNumber;
}
if (!(get() & ~HeaderAccess)) {
Dptr.set<trait::HeaderAccess>();
Stat.get<trait::HeaderAccess>() += TraitNumber;
}
if (!(get() & ~Lock)) {
Dptr.set<trait::Lock>();
Stat.get<trait::Lock>() += TraitNumber;
}
if (!(get() & ~NoPromotedScalar)) {
Dptr.set<trait::NoPromotedScalar>();
Stat.get<trait::NoPromotedScalar>() += TraitNumber;
}
if (!(get() & ~ExplicitAccess)) {
Dptr.set<trait::ExplicitAccess>();
Stat.get<trait::ExplicitAccess>() += TraitNumber;
}
if (!(get() & ~Redundant)) {
Dptr.set<trait::Redundant>();
Stat.get<trait::Redundant>() += TraitNumber;
}
if (!(get() & ~NoRedundant)) {
Dptr.set<trait::NoRedundant>();
Stat.get<trait::NoRedundant>() += TraitNumber;
}
if (!(get() & ~DirectAccess)) {
Dptr.set<trait::DirectAccess>();
Stat.get<trait::DirectAccess>() += TraitNumber;
}
if (!(get() & ~IndirectAccess)) {
Dptr.set<trait::IndirectAccess>();
Stat.get<trait::IndirectAccess>() += TraitNumber;
}
switch (dropUnitFlag(get())) {
case Readonly:
Dptr.set<trait::Readonly>();
Stat.get<trait::Readonly>() += TraitNumber;
return Dptr;
case NoAccess:
Dptr.set<trait::NoAccess>();
return Dptr;
case Shared:
Dptr.set<trait::Shared>();
Stat.get<trait::Shared>() += TraitNumber;
return Dptr;
}
if (hasSharedJoin(get())) {
Dptr.set<trait::Shared>();
Stat.get<trait::Shared>() += TraitNumber;
}
switch (dropUnitFlag(dropSharedFlag(get()))) {
default:
llvm_unreachable("Unknown type of memory location dependency!");
break;
case Private: Dptr.set<trait::Private>();
Stat.get<trait::Private>() += TraitNumber; break;
case FirstPrivate: Dptr.set<trait::FirstPrivate>();
Stat.get<trait::FirstPrivate>() += TraitNumber; break;
case FirstPrivate & LastPrivate:
Dptr.set<trait::FirstPrivate>();
Stat.get<trait::FirstPrivate>() += TraitNumber;
case LastPrivate:
Dptr.set<trait::LastPrivate>();
Stat.get<trait::LastPrivate>() += TraitNumber;
break;
case FirstPrivate & SecondToLastPrivate:
Dptr.set<trait::FirstPrivate>();
Stat.get<trait::FirstPrivate>() += TraitNumber;
case SecondToLastPrivate:
Dptr.set<trait::SecondToLastPrivate>();
Stat.get<trait::SecondToLastPrivate>() +=TraitNumber;
break;
case FirstPrivate & DynamicPrivate:
Dptr.set<trait::FirstPrivate>();
Stat.get<trait::FirstPrivate>() += TraitNumber;
case DynamicPrivate:
Dptr.set<trait::DynamicPrivate>();
Stat.get<trait::DynamicPrivate>() += TraitNumber;
break;
case Dependency:
Dptr.set<trait::Flow, trait::Anti, trait::Output>();
Stat.get<trait::Flow>() += TraitNumber;
Stat.get<trait::Anti>() += TraitNumber;
Stat.get<trait::Output>() += TraitNumber;
return Dptr;
case Reduction:
Dptr.set<trait::Reduction>();
Stat.get<trait::Reduction>() += TraitNumber;
return Dptr;
case Induction:
Dptr.set<trait::Induction>();
Stat.get<trait::Induction>() += TraitNumber;
return Dptr;
}
return Dptr;
}
| 32.95082 | 80 | 0.626368 | yukatan1701 |
792eef6bec38f4ac702f6857dfe889116b1e3181 | 8,757 | cpp | C++ | data/121.cpp | TianyiChen/rdcpp-data | 75c6868c876511e3ce143fdc3c08ddd74c7aa4ea | [
"MIT"
] | null | null | null | data/121.cpp | TianyiChen/rdcpp-data | 75c6868c876511e3ce143fdc3c08ddd74c7aa4ea | [
"MIT"
] | null | null | null | data/121.cpp | TianyiChen/rdcpp-data | 75c6868c876511e3ce143fdc3c08ddd74c7aa4ea | [
"MIT"
] | null | null | null | int v, g4U , WW
, WtYKC,Yu,Fuf /*7q*/,aDKMr, U3 ,
fQ,
Hnl8
,
kII , wd,kAx,d5,dt83
,
Ax
,//M
m,
se
,jX ,
hX6 ,
pNn,tuaf, W4
,
HD,
Pr,//e
yIm9
,P7A ,/*d*/esSeWz ,Yi8NA, tT ,
k1E6,CM, Wp ,eGQ/*HZ*/, S, LLm
, mO ,tnO3//6
, PRO, k9td, GCN; void
f_f0(){
{ { return
;
return ; /*wtv7*/}{
return ;
{{/*X8Z*/
{ } ;
//JNA
}}
{
{{ } }
;
{ if(true)
{
}else
{ }{
}}//
}
return
;{
//NP
{//aUYT
}
return
;}/*17*/ } {
for(int i=1;
i< 1 ;++i
){
;{ } }{int M;
volatile int
P6,FL
,i8 ; M
=
i8//ck
+ P6 +
FL;//EL8
}{return ;; ;}
}
{volatile int
Jos ,iGpx , ftX//4Fo
,
FHd, TGK
;
GCN =TGK+
Jos+iGpx
+ftX + FHd
;if( true )//Lqh
{return ;{ }
{ /*A*/volatile int
sla
/*r*/;
v
= sla ;{ } {
//BT
}
}} else
{
for(int i=1;i<2;++i ) { int lsm
;volatile int
AV//t
;if(true )if
( true) {for(int
i=1 ;
i<
/*67CX*/3;++i)
{ } return//vq
; //
{ {
}} }
else { /*CCAr*/}
else
lsm/*tF*/=/*k*/ AV ; {
}
}{return //
; }
;}if(
true
) {
for (int
i=1/*AQbtP*/ ; i<
4 /*K*/;++i
)
if
(
true/*Wc*/)
{}
else
{}{
return ;
//QqK
for (int i=1 ;/*NplA*/i<5;++i)
/*ZIXB*/ {} } } else
{//E7
volatile int krfG //9sWek
,jIv , sN2//wX
;for(int i=1
;/*Tv*/ i<6
;++i) {; } g4U
=sN2+krfG+ jIv ;}
}
return ;
} { { for
(int i=1//NQ
;
i<
7
;++i){{/*s*/}{
{}{ int V5xt
;volatile int TWy;if /*n*/ (true/*T*/){
}else V5xt=//Ks
TWy/*FF*/;} }}
{ { ;
//
{ }
} ;
}}{for
(int
i=1 ;//oud
i<8 ;++i ); ; {
volatile int JqJjehw , /*cze*/dQ /*J*/
;if(true)
{ { }} else
return ;{{ }
}
/*G*/if(
true) { {}
{}} else WW=
dQ + JqJjehw ;} return ;}{
//9fV4
int fS ;volatile int hG ,HC,
//
bty ,xyx
, WfSV
,
e9
,H6
/*Ha*/;;{ volatile int
D
,N2g/*A*/ ,NgC;for
(int i=1 ;//e
i< /*EZ8*/9;++i )WtYKC
=
NgC
+D
+ /*fM3e*/N2g;}
fS
= H6+hG +HC
+
bty
; for//Jj1
//K
(int
i=1;i<10;++i )Yu=
xyx+WfSV+
e9;}{{{ if /*8s*/ (true//G6Cmrc
) {}else{ {
}
} }
; return ;}
for(int i=1;/*GJcQ*/
/*P*/i< 11
;++i
)return//kaK
;
} } return ;/*9*/for
(int
i=1
;
i<
12
;++i )
;
return ;}void f_f1(){
if (//
/*4uOW*/true/*3*/)
return ;else
{if/*Q*/(
true){volatile int kJG
,t//4
//A
, Rhm; {//i5
{}{ return ; }/*5*/ } { volatile int oNtG ,
bTm,ShwH;
{//fo
}{//3
volatile int l ,B5,v7 ; if
(true);else//8
for
(int
i=1; i<13 ;++i
)Fuf=v7
+
l + B5 ;/*PpHl*/ {//z6
}
} aDKMr
//a
=ShwH + oNtG+
bTm; }
U3= Rhm +/**/kJG +t;
return ;
}
else{volatile int Q ,
QrJn /**/,Ng,
WZusW
; fQ
=WZusW+Q +
QrJn
+
Ng ; { volatile int
RX8a ,
Gm2l ;
//9
for
(int
i=1
;
i< 14;++i//96c
)Hnl8= //8
Gm2l +
RX8a ;//18
} {for (int i=1;
i<15;++i){ }
{
}/*ISd*/{//sZ
}/*Dj*/} } return ;
{ for //u
(int //5
i=1;
i<16
;++i);
{return
; for (int i=1;
i<17
;++i )for(int i=1;i< 18;++i ) {volatile int /*al*/ ry9 ,
o0W,i
;
kII=i
+ ry9+
o0W
; }
{return ;
for(int
i=1;i<19;++i )
if
(true
) return ;
else
return ;}}} //kQ1FE
/*Y*/{ if
(//nV
true )/*F1*/ {
if(true){ /*dp*/}else for
(int i=1;
i<20
;++i
){
for
(int i=1
;i< 21;++i
//
) return ;
}}else
{ if( true ){} else ;
return
;} //8
{return ;/*fAb*/}return/*b*/ ;
} };{ {
;{{
; } for(int i=1; i< 22;++i) { } } } for
(int i=1;//A
i<23 //mu
;++i
){{if(//T8D
true ){//t4
;/*Yf*/
}else {volatile int k0/**/,Rqgn8X,wMB ;/*K*/ wd=/*LUX*/wMB
+ k0+Rqgn8X ;
}{}/*P8o*/}return ; return ;/*40*/{int k3 ;volatile int Tu9n
//V0
, w,
WB , LdHPw ;
k3= LdHPw+ Tu9n+w +WB
; }
}
{
{{
{ }}{volatile int
bN6;/*ct*//*I*/for (int i=1;i</*imL*/ 24;++i )kAx=
bN6
;}for(int i=1
; i<25;++i //4SB
)for (int i=1 ;
i<
26 ;++i ){}
}
{
return//B
;{ volatile int oec , tw
, cX7/*gD*/;d5=
cX7 +/*e*/oec +tw;} }
} {volatile int
r20w
, wMW,
Mf
;
{ { if(true ) if(/*mp*/true ) {
} else
;else{}} {
} }dt83= Mf + r20w
+wMW ;}/*hJU*/}{ volatile int A4gZ
, A8WB ,zabxMg,DF ; { {{
}{ { } }for/*zt*///T0
(int i=1;i<27;++i ) for (int
i=1 ;i<
28
;++i )
{ { { }}}}{ { return ;
}{ volatile int VcF4kWS
, n3
; {
}
return
;
{
volatile int BR ; for (int i=1 /*dOCC*/
;
i< 29 ;++i
)Ax
=BR //0GSs
; /**/}m=
n3
+VcF4kWS
;//U
//BA
}return ;{ for (int i=1
;i<//zg
30 ;++i//C
) return/*MxF*/ ;
} } {
{//H
return ;}if
/*B*/(
true
)for (int
i=1 ;//Tp7
i<31//Z
;++i
)
for
(int
i=1/*B*/
;i<
32;++i
){ }else ;/*mA*/for (int i=1 ;i<33 ;++i
)
;} } {
int Guz ;
volatile int KQ,
uP
,
yn; for(int i=1;i<
34 ;++i){
{
volatile int YA ,
WxyfG;
se=
WxyfG
+//bw
YA ;;}
;} if(true
){{
volatile int wdW ,u1IMa ;
if( true )for(int i=1
;i<35 ;++i ) if(true)
jX =
u1IMa+ wdW
;/*nl*/ else{{ } }else ;
} }else for
(int
i=1;i< 36//5azqZ
;++i)
/*6*/{ volatile int xb ,b6V
,
t4;hX6 = t4
+xb
+b6V
;for(int i=1 ;i</*Gvj*/37 ;++i)return ;;
}Guz=yn +
KQ
+ //Q9
uP;{ return ;//N
{ }
} if ( true)
return ;else{
if ( true) { if(true
) {
}
else
{ } {} { }}else
return
; for
(int i=1
;
i< 38
;++i
) ;}}pNn = DF
+A4gZ
+A8WB//
+zabxMg; return ;{ volatile int/*UFf*/ Na , L0E8
, JBbK ;for
(int i=1 ; /*M*/ i<39;++i
)//V
{{
} {{ volatile int
j4b
;{
}for (int i=1 ; i<40
;++i ); for
(int
i=1 ; i<
41 ;++i) tuaf
=j4b ;} }{
} } { {}{
}} if
(true ) W4
=JBbK +Na+L0E8;else { for//Y
(int i=1
; i<42;++i) return ;
}} } ;
return ; }
void f_f2
() { volatile int TBkOA /*lPHt*/
,//LY
R ,yB3,
ee
,YrTwp,
jKXf ;{
{{
//Zyn
//pD4X
volatile int
wKL ,DH
;for
(int i=1; i<
43;++i)if/*meqp9*/
(true ) HD =DH + wKL//b1P
;
else
//qZU
return ;} { {
}return ; }} ; {
volatile int cL
,//iPkZP
P16/*L*/ ,S7x9/*pJU*/
,
sDb ,/*qn*///
amitfv ; Pr=amitfv +cL + P16/*CosH*//**/+
S7x9 +sDb
;{return ; };//s
}{
/*kZ*/ for
(int i=1; i< 44 ;++i );{
if
(
true) if
( true )//C
;else {volatile int Eu ;/*g*/for//q
(int
i=1;i<45
;++i
)
yIm9
= Eu
; return
; for(int
i=1;i< 46;++i) for
(int i=1;
i<
47//j12
;++i ){}} else{
};
}for(int i=1; i<//tm9
48 ;++i //m
)
{/*5vH*/;}return ;
}return ;}
P7A =jKXf+
TBkOA//
+ R + yB3+ ee+
YrTwp //
;
{
return ;/*j*/return ;
{
/*jl*/{ {
{//g
}}/*cC*/
} for/*Ry*/(int /*V*/i=1
;
i<49 ;++i
)if (true
)/**/{
int zvF ; volatile int
gr//l
,
/*R*/y5e;
{ }
zvF=y5e +gr
; if( true//FL
) { {}//Lk
{ }} else{ for(int i=1
; i<
50
;++i//
)
{}}}else for (int i=1 ;i<
51
;++i); }
};//jc
return ;
return ; //At
}int
main
()
{;; {volatile int
lC ,Zs ,bbB,
z4r
;{
{volatile int Z
,IC
,aKGAb
, qwumrp
,
aMZ2;
esSeWz = aMZ2/**/+ Z ;
for(int
i=1 ;
i< 52;++i
)if//kI
(true
){}
else Yi8NA =IC +aKGAb+
qwumrp//e
;return
/*eG*/ 1535424636 ;}; ; { { { }//2
}
{ { }} } }{ int nv ;volatile int
ea2,
YJhh
, A
;/**/{
volatile int Tt,mpy;if
(
true
)tT
= mpy
+Tt; else { {}}{ } /*G*///
if (/*MNT*/true )
{} else
{//W
} } if( true
)if(
true ) if
(true
) { {{}}/*X*/
{}; } else for (int i=1;i<
53 ;++i){ { }//iM
{ }}else
nv =A+
ea2 +YJhh; else
if
( true )
{{ ;; {
}}}else {int Jsf
;volatile int cab , No ,Unoxt
,/**/ bqJ ,/*D*/
H;k1E6/*H*/=H+cab//5
+No;if( true/*9*/) {
}
else for (int i=1; i<
54 ;++i )for
(int i=1 ;
i<
55 ;++i)Jsf =
Unoxt
+ bqJ/*B*/;
}} {
for(int i=1
;
i<56
;++i
)/*0vo*/{/*W*/volatile int hfS ,W, zB; CM
=zB+
hfS+ W;} {
{
; } {{ }{} }
for/*g6*/(int
i=1;
i<
57;++i)return 745506281
;}} Wp =/**///LN
z4r+
lC+
Zs +
bbB
; } { {{
{
return 356162911; {
}} } { ;if( true ) for
(int
i=1 ;i<
58
;++i /*8DA*/ ){ }else/**/{return 1879603641; } if( /**///Q
true)/**/{
for (int i=1 ; i<59 ;++i ) {
if //TH
/*n*/(
true
){}else for (int
i=1;i<
60;++i){
volatile int//
U7NqC
;/*5*/ eGQ=U7NqC;
} {}}
} else{ }
}return
//
1339832199;};{{{ }
//xJ
}
if(
true
)if
(
true)for(int i=1 ;i<
61 ;++i){ int
SzH ;
volatile int Ldq,Yhv, Ee ,k//0
,
/*6*/mS
; SzH=mS+ Ldq ;if( true)//A
{ //7N9
}else S= Yhv
+ Ee + /*6q*/ k;}else for(int i=1
;
i< 62;++i
)
return 622765840;else if (
true)
{
volatile int P , Ff
, jsze ,
vn ;LLm= vn+ P +Ff
+jsze ; }
else
if//Zp4B
(true/**/) for(int i=1; i< 63
//Q
;++i
)return 1827256872 ; else//J0
{
volatile int Lz
, OQykZZ ,
Tt8 ,vgMS; if (true)
; else
/*W7*/ mO /*t8b*/ =
vgMS+Lz +
OQykZZ
+ Tt8;{return
1805139222
;}} {
{
}
} } { int G7k;volatile int JO ,/*sN6*/BAT//9
, J54 ,
CG
,/*GrtI*/TY,
I8 ;G7k =I8 +
JO+
BAT; { volatile int /*vu8*/ vGDA5k/*Fq*/,MBsB/*gRN*/;{ }
return 217537407 ; tnO3= MBsB
+vGDA5k;
}for
(int /*Vol*/ i=1 ;i<64
;++i/**/){ volatile int hqq , Bkeq , Th ;for (int i=1;i<65 /*sgb7*/;++i ) { {
} } PRO
= Th+
hqq+ Bkeq;} k9td //lMi3
=J54 +CG +TY ; //OR
;}}} | 10.588875 | 82 | 0.444787 | TianyiChen |
79304246b4aa17ff848ca3fb5d38677493231890 | 4,242 | cpp | C++ | src/hooks/VRController.cpp | Lythium4848/SmoothedController | 97fb5cb547637f41565b563a13dc6a1e90f1e51f | [
"MIT"
] | null | null | null | src/hooks/VRController.cpp | Lythium4848/SmoothedController | 97fb5cb547637f41565b563a13dc6a1e90f1e51f | [
"MIT"
] | null | null | null | src/hooks/VRController.cpp | Lythium4848/SmoothedController | 97fb5cb547637f41565b563a13dc6a1e90f1e51f | [
"MIT"
] | null | null | null | #include "SmoothedController.hpp"
#include "SmoothedControllerConfig.hpp"
#include "Wrapper.hpp"
#include <map>
#include "GlobalNamespace/IVRPlatformHelper.hpp"
#include "GlobalNamespace/VRController.hpp"
#include "GlobalNamespace/VRControllerTransformOffset.hpp"
#include "System/Math.hpp"
#include "UnityEngine/Mathf.hpp"
#include "UnityEngine/Time.hpp"
#include "UnityEngine/XR/XRNode.hpp"
std::map<UnityEngine::XR::XRNode, SafePtr<SmoothedController::Wrapper>> wrappers;
void SmoothController(GlobalNamespace::VRController* instance) {
using namespace System;
using namespace System::Collections::Generic;
using namespace UnityEngine;
using namespace UnityEngine::XR;
if (!instance || !getSmoothedControllerConfig().Enabled.GetValue()) {
return;
}
static float posSmoth = 20.f - Mathf::Clamp(getSmoothedControllerConfig().PositionSmoothing.GetValue(), 0.f, 20.f);
static float rotSmoth = 20.f - Mathf::Clamp(getSmoothedControllerConfig().RotationSmoothing.GetValue(), 0.f, 20.f);
SafePtr<SmoothedController::Wrapper> wrapperI = nullptr;
if (wrappers.find(instance->get_node()) == wrappers.end()) {
wrapperI = CRASH_UNLESS(il2cpp_utils::New<SmoothedController::Wrapper*>());
wrappers[instance->get_node()] = *wrapperI;
} else {
wrapperI = *wrappers[instance->get_node()];
}
float angDiff = Quaternion::Angle(wrapperI->smoothedRotation, instance->get_transform()->get_localRotation());
wrapperI->angleVelocitySnap = Math::Min(wrapperI->angleVelocitySnap + angDiff, 90.f);
float snapMulti = Mathf::Clamp(wrapperI->angleVelocitySnap / getSmoothedControllerConfig().SmallMovementThresholdAngle.GetValue(), .1f, 2.5f);
if (wrapperI->angleVelocitySnap > .1f) {
wrapperI->angleVelocitySnap -= Math::Max(.4f, wrapperI->angleVelocitySnap / 1.7f);
}
if (getSmoothedControllerConfig().PositionSmoothing.GetValue() > 0.f) {
wrapperI->smoothedPosition = Vector3::Lerp(wrapperI->smoothedPosition, instance->get_transform()->get_localPosition(), posSmoth * Time::get_deltaTime() * snapMulti);
instance->get_transform()->set_localPosition(wrapperI->smoothedPosition);
}
if (getSmoothedControllerConfig().RotationSmoothing.GetValue() > 0.f) {
wrapperI->smoothedRotation = Quaternion::Lerp(wrapperI->smoothedRotation, instance->get_transform()->get_localRotation(), rotSmoth * Time::get_deltaTime() * snapMulti);
instance->get_transform()->set_localRotation(wrapperI->smoothedRotation);
}
}
MAKE_HOOK_MATCH(
VRController_Update,
&GlobalNamespace::VRController::Update,
void,
GlobalNamespace::VRController* self
) {
using namespace UnityEngine;
using namespace UnityEngine::XR;
// Because Quest is dumb and we dont have transpilers, we gotta reimplement this entire method. :D
Vector3 lastTrackedPosition;
Quaternion localRotation;
if (!self->vrPlatformHelper->GetNodePose(self->node, self->nodeIdx, lastTrackedPosition, localRotation)) {
if (self->lastTrackedPosition != Vector3::get_zero()) {
lastTrackedPosition = self->lastTrackedPosition;
} else if (self->node == XRNode::_get_LeftHand()) {
lastTrackedPosition = Vector3(-.2f, .05f, .0f);
} else if (self->node == XRNode::_get_RightHand()) {
lastTrackedPosition = Vector3(.2f, .05f, .0f);
}
} else {
self->lastTrackedPosition = lastTrackedPosition;
}
self->get_transform()->set_localPosition(lastTrackedPosition);
self->get_transform()->set_localRotation(localRotation);
if (self->get_gameObject()->get_name()->StartsWith(il2cpp_utils::newcsstr("Controller"))) {
SmoothController(self);
}
if (self->transformOffset != nullptr) {
self->vrPlatformHelper->AdjustControllerTransform(self->node, self->get_transform(), self->transformOffset->get_positionOffset(), self->transformOffset->get_rotationOffset());
return;
}
self->vrPlatformHelper->AdjustControllerTransform(self->node, self->get_transform(), Vector3::get_zero(), Vector3::get_zero());
}
void SmoothedController::Hooks::VRController() {
INSTALL_HOOK(getLogger(), VRController_Update);
} | 42.42 | 183 | 0.7157 | Lythium4848 |
79310b5ae511e49799a3979344f4ec74764770f6 | 1,217 | cpp | C++ | codeforces/C - Meme Problem/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | 1 | 2022-02-11T16:55:36.000Z | 2022-02-11T16:55:36.000Z | codeforces/C - Meme Problem/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | codeforces/C - Meme Problem/Accepted.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | /****************************************************************************************
* @author: * kzvd4729 created: Nov/12/2018 21:14
* solution_verdict: Accepted language: GNU C++14
* run_time: 15 ms memory_used: 11700 KB
* problem: https://codeforces.com/contest/1076/problem/C
****************************************************************************************/
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int fg[N+2];
double ans[N+2];
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
for(int i=0;i<=1000;i++)
{
double x=i*1.0;
double lo=0.0,hi=x/2.0,md;
if(((hi*hi)+0.0000001)<x)fg[i]=1;
int loop=100;
while(loop--)
{
md=(lo+hi)/2.0;
if((md*(x-md))>x)hi=md;
else lo=md;
}
ans[i]=md;
}
int t;cin>>t;
while(t--)
{
int n;cin>>n;
if(fg[n])cout<<"N"<<endl;
else
{
cout<<"Y ";
cout<<setprecision(10)<<fixed<<(n*1.0)-ans[n]<<" "<<ans[n]<<endl;
}
}
return 0;
} | 28.97619 | 111 | 0.384552 | kzvd4729 |
a6a89fa8355feac8f43f05f3960f766db13c8997 | 489 | cpp | C++ | src/Source/Chunks/Shex/SyncFlags.cpp | tgjones/slimshader-cpp | a1833e2eccf32cccfe33aa7613772503eca963ee | [
"MIT"
] | 20 | 2015-03-29T02:14:03.000Z | 2021-11-14T12:27:02.000Z | src/Source/Chunks/Shex/SyncFlags.cpp | tgjones/slimshader-cpp | a1833e2eccf32cccfe33aa7613772503eca963ee | [
"MIT"
] | null | null | null | src/Source/Chunks/Shex/SyncFlags.cpp | tgjones/slimshader-cpp | a1833e2eccf32cccfe33aa7613772503eca963ee | [
"MIT"
] | 12 | 2015-05-04T06:39:10.000Z | 2022-02-23T06:48:04.000Z | #include "PCH.h"
#include "SyncFlags.h"
#include "Decoder.h"
using namespace std;
using namespace SlimShader;
string SlimShader::ToString(SyncFlags value)
{
string result;
if (HasFlag(value, SyncFlags::UnorderedAccessViewGlobal))
result += "_uglobal";
if (HasFlag(value, SyncFlags::UnorderedAccessViewGroup))
result += "_ugroup";
if (HasFlag(value, SyncFlags::SharedMemory))
result += "_g";
if (HasFlag(value, SyncFlags::ThreadsInGroup))
result += "_t";
return result;
} | 21.26087 | 58 | 0.728016 | tgjones |
a6a8ceb77adb2c3b96880b5d88bdb570f2046c04 | 1,660 | cpp | C++ | cpu_version/convert/bvec_line.cpp | takanokage/Product-Quantization-Tree | 2651ba871100ff4c0ccef42ba57e871fbc6181f8 | [
"MIT"
] | 98 | 2016-07-18T07:38:07.000Z | 2022-02-02T15:28:01.000Z | cpu_version/convert/bvec_line.cpp | takanokage/Product-Quantization-Tree | 2651ba871100ff4c0ccef42ba57e871fbc6181f8 | [
"MIT"
] | 14 | 2016-08-03T08:43:36.000Z | 2017-11-02T14:39:41.000Z | cpu_version/convert/bvec_line.cpp | takanokage/Product-Quantization-Tree | 2651ba871100ff4c0ccef42ba57e871fbc6181f8 | [
"MIT"
] | 36 | 2016-07-27T13:47:12.000Z | 2020-07-13T14:34:46.000Z | #include <iostream>
#include <fstream>
#include <string>
#include <stdexcept>
#include <cassert>
#include "../helper.hpp"
#include "../filehelper.hpp"
#include "../iterator/memiterator.hpp"
#include "../iterator/bvecsiterator.hpp"
using namespace std;
int main(int argc, char const *argv[]) {
int line = atoi(argv[1]);
{
string bvecs = "/graphics/projects/scratch/ANNSIFTDB/ANN_SIFT1B/bigann_base.bvecs";
//string bvecs = "/graphics/projects/scratch/ANNSIFTDB/ANN_SIFT1B/bigann_query.bvecs";
uint8_t *data2 = readBatchJegou(bvecs.c_str(), line, 1);
int sum = 0;
for (int i = 0; i < 128; ++i) {
cout << (int)data2[i] << " ";
sum += (int)data2[i];
}
cout << endl;
cout << "sum " << sum << endl;
delete[] data2;
}
{
string bvecs = "/graphics/projects/scratch/ANNSIFTDB/ANN_SIFT1B/base1M.umem";
//string bvecs = "/graphics/projects/scratch/ANNSIFTDB/ANN_SIFT1B/query.umem";
uint n = 0;
uint d = 0;
header(bvecs, n, d);
cout << "header n " << n << endl;
cout << "header d " << d << endl;
memiterator<float, uint8_t> base_set;
base_set.open(bvecs.c_str());
cout << "header n " << base_set.num() << endl;
float *lean_data = base_set.addr(line);
int sum = 0;
for (int i = 0; i < 128; ++i) {
cout << lean_data[i] << " ";
sum += lean_data[i];
}
cout << endl;
cout << "sum " << sum << endl;
//read(bvecs, n, d, uint * ptr, uint len, uint offset = 0)
}
return 0;
} | 24.776119 | 94 | 0.535542 | takanokage |
a6ae01a0d384bdfa265c3da954710c2fb0cd6037 | 636 | cpp | C++ | server/src/main.cpp | silverthreadk/Mafia2 | 275f7e9fb63a98bcb5781c4d388a63da16a63213 | [
"BSL-1.0"
] | null | null | null | server/src/main.cpp | silverthreadk/Mafia2 | 275f7e9fb63a98bcb5781c4d388a63da16a63213 | [
"BSL-1.0"
] | null | null | null | server/src/main.cpp | silverthreadk/Mafia2 | 275f7e9fb63a98bcb5781c4d388a63da16a63213 | [
"BSL-1.0"
] | null | null | null | #include <iostream>
#include "server.h"
int main(int argc, char* argv[]) {
try {
if (argc < 2) {
std::cerr << "Usage: Server <port> [<port> ...]\n";
return 1;
}
boost::asio::io_context io_context;
std::list<Server> servers;
for (int i = 1; i < argc; ++i) {
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), std::atoi(argv[i]));
servers.emplace_back(io_context, endpoint);
}
io_context.run();
} catch (std::exception& e) {
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}
| 23.555556 | 100 | 0.492138 | silverthreadk |
a6af98ea81cf6041f60789187af3f22c0bf4658f | 8,684 | hxx | C++ | src/lapack_wrapper/code++/trid.hxx | ceccocats/LapackWrapper | fea6aa41849ffe5440fa3195c36f74e45e36b414 | [
"BSD-4-Clause"
] | 3 | 2021-05-19T14:33:59.000Z | 2022-03-14T02:12:47.000Z | src/lapack_wrapper/code++/trid.hxx | ceccocats/LapackWrapper | fea6aa41849ffe5440fa3195c36f74e45e36b414 | [
"BSD-4-Clause"
] | null | null | null | src/lapack_wrapper/code++/trid.hxx | ceccocats/LapackWrapper | fea6aa41849ffe5440fa3195c36f74e45e36b414 | [
"BSD-4-Clause"
] | 1 | 2020-01-24T15:10:34.000Z | 2020-01-24T15:10:34.000Z | /*--------------------------------------------------------------------------*\
| |
| Copyright (C) 2019 |
| |
| , __ , __ |
| /|/ \ /|/ \ |
| | __/ _ ,_ | __/ _ ,_ |
| | \|/ / | | | | \|/ / | | | |
| |(__/|__/ |_/ \_/|/|(__/|__/ |_/ \_/|/ |
| /| /| |
| \| \| |
| |
| Enrico Bertolazzi |
| Dipartimento di Ingegneria Industriale |
| Universita` degli Studi di Trento |
| email: [email protected] |
| |
\*--------------------------------------------------------------------------*/
///
/// file: trid.hxx
///
namespace lapack_wrapper {
//============================================================================
/*\
:|: _____ _ _ _ _ ____ ____ ____
:|: |_ _| __(_) __| (_) __ _ __ _ ___ _ __ __ _| / ___|| _ \| _ \
:|: | || '__| |/ _` | |/ _` |/ _` |/ _ \| '_ \ / _` | \___ \| |_) | | | |
:|: | || | | | (_| | | (_| | (_| | (_) | | | | (_| | |___) | __/| |_| |
:|: |_||_| |_|\__,_|_|\__,_|\__, |\___/|_| |_|\__,_|_|____/|_| |____/
:|: |___/
\*/
template <typename T>
class TridiagonalSPD : public LinearSystemSolver<T> {
public:
typedef T valueType;
private:
Malloc<valueType> allocReals;
valueType * L;
valueType * D;
valueType * WORK;
integer nRC;
public:
TridiagonalSPD()
: allocReals("allocReals")
, nRC(0)
{}
virtual
~TridiagonalSPD() LAPACK_WRAPPER_OVERRIDE
{ allocReals.free(); }
valueType cond1( valueType norm1 ) const;
void
factorize(
char const who[],
integer N,
valueType const _L[],
valueType const _D[]
);
/*\
:|: _ _ _
:|: __ _(_)_ __| |_ _ _ __ _| |___
:|: \ \ / / | '__| __| | | |/ _` | / __|
:|: \ V /| | | | |_| |_| | (_| | \__ \
:|: \_/ |_|_| \__|\__,_|\__,_|_|___/
\*/
virtual
void
solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
/*\
:|: _
:|: / \ _ ___ __
:|: / _ \| | | \ \/ /
:|: / ___ \ |_| |> <
:|: /_/ \_\__,_/_/\_\
:|:
\*/
void
axpy(
integer N,
valueType alpha,
valueType const L[],
valueType const D[],
valueType const x[],
valueType beta,
valueType y[]
) const;
};
//============================================================================
/*\
:|: _____ _ _ _ _ _ _ _
:|: |_ _| __(_) __| (_) __ _ __ _ ___ _ __ __ _| | | | | | |
:|: | || '__| |/ _` | |/ _` |/ _` |/ _ \| '_ \ / _` | | | | | | |
:|: | || | | | (_| | | (_| | (_| | (_) | | | | (_| | | |__| |_| |
:|: |_||_| |_|\__,_|_|\__,_|\__, |\___/|_| |_|\__,_|_|_____\___/
:|: |___/
\*/
template <typename T>
class TridiagonalLU : public LinearSystemSolver<T> {
public:
typedef T valueType;
private:
Malloc<valueType> allocReals;
Malloc<integer> allocIntegers;
valueType * L;
valueType * D;
valueType * U;
valueType * U2;
valueType * WORK;
integer * IPIV;
integer * IWORK;
integer nRC;
public:
TridiagonalLU()
: allocReals("TridiagonalLU-allocReals")
, allocIntegers("TridiagonalLU-allocIntegers")
, nRC(0)
{}
virtual
~TridiagonalLU() LAPACK_WRAPPER_OVERRIDE {
allocReals.free();
allocIntegers.free();
}
valueType cond1( valueType norm1 ) const;
valueType condInf( valueType normInf ) const;
void
factorize(
char const who[],
integer N,
valueType const _L[],
valueType const _D[],
valueType const _U[]
);
/*\
:|: _ _ _
:|: __ _(_)_ __| |_ _ _ __ _| |___
:|: \ \ / / | '__| __| | | |/ _` | / __|
:|: \ V /| | | | |_| |_| | (_| | \__ \
:|: \_/ |_|_| \__|\__,_|\__,_|_|___/
\*/
virtual
void
solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
/*\
:|: _
:|: / \ _ ___ __
:|: / _ \| | | \ \/ /
:|: / ___ \ |_| |> <
:|: /_/ \_\__,_/_/\_\
:|:
\*/
void
axpy(
integer N,
valueType alpha,
valueType const L[],
valueType const D[],
valueType const U[],
valueType const x[],
valueType beta,
valueType y[]
) const;
};
//============================================================================
/*\
:|: _____ _ _ _ _ ___ ____
:|: |_ _| __(_) __| (_) __ _ __ _ ___ _ __ __ _| |/ _ \| _ \
:|: | || '__| |/ _` | |/ _` |/ _` |/ _ \| '_ \ / _` | | | | | |_) |
:|: | || | | | (_| | | (_| | (_| | (_) | | | | (_| | | |_| | _ <
:|: |_||_| |_|\__,_|_|\__,_|\__, |\___/|_| |_|\__,_|_|\__\_\_| \_\
:|: |___/
\*/
template <typename T>
class TridiagonalQR : public LinearSystemSolver<T> {
public:
typedef T valueType;
private:
Malloc<valueType> allocReals;
valueType * C; // rotazioni givens
valueType * S;
valueType * BD; // band triangular matrix
valueType * BU; // band triangular matrix
valueType * BU2; // band triangular matrix
valueType normInfA;
integer nRC;
void Rsolve( valueType xb[] ) const;
void RsolveTransposed( valueType xb[] ) const;
public:
TridiagonalQR()
: allocReals("allocReals")
, nRC(0)
{}
virtual
~TridiagonalQR() LAPACK_WRAPPER_OVERRIDE {
allocReals.free();
}
void
factorize(
char const who[],
integer N,
valueType const L[],
valueType const D[],
valueType const U[]
);
void
lsq(
integer nrhs,
T RHS[],
integer ldRHS,
T lambda
) const;
/*\
:|: _ _ _
:|: __ _(_)_ __| |_ _ _ __ _| |___
:|: \ \ / / | '__| __| | | |/ _` | / __|
:|: \ V /| | | | |_| |_| | (_| | \__ \
:|: \_/ |_|_| \__|\__,_|\__,_|_|___/
\*/
virtual
void
solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve( valueType xb[] ) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
virtual
void
t_solve(
integer nrhs,
valueType xb[],
integer ldXB
) const LAPACK_WRAPPER_OVERRIDE;
/*\
:|: _
:|: / \ _ ___ __
:|: / _ \| | | \ \/ /
:|: / ___ \ |_| |> <
:|: /_/ \_\__,_/_/\_\
:|:
\*/
void
axpy(
integer N,
valueType alpha,
valueType const L[],
valueType const D[],
valueType const U[],
valueType const x[],
valueType beta,
valueType y[]
) const;
};
}
///
/// eof: trid.hxx
///
| 24.461972 | 80 | 0.376324 | ceccocats |
a6b04db6b50d7a607d55726b59212303ae9477ff | 2,721 | cpp | C++ | server/src/MediaLibraryServer.cpp | jabaa/MediaLibraryServer | 52caf9adc40694300adade33f89d86cf32960efd | [
"MIT"
] | null | null | null | server/src/MediaLibraryServer.cpp | jabaa/MediaLibraryServer | 52caf9adc40694300adade33f89d86cf32960efd | [
"MIT"
] | null | null | null | server/src/MediaLibraryServer.cpp | jabaa/MediaLibraryServer | 52caf9adc40694300adade33f89d86cf32960efd | [
"MIT"
] | null | null | null | #include "MediaLibraryServer.hpp"
MediaLibraryServer::MediaLibraryServer() : configs(), help(false) {}
void MediaLibraryServer::initialize(Application &self) {
loadConfiguration();
logger().information(fmt::format("Configs: {}", configs.size()));
for (const auto &c : configs) {
try {
loadConfiguration(c);
} catch (const Poco::InvalidArgumentException &e) {
logger().warning(
fmt::format("Poco::InvalidArgumentException: {}", e.what()));
}
}
Poco::Util::ServerApplication::initialize(self);
}
void MediaLibraryServer::uninitialize() {
Poco::Util::ServerApplication::uninitialize();
}
void MediaLibraryServer::defineOptions(Poco::Util::OptionSet &options) {
ServerApplication::defineOptions(options);
options.addOption(
Poco::Util::Option("help", "h", "display argument help information")
.required(false)
.repeatable(false)
.callback(Poco::Util::OptionCallback<MediaLibraryServer>(
this, &MediaLibraryServer::handleHelp)));
options.addOption(
Poco::Util::Option("config", "c", "add a path to a configuration")
.required(false)
.repeatable(true)
.argument("path", true)
.callback(Poco::Util::OptionCallback<MediaLibraryServer>(
this, &MediaLibraryServer::addConfig)));
}
void MediaLibraryServer::handleHelp(const std::string &, const std::string &) {
Poco::Util::HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS");
helpFormatter.setHeader(
"A web server that serves the current date and time.");
helpFormatter.format(std::cout);
help = true;
stopOptionsProcessing();
}
void MediaLibraryServer::addConfig(
const std::string &,
const std::string &value) {
if (std::find(configs.begin(), configs.end(), value) == configs.end()) {
configs.emplace_back(value);
}
}
int MediaLibraryServer::main(const std::vector<std::string> &) {
if (help) {
return Application::EXIT_OK;
}
if (!config().has(MEDIA_LIBRARY_SERVER__WEBROOT)) {
logger().error("Can't initialize server. Webroot is not set");
return Application::EXIT_USAGE;
}
unsigned short port = static_cast<unsigned short>(
config().getInt(MEDIA_LIBRARY_SERVER__PORT, 8080));
Poco::Net::ServerSocket svs(port);
Poco::Net::HTTPServer srv(new HttpRequestHandlerFactory(), svs,
new Poco::Net::HTTPServerParams);
srv.start();
waitForTerminationRequest();
srv.stop();
return Application::EXIT_OK;
}
| 33.592593 | 79 | 0.639838 | jabaa |
a6b2aa30c32d3e2c41525105c5e27b15eb01670a | 593 | cpp | C++ | hooks/weapons/weapon_fire_inject.cpp | Lucifirius/yzoriansteampunk | 7b629ffd9740f0ff3db1fb8cffe07f45b7528854 | [
"Unlicense"
] | null | null | null | hooks/weapons/weapon_fire_inject.cpp | Lucifirius/yzoriansteampunk | 7b629ffd9740f0ff3db1fb8cffe07f45b7528854 | [
"Unlicense"
] | null | null | null | hooks/weapons/weapon_fire_inject.cpp | Lucifirius/yzoriansteampunk | 7b629ffd9740f0ff3db1fb8cffe07f45b7528854 | [
"Unlicense"
] | null | null | null | //Injector source file for the Weapon Fire hook module.
#include "weapon_fire.h"
#include <hook_tools.h>
namespace {
void __declspec(naked) fireWeaponWrapper() {
static CUnit* unit;
static u8 weaponId;
__asm {
PUSH EBP
MOV EBP, ESP
MOVZX EAX, [EBP+0x08]
MOV weaponId, AL
MOV unit, ESI
PUSHAD
}
hooks::fireWeaponHook(unit, weaponId);
__asm {
POPAD
MOV ESP, EBP
POP EBP
RETN 4
}
}
} //Unnamed namespace
extern const u32 Func_FireUnitWeapon;
namespace hooks {
void injectWeaponFireHooks() {
jmpPatch(fireWeaponWrapper, Func_FireUnitWeapon, 0);
}
} //hooks
| 13.790698 | 55 | 0.709949 | Lucifirius |
a6b383c81ac60616678be98f148ad798a3755cec | 200,736 | inl | C++ | 2d_samples/pmj02_344.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | 1 | 2021-12-10T23:35:04.000Z | 2021-12-10T23:35:04.000Z | 2d_samples/pmj02_344.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | null | null | null | 2d_samples/pmj02_344.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | null | null | null | {std::array<float,2>{0.228854537f, 0.699147999f},
std::array<float,2>{0.952923894f, 0.237815425f},
std::array<float,2>{0.70954746f, 0.808866024f},
std::array<float,2>{0.422894925f, 0.445519507f},
std::array<float,2>{0.30648163f, 0.966786563f},
std::array<float,2>{0.569666564f, 0.372576654f},
std::array<float,2>{0.808057725f, 0.624266744f},
std::array<float,2>{0.0640059263f, 0.0857866481f},
std::array<float,2>{0.449965656f, 0.539549291f},
std::array<float,2>{0.642266452f, 0.0281394627f},
std::array<float,2>{0.916106582f, 0.927732527f},
std::array<float,2>{0.163366735f, 0.295351088f},
std::array<float,2>{0.0553571135f, 0.831291735f},
std::array<float,2>{0.835504651f, 0.387248397f},
std::array<float,2>{0.518502235f, 0.647173285f},
std::array<float,2>{0.337633461f, 0.14827697f},
std::array<float,2>{0.102396838f, 0.576171517f},
std::array<float,2>{0.752262235f, 0.10761264f},
std::array<float,2>{0.597673953f, 0.993513465f},
std::array<float,2>{0.255222142f, 0.341780216f},
std::array<float,2>{0.380553365f, 0.758518815f},
std::array<float,2>{0.749239326f, 0.493067414f},
std::array<float,2>{0.992315292f, 0.72107017f},
std::array<float,2>{0.209763333f, 0.214101866f},
std::array<float,2>{0.346545368f, 0.661418617f},
std::array<float,2>{0.533296049f, 0.167133316f},
std::array<float,2>{0.861511052f, 0.847624123f},
std::array<float,2>{0.000147525221f, 0.411086053f},
std::array<float,2>{0.146902233f, 0.898221612f},
std::array<float,2>{0.88700211f, 0.252441972f},
std::array<float,2>{0.659477174f, 0.530583799f},
std::array<float,2>{0.47502172f, 0.0334195197f},
std::array<float,2>{0.0307783373f, 0.631329358f},
std::array<float,2>{0.85286665f, 0.138047621f},
std::array<float,2>{0.56205982f, 0.812727571f},
std::array<float,2>{0.374800742f, 0.403753787f},
std::array<float,2>{0.484699607f, 0.908915222f},
std::array<float,2>{0.67899406f, 0.297136843f},
std::array<float,2>{0.890980601f, 0.55475992f},
std::array<float,2>{0.134954736f, 0.0139555605f},
std::array<float,2>{0.277899086f, 0.595706463f},
std::array<float,2>{0.617442787f, 0.0684518144f},
std::array<float,2>{0.775208116f, 0.951279938f},
std::array<float,2>{0.120081775f, 0.356185615f},
std::array<float,2>{0.196613565f, 0.783655703f},
std::array<float,2>{0.979151905f, 0.455324799f},
std::array<float,2>{0.724030674f, 0.706582189f},
std::array<float,2>{0.392209649f, 0.225704849f},
std::array<float,2>{0.174870104f, 0.501496434f},
std::array<float,2>{0.934394836f, 0.0568016917f},
std::array<float,2>{0.629261732f, 0.876619935f},
std::array<float,2>{0.466837138f, 0.273116499f},
std::array<float,2>{0.314677447f, 0.870657682f},
std::array<float,2>{0.510174572f, 0.427964419f},
std::array<float,2>{0.822266698f, 0.673307955f},
std::array<float,2>{0.0385836624f, 0.182080925f},
std::array<float,2>{0.413521081f, 0.739377618f},
std::array<float,2>{0.702884912f, 0.201707125f},
std::array<float,2>{0.956062973f, 0.766449273f},
std::array<float,2>{0.243516356f, 0.469329387f},
std::array<float,2>{0.0836177692f, 0.982613206f},
std::array<float,2>{0.781338096f, 0.321356297f},
std::array<float,2>{0.578647077f, 0.592184067f},
std::array<float,2>{0.295264781f, 0.11001078f},
std::array<float,2>{0.125748739f, 0.682356238f},
std::array<float,2>{0.901858628f, 0.173525453f},
std::array<float,2>{0.684011519f, 0.861503363f},
std::array<float,2>{0.495577037f, 0.435178071f},
std::array<float,2>{0.360116541f, 0.884783149f},
std::array<float,2>{0.549943566f, 0.280314386f},
std::array<float,2>{0.846073747f, 0.514712155f},
std::array<float,2>{0.0204511974f, 0.0523715429f},
std::array<float,2>{0.401484281f, 0.580371737f},
std::array<float,2>{0.730837524f, 0.122942775f},
std::array<float,2>{0.976035297f, 0.969501853f},
std::array<float,2>{0.193014741f, 0.320206076f},
std::array<float,2>{0.110168256f, 0.773463428f},
std::array<float,2>{0.769399881f, 0.47796458f},
std::array<float,2>{0.611301661f, 0.747958064f},
std::array<float,2>{0.272913814f, 0.190836251f},
std::array<float,2>{0.0408542976f, 0.554521203f},
std::array<float,2>{0.814290464f, 0.00757627096f},
std::array<float,2>{0.505246997f, 0.918568313f},
std::array<float,2>{0.321374297f, 0.308784574f},
std::array<float,2>{0.458367586f, 0.820905268f},
std::array<float,2>{0.635493577f, 0.396799028f},
std::array<float,2>{0.926512241f, 0.639851809f},
std::array<float,2>{0.185262173f, 0.127789587f},
std::array<float,2>{0.281331867f, 0.716848373f},
std::array<float,2>{0.588846564f, 0.232830867f},
std::array<float,2>{0.79434818f, 0.789590955f},
std::array<float,2>{0.0911184475f, 0.467726558f},
std::array<float,2>{0.239622846f, 0.938609779f},
std::array<float,2>{0.968136847f, 0.350122899f},
std::array<float,2>{0.691112995f, 0.607357502f},
std::array<float,2>{0.414320856f, 0.0775245056f},
std::array<float,2>{0.0735915229f, 0.733716071f},
std::array<float,2>{0.799731195f, 0.206218496f},
std::array<float,2>{0.573680162f, 0.756621242f},
std::array<float,2>{0.301793277f, 0.48942101f},
std::array<float,2>{0.433246523f, 0.985693753f},
std::array<float,2>{0.712837934f, 0.33529222f},
std::array<float,2>{0.943504214f, 0.566468298f},
std::array<float,2>{0.223297283f, 0.101519577f},
std::array<float,2>{0.332776308f, 0.521107316f},
std::array<float,2>{0.527191341f, 0.0400738791f},
std::array<float,2>{0.843552649f, 0.89920187f},
std::array<float,2>{0.0519144386f, 0.265404135f},
std::array<float,2>{0.165046677f, 0.855914354f},
std::array<float,2>{0.910322011f, 0.41940698f},
std::array<float,2>{0.648812473f, 0.66599071f},
std::array<float,2>{0.441175222f, 0.160486192f},
std::array<float,2>{0.214720249f, 0.611247659f},
std::array<float,2>{0.989794433f, 0.0859829336f},
std::array<float,2>{0.737735152f, 0.954890728f},
std::array<float,2>{0.38525039f, 0.359699816f},
std::array<float,2>{0.259371668f, 0.797128916f},
std::array<float,2>{0.607369602f, 0.44456625f},
std::array<float,2>{0.762625754f, 0.690574586f},
std::array<float,2>{0.0991009399f, 0.247358203f},
std::array<float,2>{0.483793944f, 0.653531611f},
std::array<float,2>{0.668956578f, 0.152844802f},
std::array<float,2>{0.882029176f, 0.838077247f},
std::array<float,2>{0.150356084f, 0.382148117f},
std::array<float,2>{0.0105767259f, 0.933731139f},
std::array<float,2>{0.874123275f, 0.285107434f},
std::array<float,2>{0.540078938f, 0.534193695f},
std::array<float,2>{0.355032265f, 0.0209324248f},
std::array<float,2>{0.159394264f, 0.744783819f},
std::array<float,2>{0.917981625f, 0.193170503f},
std::array<float,2>{0.64613694f, 0.779729605f},
std::array<float,2>{0.44918406f, 0.480979443f},
std::array<float,2>{0.343522012f, 0.975869775f},
std::array<float,2>{0.521855175f, 0.31291768f},
std::array<float,2>{0.829633892f, 0.582173526f},
std::array<float,2>{0.0606718175f, 0.120824173f},
std::array<float,2>{0.425996035f, 0.510507166f},
std::array<float,2>{0.704169154f, 0.0495118313f},
std::array<float,2>{0.947782278f, 0.887764633f},
std::array<float,2>{0.23421149f, 0.275549829f},
std::array<float,2>{0.068789497f, 0.865595698f},
std::array<float,2>{0.81160605f, 0.429752618f},
std::array<float,2>{0.56572628f, 0.685147941f},
std::array<float,2>{0.310299575f, 0.177456141f},
std::array<float,2>{0.00715639722f, 0.604965329f},
std::array<float,2>{0.864150822f, 0.0712434873f},
std::array<float,2>{0.536175013f, 0.944919288f},
std::array<float,2>{0.349377185f, 0.345806658f},
std::array<float,2>{0.470420837f, 0.793329895f},
std::array<float,2>{0.663675547f, 0.464315683f},
std::array<float,2>{0.886545062f, 0.713041842f},
std::array<float,2>{0.142806053f, 0.228723973f},
std::array<float,2>{0.251178503f, 0.635650516f},
std::array<float,2>{0.596480906f, 0.131009579f},
std::array<float,2>{0.757166564f, 0.824319065f},
std::array<float,2>{0.108883664f, 0.390849024f},
std::array<float,2>{0.205640197f, 0.916798532f},
std::array<float,2>{0.99645859f, 0.305241257f},
std::array<float,2>{0.74554497f, 0.549429715f},
std::array<float,2>{0.37803936f, 0.00276688696f},
std::array<float,2>{0.124696575f, 0.668128788f},
std::array<float,2>{0.779143453f, 0.159246907f},
std::array<float,2>{0.621881187f, 0.852713585f},
std::array<float,2>{0.277069807f, 0.415876925f},
std::array<float,2>{0.396416575f, 0.90580523f},
std::array<float,2>{0.722299814f, 0.261476815f},
std::array<float,2>{0.983914435f, 0.518451035f},
std::array<float,2>{0.200962767f, 0.0458805375f},
std::array<float,2>{0.369603992f, 0.564335763f},
std::array<float,2>{0.556571007f, 0.0942253917f},
std::array<float,2>{0.858289182f, 0.989390671f},
std::array<float,2>{0.0242793281f, 0.329719096f},
std::array<float,2>{0.138841465f, 0.753140092f},
std::array<float,2>{0.8971591f, 0.485942215f},
std::array<float,2>{0.672089994f, 0.730384052f},
std::array<float,2>{0.490196705f, 0.20873329f},
std::array<float,2>{0.24776563f, 0.538816273f},
std::array<float,2>{0.959113538f, 0.0174312685f},
std::array<float,2>{0.69783783f, 0.930477977f},
std::array<float,2>{0.409939885f, 0.288513094f},
std::array<float,2>{0.292963862f, 0.839960158f},
std::array<float,2>{0.584650993f, 0.376484364f},
std::array<float,2>{0.786014318f, 0.650705755f},
std::array<float,2>{0.0819639266f, 0.148475572f},
std::array<float,2>{0.461939871f, 0.694781244f},
std::array<float,2>{0.62725246f, 0.246060789f},
std::array<float,2>{0.929906428f, 0.803132117f},
std::array<float,2>{0.177703947f, 0.440295815f},
std::array<float,2>{0.0325124934f, 0.958020389f},
std::array<float,2>{0.825307667f, 0.364049107f},
std::array<float,2>{0.514864445f, 0.614893675f},
std::array<float,2>{0.320026547f, 0.0903000161f},
std::array<float,2>{0.188713536f, 0.641161978f},
std::array<float,2>{0.970804214f, 0.142178401f},
std::array<float,2>{0.730075777f, 0.834768593f},
std::array<float,2>{0.405819803f, 0.382867008f},
std::array<float,2>{0.266442448f, 0.924963713f},
std::array<float,2>{0.616432011f, 0.290228277f},
std::array<float,2>{0.769776046f, 0.543260932f},
std::array<float,2>{0.113304816f, 0.0271579176f},
std::array<float,2>{0.499370635f, 0.619900227f},
std::array<float,2>{0.680188239f, 0.0803615302f},
std::array<float,2>{0.904478848f, 0.963642359f},
std::array<float,2>{0.13131626f, 0.369936854f},
std::array<float,2>{0.0168664549f, 0.806867957f},
std::array<float,2>{0.847926021f, 0.449717879f},
std::array<float,2>{0.554129601f, 0.699730217f},
std::array<float,2>{0.366654992f, 0.240013227f},
std::array<float,2>{0.0879876316f, 0.527181387f},
std::array<float,2>{0.789907873f, 0.0372415856f},
std::array<float,2>{0.590043366f, 0.892857075f},
std::array<float,2>{0.289011419f, 0.255867064f},
std::array<float,2>{0.418325394f, 0.850404918f},
std::array<float,2>{0.691848159f, 0.409888059f},
std::array<float,2>{0.964174449f, 0.658270538f},
std::array<float,2>{0.235051394f, 0.168025509f},
std::array<float,2>{0.32448411f, 0.72330308f},
std::array<float,2>{0.503049433f, 0.21661219f},
std::array<float,2>{0.820288301f, 0.763198972f},
std::array<float,2>{0.0468605869f, 0.49824518f},
std::array<float,2>{0.181440547f, 0.998392522f},
std::array<float,2>{0.923024297f, 0.3395257f},
std::array<float,2>{0.639219582f, 0.571611345f},
std::array<float,2>{0.455766469f, 0.10198158f},
std::array<float,2>{0.0497296154f, 0.70867902f},
std::array<float,2>{0.838302195f, 0.220508948f},
std::array<float,2>{0.530905902f, 0.786215901f},
std::array<float,2>{0.330670625f, 0.458915472f},
std::array<float,2>{0.442171156f, 0.945900798f},
std::array<float,2>{0.652604938f, 0.355260938f},
std::array<float,2>{0.909218907f, 0.600652397f},
std::array<float,2>{0.168747649f, 0.063365452f},
std::array<float,2>{0.300554603f, 0.561914742f},
std::array<float,2>{0.575746357f, 0.0114891576f},
std::array<float,2>{0.803700686f, 0.913764119f},
std::array<float,2>{0.0772512332f, 0.302632064f},
std::array<float,2>{0.220018551f, 0.818413258f},
std::array<float,2>{0.940444589f, 0.400071055f},
std::array<float,2>{0.71727562f, 0.627962887f},
std::array<float,2>{0.436092407f, 0.135138407f},
std::array<float,2>{0.153833643f, 0.588145792f},
std::array<float,2>{0.876194f, 0.115563467f},
std::array<float,2>{0.665824175f, 0.977480173f},
std::array<float,2>{0.479826033f, 0.32468465f},
std::array<float,2>{0.355835885f, 0.772928536f},
std::array<float,2>{0.543976068f, 0.476122528f},
std::array<float,2>{0.870344162f, 0.735672116f},
std::array<float,2>{0.014430589f, 0.197334811f},
std::array<float,2>{0.390476823f, 0.679045081f},
std::array<float,2>{0.74140054f, 0.187232494f},
std::array<float,2>{0.987408876f, 0.874382019f},
std::array<float,2>{0.21738416f, 0.424224079f},
std::array<float,2>{0.0965783596f, 0.882451177f},
std::array<float,2>{0.760753393f, 0.268703729f},
std::array<float,2>{0.603039861f, 0.504784822f},
std::array<float,2>{0.263723165f, 0.0607873239f},
std::array<float,2>{0.207085326f, 0.719506323f},
std::array<float,2>{0.995275795f, 0.212766558f},
std::array<float,2>{0.747832716f, 0.760200441f},
std::array<float,2>{0.381402999f, 0.494668543f},
std::array<float,2>{0.25720796f, 0.995213091f},
std::array<float,2>{0.600749671f, 0.343706727f},
std::array<float,2>{0.750037551f, 0.577989638f},
std::array<float,2>{0.104814932f, 0.106927484f},
std::array<float,2>{0.472789288f, 0.527532279f},
std::array<float,2>{0.656395495f, 0.0320011005f},
std::array<float,2>{0.889411032f, 0.895987809f},
std::array<float,2>{0.145430833f, 0.251098454f},
std::array<float,2>{0.00199523452f, 0.845520318f},
std::array<float,2>{0.860383928f, 0.412460268f},
std::array<float,2>{0.531681478f, 0.662232697f},
std::array<float,2>{0.343942493f, 0.16458112f},
std::array<float,2>{0.0644731671f, 0.62240535f},
std::array<float,2>{0.805731833f, 0.0837097988f},
std::array<float,2>{0.568265975f, 0.96692121f},
std::array<float,2>{0.306791425f, 0.374401003f},
std::array<float,2>{0.425586164f, 0.81141752f},
std::array<float,2>{0.707920134f, 0.447352171f},
std::array<float,2>{0.951115429f, 0.695452869f},
std::array<float,2>{0.227450147f, 0.236211479f},
std::array<float,2>{0.338466465f, 0.645902216f},
std::array<float,2>{0.517474115f, 0.144954637f},
std::array<float,2>{0.832675278f, 0.829187214f},
std::array<float,2>{0.0573786907f, 0.390318394f},
std::array<float,2>{0.161509603f, 0.927776814f},
std::array<float,2>{0.915704489f, 0.293897092f},
std::array<float,2>{0.642887235f, 0.541985333f},
std::array<float,2>{0.451747149f, 0.0302339718f},
std::array<float,2>{0.0361896381f, 0.675757289f},
std::array<float,2>{0.820796669f, 0.180977225f},
std::array<float,2>{0.509142339f, 0.868184865f},
std::array<float,2>{0.313532352f, 0.426736206f},
std::array<float,2>{0.466424167f, 0.876958132f},
std::array<float,2>{0.631872952f, 0.270758361f},
std::array<float,2>{0.936006844f, 0.503409624f},
std::array<float,2>{0.172356218f, 0.0557202697f},
std::array<float,2>{0.293373436f, 0.59111172f},
std::array<float,2>{0.581210673f, 0.112671323f},
std::array<float,2>{0.784780622f, 0.981170475f},
std::array<float,2>{0.0846455395f, 0.323001623f},
std::array<float,2>{0.244295433f, 0.769209146f},
std::array<float,2>{0.953390241f, 0.471207947f},
std::array<float,2>{0.700271726f, 0.740424514f},
std::array<float,2>{0.411935657f, 0.200300351f},
std::array<float,2>{0.13331221f, 0.557663321f},
std::array<float,2>{0.892813265f, 0.0136104682f},
std::array<float,2>{0.675903261f, 0.907286584f},
std::array<float,2>{0.487975717f, 0.300055504f},
std::array<float,2>{0.371160388f, 0.816306353f},
std::array<float,2>{0.560237885f, 0.406133801f},
std::array<float,2>{0.854894698f, 0.629515946f},
std::array<float,2>{0.0286249667f, 0.140236676f},
std::array<float,2>{0.392856836f, 0.70374018f},
std::array<float,2>{0.726179242f, 0.224290133f},
std::array<float,2>{0.976661325f, 0.782652855f},
std::array<float,2>{0.198074281f, 0.453656673f},
std::array<float,2>{0.118871599f, 0.950847745f},
std::array<float,2>{0.776051641f, 0.358620942f},
std::array<float,2>{0.619683206f, 0.595018566f},
std::array<float,2>{0.279778898f, 0.0664967299f},
std::array<float,2>{0.187445357f, 0.637826562f},
std::array<float,2>{0.928796113f, 0.125601336f},
std::array<float,2>{0.63460201f, 0.822441399f},
std::array<float,2>{0.45915094f, 0.39506337f},
std::array<float,2>{0.322861522f, 0.920560956f},
std::array<float,2>{0.506286681f, 0.31156826f},
std::array<float,2>{0.816140294f, 0.552370012f},
std::array<float,2>{0.0416891202f, 0.00504122209f},
std::array<float,2>{0.416713625f, 0.608368576f},
std::array<float,2>{0.688610196f, 0.0756171048f},
std::array<float,2>{0.965874374f, 0.940506101f},
std::array<float,2>{0.241365731f, 0.349263579f},
std::array<float,2>{0.093159087f, 0.792377591f},
std::array<float,2>{0.796546102f, 0.466754943f},
std::array<float,2>{0.586238801f, 0.714913368f},
std::array<float,2>{0.284611195f, 0.232401088f},
std::array<float,2>{0.0218862873f, 0.513572574f},
std::array<float,2>{0.845663071f, 0.0538301356f},
std::array<float,2>{0.548169434f, 0.884124756f},
std::array<float,2>{0.362306654f, 0.277679771f},
std::array<float,2>{0.49364531f, 0.859865904f},
std::array<float,2>{0.685570657f, 0.437006205f},
std::array<float,2>{0.899942279f, 0.680438876f},
std::array<float,2>{0.128336951f, 0.175205514f},
std::array<float,2>{0.270082653f, 0.749388754f},
std::array<float,2>{0.611652195f, 0.188101172f},
std::array<float,2>{0.766854346f, 0.777070165f},
std::array<float,2>{0.113123439f, 0.480089635f},
std::array<float,2>{0.193446264f, 0.972532034f},
std::array<float,2>{0.973333061f, 0.317575783f},
std::array<float,2>{0.732998073f, 0.578996897f},
std::array<float,2>{0.398453474f, 0.12387684f},
std::array<float,2>{0.10099081f, 0.688661039f},
std::array<float,2>{0.764051735f, 0.248881876f},
std::array<float,2>{0.608300745f, 0.800691009f},
std::array<float,2>{0.260563403f, 0.443057805f},
std::array<float,2>{0.384527445f, 0.956041217f},
std::array<float,2>{0.735477507f, 0.362866729f},
std::array<float,2>{0.990255892f, 0.611448526f},
std::array<float,2>{0.211231411f, 0.0880861506f},
std::array<float,2>{0.351650506f, 0.532263219f},
std::array<float,2>{0.5416013f, 0.0223800372f},
std::array<float,2>{0.871493757f, 0.937298298f},
std::array<float,2>{0.0080119241f, 0.281284779f},
std::array<float,2>{0.152002856f, 0.837637484f},
std::array<float,2>{0.879971802f, 0.379930049f},
std::array<float,2>{0.670384169f, 0.654540479f},
std::array<float,2>{0.480564266f, 0.156039715f},
std::array<float,2>{0.226345614f, 0.569787502f},
std::array<float,2>{0.941581309f, 0.0984032676f},
std::array<float,2>{0.71298337f, 0.986433983f},
std::array<float,2>{0.430967212f, 0.333913714f},
std::array<float,2>{0.304384768f, 0.75464201f},
std::array<float,2>{0.570320964f, 0.490671158f},
std::array<float,2>{0.798012972f, 0.731178105f},
std::array<float,2>{0.0705216154f, 0.203237981f},
std::array<float,2>{0.438865304f, 0.666171253f},
std::array<float,2>{0.651893973f, 0.162221715f},
std::array<float,2>{0.913696349f, 0.859078765f},
std::array<float,2>{0.167643413f, 0.421679258f},
std::array<float,2>{0.0533023588f, 0.901845872f},
std::array<float,2>{0.840926528f, 0.263061672f},
std::array<float,2>{0.523897707f, 0.521742582f},
std::array<float,2>{0.334713608f, 0.042089466f},
std::array<float,2>{0.140826851f, 0.712578595f},
std::array<float,2>{0.883756816f, 0.22744827f},
std::array<float,2>{0.662026525f, 0.795954764f},
std::array<float,2>{0.471771955f, 0.461058706f},
std::array<float,2>{0.350060135f, 0.942040801f},
std::array<float,2>{0.537315249f, 0.344471902f},
std::array<float,2>{0.865700901f, 0.602428019f},
std::array<float,2>{0.00436072657f, 0.073118709f},
std::array<float,2>{0.376302838f, 0.548274219f},
std::array<float,2>{0.743275166f, 0.000795813161f},
std::array<float,2>{0.998198509f, 0.915487051f},
std::array<float,2>{0.205013618f, 0.307862937f},
std::array<float,2>{0.106220111f, 0.828049719f},
std::array<float,2>{0.754392624f, 0.392597467f},
std::array<float,2>{0.59528029f, 0.633599281f},
std::array<float,2>{0.252176046f, 0.130284742f},
std::array<float,2>{0.0600601733f, 0.58471483f},
std::array<float,2>{0.83148402f, 0.117491156f},
std::array<float,2>{0.52076602f, 0.973038256f},
std::array<float,2>{0.340089411f, 0.316103309f},
std::array<float,2>{0.446368247f, 0.778573513f},
std::array<float,2>{0.646814823f, 0.483137488f},
std::array<float,2>{0.920656025f, 0.743535101f},
std::array<float,2>{0.158030599f, 0.193980351f},
std::array<float,2>{0.311669677f, 0.685949028f},
std::array<float,2>{0.563671291f, 0.178207979f},
std::array<float,2>{0.809124172f, 0.863839388f},
std::array<float,2>{0.0665836334f, 0.432446659f},
std::array<float,2>{0.231074542f, 0.888901114f},
std::array<float,2>{0.947014272f, 0.273456752f},
std::array<float,2>{0.706228912f, 0.508774579f},
std::array<float,2>{0.42922467f, 0.0470957309f},
std::array<float,2>{0.0796649307f, 0.650031984f},
std::array<float,2>{0.787753165f, 0.151214704f},
std::array<float,2>{0.583395958f, 0.843715191f},
std::array<float,2>{0.290666878f, 0.377878159f},
std::array<float,2>{0.407361567f, 0.932293773f},
std::array<float,2>{0.696286559f, 0.286685258f},
std::array<float,2>{0.958786249f, 0.536532402f},
std::array<float,2>{0.249072343f, 0.0189339351f},
std::array<float,2>{0.317650706f, 0.615462661f},
std::array<float,2>{0.512891173f, 0.0919862762f},
std::array<float,2>{0.827298582f, 0.959684551f},
std::array<float,2>{0.0348843373f, 0.365692794f},
std::array<float,2>{0.179310054f, 0.801614106f},
std::array<float,2>{0.932823062f, 0.43888247f},
std::array<float,2>{0.625038922f, 0.692159235f},
std::array<float,2>{0.463384777f, 0.242265925f},
std::array<float,2>{0.201920509f, 0.516088188f},
std::array<float,2>{0.980754972f, 0.0442488976f},
std::array<float,2>{0.719977915f, 0.904062986f},
std::array<float,2>{0.398348212f, 0.257988364f},
std::array<float,2>{0.274874687f, 0.854375064f},
std::array<float,2>{0.623220384f, 0.416990668f},
std::array<float,2>{0.780627131f, 0.670711637f},
std::array<float,2>{0.122845061f, 0.157503769f},
std::array<float,2>{0.490499467f, 0.7278108f},
std::array<float,2>{0.674741507f, 0.209241495f},
std::array<float,2>{0.89608568f, 0.750126898f},
std::array<float,2>{0.13693276f, 0.487814188f},
std::array<float,2>{0.0258383676f, 0.991808474f},
std::array<float,2>{0.855920076f, 0.330858737f},
std::array<float,2>{0.556971252f, 0.564623177f},
std::array<float,2>{0.368411779f, 0.0961024463f},
std::array<float,2>{0.237628266f, 0.656571865f},
std::array<float,2>{0.961794913f, 0.171495914f},
std::array<float,2>{0.694239974f, 0.84853822f},
std::array<float,2>{0.420010835f, 0.4065063f},
std::array<float,2>{0.286863178f, 0.891130328f},
std::array<float,2>{0.593571424f, 0.254113555f},
std::array<float,2>{0.791040242f, 0.524650156f},
std::array<float,2>{0.0861809552f, 0.0363583826f},
std::array<float,2>{0.45325613f, 0.572714984f},
std::array<float,2>{0.637186944f, 0.104399949f},
std::array<float,2>{0.924885333f, 0.996131241f},
std::array<float,2>{0.181675822f, 0.336746156f},
std::array<float,2>{0.0429695956f, 0.764970958f},
std::array<float,2>{0.816810489f, 0.496132821f},
std::array<float,2>{0.500040293f, 0.72611779f},
std::array<float,2>{0.32800132f, 0.217818707f},
std::array<float,2>{0.117075115f, 0.546728253f},
std::array<float,2>{0.773234069f, 0.0234574266f},
std::array<float,2>{0.61483109f, 0.923043787f},
std::array<float,2>{0.268917143f, 0.292104661f},
std::array<float,2>{0.403369933f, 0.833701134f},
std::array<float,2>{0.727993965f, 0.385695934f},
std::array<float,2>{0.969537854f, 0.643620551f},
std::array<float,2>{0.189462617f, 0.144147724f},
std::array<float,2>{0.363894194f, 0.701736569f},
std::array<float,2>{0.55121243f, 0.240450695f},
std::array<float,2>{0.850582838f, 0.804977655f},
std::array<float,2>{0.0183366258f, 0.451224715f},
std::array<float,2>{0.129502848f, 0.961287856f},
std::array<float,2>{0.904059887f, 0.368861109f},
std::array<float,2>{0.682823718f, 0.617994666f},
std::array<float,2>{0.496241003f, 0.0797935575f},
std::array<float,2>{0.0123889949f, 0.738103628f},
std::array<float,2>{0.868696094f, 0.195557326f},
std::array<float,2>{0.545740128f, 0.769993305f},
std::array<float,2>{0.357985586f, 0.473159581f},
std::array<float,2>{0.477347583f, 0.97875607f},
std::array<float,2>{0.667345583f, 0.327719152f},
std::array<float,2>{0.878333807f, 0.587323844f},
std::array<float,2>{0.154399887f, 0.113860793f},
std::array<float,2>{0.262790799f, 0.506552815f},
std::array<float,2>{0.604467511f, 0.0595012903f},
std::array<float,2>{0.758004427f, 0.879553974f},
std::array<float,2>{0.0938281789f, 0.266924798f},
std::array<float,2>{0.215201169f, 0.871902287f},
std::array<float,2>{0.984707773f, 0.423148781f},
std::array<float,2>{0.740140796f, 0.676416516f},
std::array<float,2>{0.388376266f, 0.185115874f},
std::array<float,2>{0.171792477f, 0.5976758f},
std::array<float,2>{0.907753229f, 0.0649792328f},
std::array<float,2>{0.656072438f, 0.948198557f},
std::array<float,2>{0.444215089f, 0.352431536f},
std::array<float,2>{0.32915163f, 0.788270652f},
std::array<float,2>{0.528372109f, 0.459258169f},
std::array<float,2>{0.837271392f, 0.709498107f},
std::array<float,2>{0.0484775007f, 0.222163469f},
std::array<float,2>{0.435107112f, 0.626204789f},
std::array<float,2>{0.715209603f, 0.133827448f},
std::array<float,2>{0.9385795f, 0.817133546f},
std::array<float,2>{0.222084612f, 0.400698036f},
std::array<float,2>{0.0743567795f, 0.911792338f},
std::array<float,2>{0.802231848f, 0.302775472f},
std::array<float,2>{0.57755506f, 0.559847295f},
std::array<float,2>{0.2968961f, 0.00848079473f},
std::array<float,2>{0.198353618f, 0.705350041f},
std::array<float,2>{0.977547228f, 0.225303814f},
std::array<float,2>{0.724888444f, 0.784558475f},
std::array<float,2>{0.393895268f, 0.456056207f},
std::array<float,2>{0.28104195f, 0.952279747f},
std::array<float,2>{0.620368898f, 0.357308924f},
std::array<float,2>{0.776543021f, 0.596955597f},
std::array<float,2>{0.118027993f, 0.0701151192f},
std::array<float,2>{0.486973405f, 0.556323051f},
std::array<float,2>{0.677076757f, 0.0154091856f},
std::array<float,2>{0.893863916f, 0.909223974f},
std::array<float,2>{0.134517983f, 0.29848516f},
std::array<float,2>{0.0273625031f, 0.814441442f},
std::array<float,2>{0.853539109f, 0.40285489f},
std::array<float,2>{0.559447348f, 0.632733822f},
std::array<float,2>{0.372381538f, 0.137204379f},
std::array<float,2>{0.0851033553f, 0.593471467f},
std::array<float,2>{0.783750057f, 0.111253001f},
std::array<float,2>{0.58045423f, 0.984254301f},
std::array<float,2>{0.294791579f, 0.320319474f},
std::array<float,2>{0.410232544f, 0.767269731f},
std::array<float,2>{0.700003088f, 0.470097244f},
std::array<float,2>{0.954560816f, 0.738585651f},
std::array<float,2>{0.245417461f, 0.202207223f},
std::array<float,2>{0.313123345f, 0.672799885f},
std::array<float,2>{0.508530319f, 0.182811007f},
std::array<float,2>{0.821426272f, 0.869554043f},
std::array<float,2>{0.0358752906f, 0.428814858f},
std::array<float,2>{0.173033819f, 0.8752473f},
std::array<float,2>{0.937126279f, 0.271924198f},
std::array<float,2>{0.63171339f, 0.500071228f},
std::array<float,2>{0.464847565f, 0.0583661757f},
std::array<float,2>{0.0581922345f, 0.647583246f},
std::array<float,2>{0.833968937f, 0.146958604f},
std::array<float,2>{0.516410232f, 0.830939531f},
std::array<float,2>{0.339375556f, 0.387794256f},
std::array<float,2>{0.452631921f, 0.926061571f},
std::array<float,2>{0.64384377f, 0.296162844f},
std::array<float,2>{0.914115846f, 0.540435672f},
std::array<float,2>{0.160645291f, 0.0292402525f},
std::array<float,2>{0.307932764f, 0.623484075f},
std::array<float,2>{0.56684655f, 0.0848862901f},
std::array<float,2>{0.805402458f, 0.965060115f},
std::array<float,2>{0.0663034841f, 0.37137863f},
std::array<float,2>{0.228042364f, 0.809786975f},
std::array<float,2>{0.950029552f, 0.446656108f},
std::array<float,2>{0.70848465f, 0.698037088f},
std::array<float,2>{0.423976451f, 0.236823723f},
std::array<float,2>{0.145672172f, 0.529311538f},
std::array<float,2>{0.890387833f, 0.035143245f},
std::array<float,2>{0.657497227f, 0.897174776f},
std::array<float,2>{0.474128187f, 0.253154904f},
std::array<float,2>{0.345447183f, 0.846111774f},
std::array<float,2>{0.532909453f, 0.411477119f},
std::array<float,2>{0.859765947f, 0.660994947f},
std::array<float,2>{0.00364842871f, 0.166557372f},
std::array<float,2>{0.382030278f, 0.722050011f},
std::array<float,2>{0.746892333f, 0.213481292f},
std::array<float,2>{0.994965911f, 0.759750009f},
std::array<float,2>{0.208026141f, 0.49407354f},
std::array<float,2>{0.103889287f, 0.992439508f},
std::array<float,2>{0.751292109f, 0.339870304f},
std::array<float,2>{0.599798381f, 0.574478805f},
std::array<float,2>{0.256655425f, 0.109061502f},
std::array<float,2>{0.166375563f, 0.664063334f},
std::array<float,2>{0.912704289f, 0.161428586f},
std::array<float,2>{0.650660634f, 0.856903553f},
std::array<float,2>{0.438272446f, 0.418838978f},
std::array<float,2>{0.335522532f, 0.899503589f},
std::array<float,2>{0.52529335f, 0.264628053f},
std::array<float,2>{0.839854419f, 0.519900918f},
std::array<float,2>{0.0541126542f, 0.0396946296f},
std::array<float,2>{0.430312037f, 0.568338335f},
std::array<float,2>{0.713883102f, 0.100008525f},
std::array<float,2>{0.943300426f, 0.985150695f},
std::array<float,2>{0.225419447f, 0.334620178f},
std::array<float,2>{0.0719853565f, 0.756938696f},
std::array<float,2>{0.796989143f, 0.488899142f},
std::array<float,2>{0.571714342f, 0.733163118f},
std::array<float,2>{0.303210616f, 0.205823958f},
std::array<float,2>{0.00945513882f, 0.533566475f},
std::array<float,2>{0.872899532f, 0.0198053457f},
std::array<float,2>{0.542484343f, 0.934687555f},
std::array<float,2>{0.352872282f, 0.283866525f},
std::array<float,2>{0.481636167f, 0.839624286f},
std::array<float,2>{0.671268582f, 0.381634861f},
std::array<float,2>{0.879456222f, 0.652939618f},
std::array<float,2>{0.150470152f, 0.153855875f},
std::array<float,2>{0.260986149f, 0.689521074f},
std::array<float,2>{0.609246492f, 0.247034937f},
std::array<float,2>{0.765197277f, 0.798470497f},
std::array<float,2>{0.100434341f, 0.444088608f},
std::array<float,2>{0.212244958f, 0.953431487f},
std::array<float,2>{0.991885364f, 0.361154377f},
std::array<float,2>{0.73496294f, 0.60996592f},
std::array<float,2>{0.383426607f, 0.087129809f},
std::array<float,2>{0.111551441f, 0.74648726f},
std::array<float,2>{0.766311824f, 0.189456284f},
std::array<float,2>{0.612913191f, 0.77499181f},
std::array<float,2>{0.270748556f, 0.476603389f},
std::array<float,2>{0.399494827f, 0.970330596f},
std::array<float,2>{0.734219968f, 0.31909737f},
std::array<float,2>{0.973746777f, 0.581094921f},
std::array<float,2>{0.195291698f, 0.121878207f},
std::array<float,2>{0.361719519f, 0.514372826f},
std::array<float,2>{0.547782958f, 0.0515670627f},
std::array<float,2>{0.844028056f, 0.88635391f},
std::array<float,2>{0.0230330061f, 0.279949039f},
std::array<float,2>{0.127074778f, 0.862742841f},
std::array<float,2>{0.899412632f, 0.433597118f},
std::array<float,2>{0.686952651f, 0.682905853f},
std::array<float,2>{0.492378682f, 0.172838926f},
std::array<float,2>{0.241082609f, 0.60608989f},
std::array<float,2>{0.965220571f, 0.0769272968f},
std::array<float,2>{0.687539399f, 0.937658191f},
std::array<float,2>{0.417334795f, 0.350808114f},
std::array<float,2>{0.28389594f, 0.790737092f},
std::array<float,2>{0.5875687f, 0.468415916f},
std::array<float,2>{0.794971585f, 0.718454897f},
std::array<float,2>{0.0921529382f, 0.23378849f},
std::array<float,2>{0.46075201f, 0.639607906f},
std::array<float,2>{0.633591235f, 0.128144324f},
std::array<float,2>{0.928544343f, 0.82159102f},
std::array<float,2>{0.185927093f, 0.397624224f},
std::array<float,2>{0.0428310968f, 0.919408679f},
std::array<float,2>{0.814981222f, 0.310393184f},
std::array<float,2>{0.507084072f, 0.553271949f},
std::array<float,2>{0.323779017f, 0.00620458508f},
std::array<float,2>{0.138425902f, 0.72934413f},
std::array<float,2>{0.894721508f, 0.207382053f},
std::array<float,2>{0.675161958f, 0.751957774f},
std::array<float,2>{0.49205178f, 0.48497653f},
std::array<float,2>{0.367403358f, 0.9891119f},
std::array<float,2>{0.558354437f, 0.328415394f},
std::array<float,2>{0.856871188f, 0.562684357f},
std::array<float,2>{0.0272230543f, 0.0956414714f},
std::array<float,2>{0.397002637f, 0.519032121f},
std::array<float,2>{0.719166636f, 0.0466850176f},
std::array<float,2>{0.981594026f, 0.905084491f},
std::array<float,2>{0.202349648f, 0.260096133f},
std::array<float,2>{0.121587291f, 0.852242887f},
std::array<float,2>{0.77937597f, 0.414375186f},
std::array<float,2>{0.624831438f, 0.669763744f},
std::array<float,2>{0.273439854f, 0.159081265f},
std::array<float,2>{0.0333437361f, 0.613649309f},
std::array<float,2>{0.826896191f, 0.0916245133f},
std::array<float,2>{0.512130141f, 0.957691014f},
std::array<float,2>{0.316540569f, 0.364385813f},
std::array<float,2>{0.464466512f, 0.80394417f},
std::array<float,2>{0.626043916f, 0.441232204f},
std::array<float,2>{0.931726873f, 0.69344914f},
std::array<float,2>{0.177975804f, 0.244418055f},
std::array<float,2>{0.289656699f, 0.65198493f},
std::array<float,2>{0.582499206f, 0.15027222f},
std::array<float,2>{0.788241565f, 0.841341972f},
std::array<float,2>{0.079035677f, 0.375526875f},
std::array<float,2>{0.248293743f, 0.931526005f},
std::array<float,2>{0.957994461f, 0.288057685f},
std::array<float,2>{0.696400166f, 0.537968516f},
std::array<float,2>{0.406309873f, 0.0165430326f},
std::array<float,2>{0.0679653436f, 0.684071898f},
std::array<float,2>{0.81015408f, 0.176118642f},
std::array<float,2>{0.562678933f, 0.866719902f},
std::array<float,2>{0.31086728f, 0.431108177f},
std::array<float,2>{0.427851349f, 0.887146592f},
std::array<float,2>{0.705088198f, 0.277139634f},
std::array<float,2>{0.945932388f, 0.511170328f},
std::array<float,2>{0.231492788f, 0.0506841987f},
std::array<float,2>{0.341667801f, 0.583524227f},
std::array<float,2>{0.520363629f, 0.11954999f},
std::array<float,2>{0.830456674f, 0.975054801f},
std::array<float,2>{0.0587947965f, 0.314109594f},
std::array<float,2>{0.156545743f, 0.780775726f},
std::array<float,2>{0.9209342f, 0.481921256f},
std::array<float,2>{0.647974193f, 0.745482445f},
std::array<float,2>{0.445472062f, 0.192279831f},
std::array<float,2>{0.20406422f, 0.550323963f},
std::array<float,2>{0.999302924f, 0.00307429675f},
std::array<float,2>{0.742599845f, 0.917119443f},
std::array<float,2>{0.375498086f, 0.305851936f},
std::array<float,2>{0.253208011f, 0.825610697f},
std::array<float,2>{0.594528437f, 0.392264128f},
std::array<float,2>{0.755131364f, 0.636311769f},
std::array<float,2>{0.106929034f, 0.132233173f},
std::array<float,2>{0.470763713f, 0.714264393f},
std::array<float,2>{0.660809278f, 0.230053991f},
std::array<float,2>{0.884679735f, 0.794676423f},
std::array<float,2>{0.141983509f, 0.463615626f},
std::array<float,2>{0.00576416496f, 0.943493307f},
std::array<float,2>{0.867061377f, 0.346931159f},
std::array<float,2>{0.538762927f, 0.604147077f},
std::array<float,2>{0.351433963f, 0.0718373433f},
std::array<float,2>{0.22137928f, 0.627169132f},
std::array<float,2>{0.938091397f, 0.136678979f},
std::array<float,2>{0.716186464f, 0.81980443f},
std::array<float,2>{0.434225023f, 0.399159163f},
std::array<float,2>{0.298823565f, 0.912542403f},
std::array<float,2>{0.576243401f, 0.301015109f},
std::array<float,2>{0.801096559f, 0.561006367f},
std::array<float,2>{0.0757329091f, 0.00978708547f},
std::array<float,2>{0.444561988f, 0.600515962f},
std::array<float,2>{0.654433966f, 0.0635691583f},
std::array<float,2>{0.906464577f, 0.947085917f},
std::array<float,2>{0.170128137f, 0.354228616f},
std::array<float,2>{0.0472456217f, 0.785315335f},
std::array<float,2>{0.836328804f, 0.457959443f},
std::array<float,2>{0.52820152f, 0.707498848f},
std::array<float,2>{0.329058379f, 0.21949999f},
std::array<float,2>{0.0952759832f, 0.505185366f},
std::array<float,2>{0.759320855f, 0.0615687147f},
std::array<float,2>{0.605199277f, 0.881360829f},
std::array<float,2>{0.262651801f, 0.267836392f},
std::array<float,2>{0.386819601f, 0.873510718f},
std::array<float,2>{0.738980114f, 0.4250561f},
std::array<float,2>{0.985915482f, 0.678595364f},
std::array<float,2>{0.216233373f, 0.18603155f},
std::array<float,2>{0.358517021f, 0.735251665f},
std::array<float,2>{0.546186924f, 0.198819935f},
std::array<float,2>{0.867381155f, 0.772350132f},
std::array<float,2>{0.0133275464f, 0.47481066f},
std::array<float,2>{0.155512422f, 0.978120744f},
std::array<float,2>{0.877741098f, 0.325943381f},
std::array<float,2>{0.666917026f, 0.589565873f},
std::array<float,2>{0.478039175f, 0.116433077f},
std::array<float,2>{0.0192628242f, 0.700333655f},
std::array<float,2>{0.851330698f, 0.238759339f},
std::array<float,2>{0.551778913f, 0.80834341f},
std::array<float,2>{0.365206093f, 0.450650454f},
std::array<float,2>{0.497677624f, 0.964593112f},
std::array<float,2>{0.682450831f, 0.371042013f},
std::array<float,2>{0.903259039f, 0.620950878f},
std::array<float,2>{0.130574539f, 0.0818475336f},
std::array<float,2>{0.267653763f, 0.544821978f},
std::array<float,2>{0.613858461f, 0.0258654561f},
std::array<float,2>{0.772010028f, 0.924349606f},
std::array<float,2>{0.11568778f, 0.29001826f},
std::array<float,2>{0.19104743f, 0.835596979f},
std::array<float,2>{0.97015655f, 0.384508878f},
std::array<float,2>{0.727180719f, 0.641701162f},
std::array<float,2>{0.403219491f, 0.140696049f},
std::array<float,2>{0.183481634f, 0.571125865f},
std::array<float,2>{0.924632967f, 0.102980211f},
std::array<float,2>{0.638521552f, 0.99966681f},
std::array<float,2>{0.454971105f, 0.337998211f},
std::array<float,2>{0.32651031f, 0.762612045f},
std::array<float,2>{0.50132978f, 0.49931109f},
std::array<float,2>{0.818273365f, 0.723840952f},
std::array<float,2>{0.043959666f, 0.214846849f},
std::array<float,2>{0.420917809f, 0.659234881f},
std::array<float,2>{0.694456816f, 0.169646785f},
std::array<float,2>{0.962756097f, 0.851280749f},
std::array<float,2>{0.236881346f, 0.408765495f},
std::array<float,2>{0.0872652233f, 0.894180894f},
std::array<float,2>{0.792125821f, 0.256937027f},
std::array<float,2>{0.592701972f, 0.525878429f},
std::array<float,2>{0.285705596f, 0.0388379656f},
std::array<float,2>{0.242791981f, 0.742120385f},
std::array<float,2>{0.955154538f, 0.199446052f},
std::array<float,2>{0.701287627f, 0.768465698f},
std::array<float,2>{0.412846446f, 0.472580522f},
std::array<float,2>{0.296634287f, 0.981830418f},
std::array<float,2>{0.579833865f, 0.323571533f},
std::array<float,2>{0.782436609f, 0.590551257f},
std::array<float,2>{0.0828887224f, 0.111811943f},
std::array<float,2>{0.467810124f, 0.502863824f},
std::array<float,2>{0.630856276f, 0.055326324f},
std::array<float,2>{0.934631407f, 0.878294408f},
std::array<float,2>{0.174579248f, 0.269910693f},
std::array<float,2>{0.0376116559f, 0.867613733f},
std::array<float,2>{0.824198544f, 0.427137583f},
std::array<float,2>{0.511481822f, 0.674100578f},
std::array<float,2>{0.315474033f, 0.179826647f},
std::array<float,2>{0.120191082f, 0.59446609f},
std::array<float,2>{0.773820758f, 0.0675684959f},
std::array<float,2>{0.618604898f, 0.949377894f},
std::array<float,2>{0.279159188f, 0.357540011f},
std::array<float,2>{0.390635312f, 0.782185018f},
std::array<float,2>{0.722788393f, 0.454897076f},
std::array<float,2>{0.980154276f, 0.704720497f},
std::array<float,2>{0.195719898f, 0.222666398f},
std::array<float,2>{0.373426497f, 0.630590737f},
std::array<float,2>{0.560795069f, 0.13907142f},
std::array<float,2>{0.85163784f, 0.814610064f},
std::array<float,2>{0.0299052056f, 0.404980391f},
std::array<float,2>{0.135818481f, 0.907034755f},
std::array<float,2>{0.892332971f, 0.299606383f},
std::array<float,2>{0.678363264f, 0.557296097f},
std::array<float,2>{0.48585251f, 0.0123286471f},
std::array<float,2>{0.00149106549f, 0.66323477f},
std::array<float,2>{0.862353027f, 0.165640458f},
std::array<float,2>{0.534538805f, 0.844163656f},
std::array<float,2>{0.347073585f, 0.413327605f},
std::array<float,2>{0.475852042f, 0.895248353f},
std::array<float,2>{0.65911144f, 0.25029406f},
std::array<float,2>{0.888244808f, 0.528619528f},
std::array<float,2>{0.147818446f, 0.0329032727f},
std::array<float,2>{0.254048735f, 0.576619506f},
std::array<float,2>{0.599475384f, 0.105856508f},
std::array<float,2>{0.753123283f, 0.994272172f},
std::array<float,2>{0.102757961f, 0.342596233f},
std::array<float,2>{0.21028693f, 0.761661112f},
std::array<float,2>{0.993424475f, 0.495298326f},
std::array<float,2>{0.749016523f, 0.720687032f},
std::array<float,2>{0.379131883f, 0.21102646f},
std::array<float,2>{0.162502989f, 0.542443573f},
std::array<float,2>{0.917814434f, 0.030742256f},
std::array<float,2>{0.640682697f, 0.929650009f},
std::array<float,2>{0.451157868f, 0.294678271f},
std::array<float,2>{0.3361184f, 0.82893312f},
std::array<float,2>{0.51863265f, 0.389610261f},
std::array<float,2>{0.834457219f, 0.644886196f},
std::array<float,2>{0.05575395f, 0.146240041f},
std::array<float,2>{0.421972632f, 0.696355462f},
std::array<float,2>{0.710522413f, 0.23529689f},
std::array<float,2>{0.951606214f, 0.811581969f},
std::array<float,2>{0.230448991f, 0.44920069f},
std::array<float,2>{0.0628052801f, 0.968414068f},
std::array<float,2>{0.807561219f, 0.37330988f},
std::array<float,2>{0.569074869f, 0.621737123f},
std::array<float,2>{0.304947913f, 0.0820510313f},
std::array<float,2>{0.148476794f, 0.655953526f},
std::array<float,2>{0.881060541f, 0.154908508f},
std::array<float,2>{0.668206155f, 0.836868465f},
std::array<float,2>{0.482720017f, 0.379858017f},
std::array<float,2>{0.353617072f, 0.936368346f},
std::array<float,2>{0.539360225f, 0.283008754f},
std::array<float,2>{0.873062789f, 0.531300664f},
std::array<float,2>{0.0115441252f, 0.0230156127f},
std::array<float,2>{0.38659665f, 0.612578273f},
std::array<float,2>{0.736863017f, 0.0890674293f},
std::array<float,2>{0.988411427f, 0.956217885f},
std::array<float,2>{0.213264629f, 0.361523241f},
std::array<float,2>{0.0978882462f, 0.799464583f},
std::array<float,2>{0.763291299f, 0.441515326f},
std::array<float,2>{0.60636276f, 0.687627673f},
std::array<float,2>{0.258146614f, 0.249046281f},
std::array<float,2>{0.0508700348f, 0.522789121f},
std::array<float,2>{0.842144549f, 0.0415820107f},
std::array<float,2>{0.526096225f, 0.900894046f},
std::array<float,2>{0.333108455f, 0.261897326f},
std::array<float,2>{0.440159202f, 0.857773066f},
std::array<float,2>{0.649486899f, 0.420517713f},
std::array<float,2>{0.911550939f, 0.667700589f},
std::array<float,2>{0.164420351f, 0.163605869f},
std::array<float,2>{0.300810635f, 0.731802583f},
std::array<float,2>{0.573197842f, 0.204376757f},
std::array<float,2>{0.799890101f, 0.755654693f},
std::array<float,2>{0.0722996071f, 0.491484344f},
std::array<float,2>{0.224424779f, 0.988043845f},
std::array<float,2>{0.945184529f, 0.332700968f},
std::array<float,2>{0.711776316f, 0.569155693f},
std::array<float,2>{0.43244499f, 0.099093549f},
std::array<float,2>{0.0901926607f, 0.716198921f},
std::array<float,2>{0.793058991f, 0.23115696f},
std::array<float,2>{0.589428425f, 0.791854143f},
std::array<float,2>{0.282750338f, 0.464915246f},
std::array<float,2>{0.415350199f, 0.93948859f},
std::array<float,2>{0.689616561f, 0.347789139f},
std::array<float,2>{0.967331767f, 0.608663619f},
std::array<float,2>{0.238721013f, 0.0743105933f},
std::array<float,2>{0.320988089f, 0.551601827f},
std::array<float,2>{0.504053771f, 0.00482521439f},
std::array<float,2>{0.813021839f, 0.921622932f},
std::array<float,2>{0.0399984717f, 0.31084767f},
std::array<float,2>{0.184347704f, 0.823897004f},
std::array<float,2>{0.926791608f, 0.396387756f},
std::array<float,2>{0.636148632f, 0.636797249f},
std::array<float,2>{0.457479805f, 0.126618564f},
std::array<float,2>{0.191539094f, 0.579126894f},
std::array<float,2>{0.975152075f, 0.12423414f},
std::array<float,2>{0.731524229f, 0.970994353f},
std::array<float,2>{0.400911599f, 0.317227811f},
std::array<float,2>{0.271602631f, 0.775540113f},
std::array<float,2>{0.609942913f, 0.479144186f},
std::array<float,2>{0.767849028f, 0.748777926f},
std::array<float,2>{0.110821061f, 0.189305916f},
std::array<float,2>{0.49499324f, 0.680685699f},
std::array<float,2>{0.684896111f, 0.174634606f},
std::array<float,2>{0.900646269f, 0.861034572f},
std::array<float,2>{0.126680121f, 0.435792804f},
std::array<float,2>{0.0205540899f, 0.882973492f},
std::array<float,2>{0.847479582f, 0.278833836f},
std::array<float,2>{0.549363852f, 0.512612343f},
std::array<float,2>{0.360746771f, 0.0530666038f},
std::array<float,2>{0.175918445f, 0.693093777f},
std::array<float,2>{0.931509018f, 0.243771791f},
std::array<float,2>{0.628005028f, 0.80208391f},
std::array<float,2>{0.461044997f, 0.438103318f},
std::array<float,2>{0.319248617f, 0.960047305f},
std::array<float,2>{0.513697863f, 0.366243243f},
std::array<float,2>{0.824493647f, 0.616742015f},
std::array<float,2>{0.031390164f, 0.0933844522f},
std::array<float,2>{0.409077168f, 0.535744786f},
std::array<float,2>{0.699039996f, 0.0182803199f},
std::array<float,2>{0.960353434f, 0.932968676f},
std::array<float,2>{0.246638507f, 0.28549993f},
std::array<float,2>{0.0807534084f, 0.842149734f},
std::array<float,2>{0.786434412f, 0.378586829f},
std::array<float,2>{0.585286677f, 0.648676157f},
std::array<float,2>{0.291968256f, 0.151392028f},
std::array<float,2>{0.0253385361f, 0.566256881f},
std::array<float,2>{0.859025657f, 0.0974675566f},
std::array<float,2>{0.554962337f, 0.990661204f},
std::array<float,2>{0.370138437f, 0.331698626f},
std::array<float,2>{0.4887743f, 0.751286209f},
std::array<float,2>{0.673309565f, 0.486339211f},
std::array<float,2>{0.898211837f, 0.726577342f},
std::array<float,2>{0.139979854f, 0.21009469f},
std::array<float,2>{0.276138633f, 0.671786487f},
std::array<float,2>{0.622616529f, 0.157089397f},
std::array<float,2>{0.778219342f, 0.855231047f},
std::array<float,2>{0.124004953f, 0.417583257f},
std::array<float,2>{0.199948341f, 0.903153002f},
std::array<float,2>{0.9830001f, 0.259581447f},
std::array<float,2>{0.721178055f, 0.517049432f},
std::array<float,2>{0.395016223f, 0.0432354212f},
std::array<float,2>{0.108302549f, 0.634608805f},
std::array<float,2>{0.756195724f, 0.129172549f},
std::array<float,2>{0.597282112f, 0.826989233f},
std::array<float,2>{0.250636965f, 0.393838674f},
std::array<float,2>{0.377607673f, 0.914835215f},
std::array<float,2>{0.744908571f, 0.306712478f},
std::array<float,2>{0.997681856f, 0.547745705f},
std::array<float,2>{0.206257582f, 0.00124672067f},
std::array<float,2>{0.347821712f, 0.602924585f},
std::array<float,2>{0.535531104f, 0.0739940703f},
std::array<float,2>{0.864638448f, 0.94332546f},
std::array<float,2>{0.00608697487f, 0.344857454f},
std::array<float,2>{0.144491106f, 0.795526922f},
std::array<float,2>{0.885281503f, 0.462103307f},
std::array<float,2>{0.662568867f, 0.71155262f},
std::array<float,2>{0.469504654f, 0.22770083f},
std::array<float,2>{0.233234733f, 0.509381115f},
std::array<float,2>{0.949145615f, 0.0483776368f},
std::array<float,2>{0.703289449f, 0.890007079f},
std::array<float,2>{0.427132219f, 0.274615616f},
std::array<float,2>{0.308788359f, 0.865222454f},
std::array<float,2>{0.564776659f, 0.433096826f},
std::array<float,2>{0.810959578f, 0.687231362f},
std::array<float,2>{0.0696718395f, 0.179674566f},
std::array<float,2>{0.447281063f, 0.743160248f},
std::array<float,2>{0.64475894f, 0.194977731f},
std::array<float,2>{0.919010043f, 0.778151095f},
std::array<float,2>{0.158708185f, 0.483831227f},
std::array<float,2>{0.0616695024f, 0.973937154f},
std::array<float,2>{0.828360021f, 0.314827979f},
std::array<float,2>{0.523291349f, 0.585264802f},
std::array<float,2>{0.341943473f, 0.118437253f},
std::array<float,2>{0.218546361f, 0.677212238f},
std::array<float,2>{0.986721992f, 0.184006572f},
std::array<float,2>{0.740788281f, 0.872193158f},
std::array<float,2>{0.3895742f, 0.422763437f},
std::array<float,2>{0.265034914f, 0.880363464f},
std::array<float,2>{0.601945817f, 0.266079396f},
std::array<float,2>{0.759911537f, 0.507666767f},
std::array<float,2>{0.0976196751f, 0.0602381043f},
std::array<float,2>{0.479317933f, 0.585978806f},
std::array<float,2>{0.664372623f, 0.11509905f},
std::array<float,2>{0.87551868f, 0.979967058f},
std::array<float,2>{0.152415246f, 0.326800019f},
std::array<float,2>{0.0150308097f, 0.770561278f},
std::array<float,2>{0.869978011f, 0.47458455f},
std::array<float,2>{0.543108165f, 0.736880004f},
std::array<float,2>{0.356891662f, 0.196841642f},
std::array<float,2>{0.0767678916f, 0.559311271f},
std::array<float,2>{0.804019153f, 0.00965047907f},
std::array<float,2>{0.574713111f, 0.910352528f},
std::array<float,2>{0.299004704f, 0.304289341f},
std::array<float,2>{0.437047899f, 0.817623377f},
std::array<float,2>{0.718320906f, 0.401382476f},
std::array<float,2>{0.939487576f, 0.625316083f},
std::array<float,2>{0.2197247f, 0.133782387f},
std::array<float,2>{0.331703603f, 0.710364163f},
std::array<float,2>{0.530058086f, 0.221244007f},
std::array<float,2>{0.839769065f, 0.787349641f},
std::array<float,2>{0.0498480275f, 0.460071325f},
std::array<float,2>{0.169370145f, 0.949012935f},
std::array<float,2>{0.908441663f, 0.353073895f},
std::array<float,2>{0.653892517f, 0.599016488f},
std::array<float,2>{0.443083942f, 0.0658430457f},
std::array<float,2>{0.0449291803f, 0.724970996f},
std::array<float,2>{0.818415999f, 0.217340454f},
std::array<float,2>{0.502677321f, 0.764202297f},
std::array<float,2>{0.325403094f, 0.497745574f},
std::array<float,2>{0.456689745f, 0.997792482f},
std::array<float,2>{0.640285671f, 0.336967111f},
std::array<float,2>{0.922581792f, 0.574039638f},
std::array<float,2>{0.180159599f, 0.104681805f},
std::array<float,2>{0.287967801f, 0.523862064f},
std::array<float,2>{0.591078639f, 0.0360857323f},
std::array<float,2>{0.790205479f, 0.891679585f},
std::array<float,2>{0.0892919227f, 0.25530526f},
std::array<float,2>{0.235835716f, 0.849219441f},
std::array<float,2>{0.963761032f, 0.407731503f},
std::array<float,2>{0.693111062f, 0.658062398f},
std::array<float,2>{0.419875234f, 0.170573354f},
std::array<float,2>{0.132369965f, 0.618761659f},
std::array<float,2>{0.905879617f, 0.0786823183f},
std::array<float,2>{0.6814996f, 0.962706149f},
std::array<float,2>{0.498564899f, 0.367587119f},
std::array<float,2>{0.366105765f, 0.806013107f},
std::array<float,2>{0.553330183f, 0.453015298f},
std::array<float,2>{0.848799586f, 0.70259732f},
std::array<float,2>{0.0159114096f, 0.241540223f},
std::array<float,2>{0.404881477f, 0.643272758f},
std::array<float,2>{0.72868526f, 0.143297076f},
std::array<float,2>{0.97254777f, 0.83294028f},
std::array<float,2>{0.188193768f, 0.386292964f},
std::array<float,2>{0.114502259f, 0.92196095f},
std::array<float,2>{0.770982921f, 0.29179737f},
std::array<float,2>{0.615850747f, 0.545744121f},
std::array<float,2>{0.266677439f, 0.0248108059f},
std::array<float,2>{0.239213124f, 0.718201995f},
std::array<float,2>{0.966898203f, 0.233918145f},
std::array<float,2>{0.690142095f, 0.790497065f},
std::array<float,2>{0.415875733f, 0.468133003f},
std::array<float,2>{0.282357603f, 0.938373864f},
std::array<float,2>{0.589269519f, 0.351545334f},
std::array<float,2>{0.793503523f, 0.605835557f},
std::array<float,2>{0.090415217f, 0.0763933733f},
std::array<float,2>{0.457675189f, 0.553187013f},
std::array<float,2>{0.636634946f, 0.00670744525f},
std::array<float,2>{0.927343726f, 0.919706762f},
std::array<float,2>{0.183627978f, 0.309962064f},
std::array<float,2>{0.0394527838f, 0.822019637f},
std::array<float,2>{0.812760055f, 0.398171335f},
std::array<float,2>{0.504679024f, 0.638965487f},
std::array<float,2>{0.3206321f, 0.128720075f},
std::array<float,2>{0.110896863f, 0.58158201f},
std::array<float,2>{0.768291414f, 0.121575885f},
std::array<float,2>{0.609472096f, 0.970210135f},
std::array<float,2>{0.272384346f, 0.318625242f},
std::array<float,2>{0.400663108f, 0.774803698f},
std::array<float,2>{0.731939375f, 0.477181047f},
std::array<float,2>{0.974668384f, 0.74682641f},
std::array<float,2>{0.192176789f, 0.190171003f},
std::array<float,2>{0.360978544f, 0.683312237f},
std::array<float,2>{0.549245656f, 0.172240213f},
std::array<float,2>{0.847077131f, 0.863273144f},
std::array<float,2>{0.0211492665f, 0.434280455f},
std::array<float,2>{0.126205415f, 0.885759413f},
std::array<float,2>{0.900907576f, 0.279337496f},
std::array<float,2>{0.685096443f, 0.513999641f},
std::array<float,2>{0.494475812f, 0.0510785319f},
std::array<float,2>{0.0109835695f, 0.652401149f},
std::array<float,2>{0.873646677f, 0.153767273f},
std::array<float,2>{0.539703548f, 0.839077055f},
std::array<float,2>{0.354203582f, 0.381075561f},
std::array<float,2>{0.483073831f, 0.935480714f},
std::array<float,2>{0.668824136f, 0.283488572f},
std::array<float,2>{0.881450236f, 0.534150302f},
std::array<float,2>{0.148960546f, 0.0202034954f},
std::array<float,2>{0.258689761f, 0.6096012f},
std::array<float,2>{0.605554819f, 0.0876535401f},
std::array<float,2>{0.762765408f, 0.953879297f},
std::array<float,2>{0.0984109268f, 0.360822886f},
std::array<float,2>{0.213444561f, 0.798065662f},
std::array<float,2>{0.988841295f, 0.443778098f},
std::array<float,2>{0.736466467f, 0.690135717f},
std::array<float,2>{0.385868102f, 0.246121541f},
std::array<float,2>{0.164579615f, 0.520402431f},
std::array<float,2>{0.911764026f, 0.0395446941f},
std::array<float,2>{0.650192559f, 0.900103211f},
std::array<float,2>{0.43975988f, 0.263911635f},
std::array<float,2>{0.333513588f, 0.857239962f},
std::array<float,2>{0.525777757f, 0.418084502f},
std::array<float,2>{0.842432797f, 0.664900661f},
std::array<float,2>{0.0513070188f, 0.16181758f},
std::array<float,2>{0.431664467f, 0.732718349f},
std::array<float,2>{0.71111536f, 0.205165088f},
std::array<float,2>{0.944517076f, 0.757475972f},
std::array<float,2>{0.223666579f, 0.488764673f},
std::array<float,2>{0.0732097253f, 0.984597981f},
std::array<float,2>{0.800424695f, 0.334428042f},
std::array<float,2>{0.572733343f, 0.567505121f},
std::array<float,2>{0.30137378f, 0.100478493f},
std::array<float,2>{0.148215115f, 0.660593331f},
std::array<float,2>{0.887945712f, 0.166093796f},
std::array<float,2>{0.658635139f, 0.846471488f},
std::array<float,2>{0.476132482f, 0.411855817f},
std::array<float,2>{0.347452134f, 0.896886706f},
std::array<float,2>{0.534908772f, 0.253513485f},
std::array<float,2>{0.863038361f, 0.530270278f},
std::array<float,2>{0.00126229704f, 0.0346268006f},
std::array<float,2>{0.379800737f, 0.574973822f},
std::array<float,2>{0.748108983f, 0.108424492f},
std::array<float,2>{0.99372524f, 0.993134141f},
std::array<float,2>{0.210666329f, 0.340608239f},
std::array<float,2>{0.10338179f, 0.759113431f},
std::array<float,2>{0.753621817f, 0.493212581f},
std::array<float,2>{0.598932028f, 0.722444236f},
std::array<float,2>{0.254728138f, 0.213311404f},
std::array<float,2>{0.0562301688f, 0.540831447f},
std::array<float,2>{0.834759414f, 0.0287464578f},
std::array<float,2>{0.519253492f, 0.926621437f},
std::array<float,2>{0.336660326f, 0.296845824f},
std::array<float,2>{0.450255454f, 0.830335259f},
std::array<float,2>{0.64142257f, 0.388317019f},
std::array<float,2>{0.917211652f, 0.648376703f},
std::array<float,2>{0.162732095f, 0.14739731f},
std::array<float,2>{0.305550069f, 0.697515666f},
std::array<float,2>{0.568756759f, 0.236608654f},
std::array<float,2>{0.806852937f, 0.810256124f},
std::array<float,2>{0.0633601546f, 0.447088152f},
std::array<float,2>{0.22954075f, 0.965679049f},
std::array<float,2>{0.951910257f, 0.37179184f},
std::array<float,2>{0.71002984f, 0.623832226f},
std::array<float,2>{0.422739714f, 0.0841385275f},
std::array<float,2>{0.0821317509f, 0.739059985f},
std::array<float,2>{0.782768428f, 0.202645093f},
std::array<float,2>{0.579472423f, 0.766662419f},
std::array<float,2>{0.296341568f, 0.470481455f},
std::array<float,2>{0.412345737f, 0.983447552f},
std::array<float,2>{0.701839626f, 0.320899516f},
std::array<float,2>{0.955725431f, 0.593048275f},
std::array<float,2>{0.242513865f, 0.11070592f},
std::array<float,2>{0.31602484f, 0.500743389f},
std::array<float,2>{0.51079607f, 0.0578308329f},
std::array<float,2>{0.823657572f, 0.875657201f},
std::array<float,2>{0.0374514945f, 0.272275537f},
std::array<float,2>{0.173930958f, 0.869878531f},
std::array<float,2>{0.935464501f, 0.429237396f},
std::array<float,2>{0.630057752f, 0.671925604f},
std::array<float,2>{0.468671769f, 0.18350786f},
std::array<float,2>{0.196185797f, 0.597503901f},
std::array<float,2>{0.979545295f, 0.0693710819f},
std::array<float,2>{0.723277748f, 0.952716112f},
std::array<float,2>{0.391263723f, 0.356884897f},
std::array<float,2>{0.278339326f, 0.785020709f},
std::array<float,2>{0.619042397f, 0.456753731f},
std::array<float,2>{0.774220467f, 0.705586076f},
std::array<float,2>{0.121075183f, 0.224726692f},
std::array<float,2>{0.485495657f, 0.63220942f},
std::array<float,2>{0.677847207f, 0.137517437f},
std::array<float,2>{0.892015338f, 0.813638926f},
std::array<float,2>{0.136609092f, 0.402479112f},
std::array<float,2>{0.0295480918f, 0.910013199f},
std::array<float,2>{0.852468133f, 0.298081398f},
std::array<float,2>{0.561086357f, 0.556086063f},
std::array<float,2>{0.373831034f, 0.0149201276f},
std::array<float,2>{0.18065083f, 0.72421658f},
std::array<float,2>{0.922256947f, 0.215707242f},
std::array<float,2>{0.639896929f, 0.761911094f},
std::array<float,2>{0.456326425f, 0.499806821f},
std::array<float,2>{0.325722098f, 0.999110162f},
std::array<float,2>{0.502183557f, 0.338483334f},
std::array<float,2>{0.819298387f, 0.570750117f},
std::array<float,2>{0.0458126925f, 0.103366897f},
std::array<float,2>{0.419215024f, 0.526135921f},
std::array<float,2>{0.692765236f, 0.0381751098f},
std::array<float,2>{0.963283062f, 0.893589675f},
std::array<float,2>{0.236253321f, 0.257535011f},
std::array<float,2>{0.0895878896f, 0.850785553f},
std::array<float,2>{0.790987492f, 0.408386111f},
std::array<float,2>{0.591733515f, 0.660058439f},
std::array<float,2>{0.287372857f, 0.168960616f},
std::array<float,2>{0.0163675174f, 0.620296955f},
std::array<float,2>{0.849545896f, 0.0814819336f},
std::array<float,2>{0.5528543f, 0.964160621f},
std::array<float,2>{0.365274251f, 0.370220482f},
std::array<float,2>{0.498468995f, 0.808031261f},
std::array<float,2>{0.680845439f, 0.450862497f},
std::array<float,2>{0.905413687f, 0.700987041f},
std::array<float,2>{0.13207145f, 0.238972142f},
std::array<float,2>{0.267142266f, 0.64225477f},
std::array<float,2>{0.615240872f, 0.141280994f},
std::array<float,2>{0.771393776f, 0.835440159f},
std::array<float,2>{0.11513795f, 0.383836031f},
std::array<float,2>{0.187626123f, 0.924126983f},
std::array<float,2>{0.971774876f, 0.289267242f},
std::array<float,2>{0.72932446f, 0.544278145f},
std::array<float,2>{0.404770017f, 0.0261816159f},
std::array<float,2>{0.0968742594f, 0.677932143f},
std::array<float,2>{0.760624349f, 0.186443269f},
std::array<float,2>{0.602295637f, 0.87375313f},
std::array<float,2>{0.265158147f, 0.425395548f},
std::array<float,2>{0.388969779f, 0.880870104f},
std::array<float,2>{0.740283668f, 0.268271595f},
std::array<float,2>{0.987274885f, 0.505646646f},
std::array<float,2>{0.218100294f, 0.0621183254f},
std::array<float,2>{0.35704872f, 0.589126468f},
std::array<float,2>{0.543542325f, 0.116931371f},
std::array<float,2>{0.869143367f, 0.97780031f},
std::array<float,2>{0.0154579151f, 0.325242817f},
std::array<float,2>{0.153202534f, 0.771849036f},
std::array<float,2>{0.875006974f, 0.475212216f},
std::array<float,2>{0.664809942f, 0.734623075f},
std::array<float,2>{0.478726447f, 0.198512718f},
std::array<float,2>{0.219117552f, 0.561063409f},
std::array<float,2>{0.940258205f, 0.0106681976f},
std::array<float,2>{0.718030095f, 0.912972867f},
std::array<float,2>{0.436743289f, 0.30158779f},
std::array<float,2>{0.299443424f, 0.819892764f},
std::array<float,2>{0.574275494f, 0.398445219f},
std::array<float,2>{0.804338515f, 0.627904654f},
std::array<float,2>{0.0762071684f, 0.136164278f},
std::array<float,2>{0.442451388f, 0.707790554f},
std::array<float,2>{0.653335035f, 0.219022706f},
std::array<float,2>{0.908737659f, 0.785680115f},
std::array<float,2>{0.169882059f, 0.457278579f},
std::array<float,2>{0.0503452457f, 0.946536124f},
std::array<float,2>{0.839171827f, 0.353704453f},
std::array<float,2>{0.529782116f, 0.599760294f},
std::array<float,2>{0.331419498f, 0.0643877685f},
std::array<float,2>{0.206838965f, 0.635830402f},
std::array<float,2>{0.997513354f, 0.132431045f},
std::array<float,2>{0.744422019f, 0.826156974f},
std::array<float,2>{0.377303481f, 0.391808629f},
std::array<float,2>{0.250115275f, 0.917671442f},
std::array<float,2>{0.596784472f, 0.306288332f},
std::array<float,2>{0.756656349f, 0.550037801f},
std::array<float,2>{0.10787154f, 0.00382158044f},
std::array<float,2>{0.469131678f, 0.603891671f},
std::array<float,2>{0.662732184f, 0.0715479925f},
std::array<float,2>{0.884815335f, 0.943911135f},
std::array<float,2>{0.143827319f, 0.347599298f},
std::array<float,2>{0.00662930915f, 0.794298232f},
std::array<float,2>{0.865125716f, 0.463074595f},
std::array<float,2>{0.536038816f, 0.714554489f},
std::array<float,2>{0.348619312f, 0.229818016f},
std::array<float,2>{0.0698954239f, 0.511692762f},
std::array<float,2>{0.811193049f, 0.0498535819f},
std::array<float,2>{0.565036356f, 0.887541056f},
std::array<float,2>{0.309427142f, 0.276374042f},
std::array<float,2>{0.427553922f, 0.86657095f},
std::array<float,2>{0.703763783f, 0.431627631f},
std::array<float,2>{0.948564768f, 0.684389889f},
std::array<float,2>{0.232490271f, 0.176492617f},
std::array<float,2>{0.342615217f, 0.746024847f},
std::array<float,2>{0.522858322f, 0.191521764f},
std::array<float,2>{0.828895032f, 0.780641079f},
std::array<float,2>{0.0623742379f, 0.482236028f},
std::array<float,2>{0.158687845f, 0.975274622f},
std::array<float,2>{0.91954726f, 0.313747555f},
std::array<float,2>{0.645309925f, 0.583433807f},
std::array<float,2>{0.448164463f, 0.119875744f},
std::array<float,2>{0.0318350419f, 0.694097817f},
std::array<float,2>{0.825131059f, 0.244736239f},
std::array<float,2>{0.514200687f, 0.804621458f},
std::array<float,2>{0.31884712f, 0.440669954f},
std::array<float,2>{0.461482972f, 0.957408965f},
std::array<float,2>{0.628715336f, 0.365109682f},
std::array<float,2>{0.931030869f, 0.614177465f},
std::array<float,2>{0.176703587f, 0.0911220238f},
std::array<float,2>{0.291034222f, 0.537214518f},
std::array<float,2>{0.585802436f, 0.0160399266f},
std::array<float,2>{0.786915839f, 0.931152105f},
std::array<float,2>{0.080299072f, 0.287468463f},
std::array<float,2>{0.246360585f, 0.840970159f},
std::array<float,2>{0.960654378f, 0.375116944f},
std::array<float,2>{0.698555529f, 0.651690543f},
std::array<float,2>{0.408667147f, 0.149708316f},
std::array<float,2>{0.140464678f, 0.563153327f},
std::array<float,2>{0.897664189f, 0.0949208587f},
std::array<float,2>{0.673668265f, 0.98873198f},
std::array<float,2>{0.488536179f, 0.328992486f},
std::array<float,2>{0.370634794f, 0.752706528f},
std::array<float,2>{0.555380583f, 0.484771907f},
std::array<float,2>{0.858651936f, 0.728852391f},
std::array<float,2>{0.0244715698f, 0.207969263f},
std::array<float,2>{0.395481855f, 0.669068635f},
std::array<float,2>{0.721578121f, 0.158263192f},
std::array<float,2>{0.982521594f, 0.852035224f},
std::array<float,2>{0.199400872f, 0.414931208f},
std::array<float,2>{0.123464346f, 0.904708445f},
std::array<float,2>{0.777716577f, 0.260412216f},
std::array<float,2>{0.622221112f, 0.519123375f},
std::array<float,2>{0.275547385f, 0.0460608043f},
std::array<float,2>{0.194527835f, 0.748373866f},
std::array<float,2>{0.974462867f, 0.188687742f},
std::array<float,2>{0.733784437f, 0.775881052f},
std::array<float,2>{0.400031388f, 0.478771597f},
std::array<float,2>{0.271344602f, 0.97159934f},
std::array<float,2>{0.612475455f, 0.316881835f},
std::array<float,2>{0.765905976f, 0.579685748f},
std::array<float,2>{0.111990377f, 0.124798723f},
std::array<float,2>{0.49295637f, 0.512060523f},
std::array<float,2>{0.687034369f, 0.0535998717f},
std::array<float,2>{0.898441076f, 0.883405328f},
std::array<float,2>{0.127549589f, 0.278527945f},
std::array<float,2>{0.0229007471f, 0.860426605f},
std::array<float,2>{0.844617844f, 0.436341763f},
std::array<float,2>{0.546988368f, 0.681599975f},
std::array<float,2>{0.36215049f, 0.174118161f},
std::array<float,2>{0.0924067423f, 0.609000862f},
std::array<float,2>{0.795609713f, 0.0747654885f},
std::array<float,2>{0.587109089f, 0.939955294f},
std::array<float,2>{0.283400178f, 0.348519474f},
std::array<float,2>{0.417684466f, 0.791234851f},
std::array<float,2>{0.688282788f, 0.465411544f},
std::array<float,2>{0.965606034f, 0.716698527f},
std::array<float,2>{0.240467682f, 0.230507761f},
std::array<float,2>{0.323351085f, 0.637289345f},
std::array<float,2>{0.507367074f, 0.126291588f},
std::array<float,2>{0.81448561f, 0.823288202f},
std::array<float,2>{0.0420539342f, 0.395666152f},
std::array<float,2>{0.186269999f, 0.921123862f},
std::array<float,2>{0.928197563f, 0.311210185f},
std::array<float,2>{0.633165717f, 0.550957978f},
std::array<float,2>{0.460030913f, 0.00398137281f},
std::array<float,2>{0.0545352139f, 0.667369306f},
std::array<float,2>{0.840626895f, 0.163125068f},
std::array<float,2>{0.524427295f, 0.858206332f},
std::array<float,2>{0.335229456f, 0.42015785f},
std::array<float,2>{0.43776536f, 0.900408208f},
std::array<float,2>{0.651113391f, 0.262633532f},
std::array<float,2>{0.912375927f, 0.523096204f},
std::array<float,2>{0.166803032f, 0.0410335362f},
std::array<float,2>{0.303409159f, 0.568497598f},
std::array<float,2>{0.571925938f, 0.0994145125f},
std::array<float,2>{0.797781467f, 0.987770975f},
std::array<float,2>{0.0714753941f, 0.332092881f},
std::array<float,2>{0.224708393f, 0.755223811f},
std::array<float,2>{0.942835271f, 0.491931468f},
std::array<float,2>{0.714479446f, 0.73217684f},
std::array<float,2>{0.429870486f, 0.204647303f},
std::array<float,2>{0.151055112f, 0.532103062f},
std::array<float,2>{0.879229367f, 0.0226135794f},
std::array<float,2>{0.671715617f, 0.935948312f},
std::array<float,2>{0.482364714f, 0.28261742f},
std::array<float,2>{0.353387654f, 0.836320043f},
std::array<float,2>{0.542155564f, 0.379229993f},
std::array<float,2>{0.872429669f, 0.655742705f},
std::array<float,2>{0.00879595429f, 0.154462054f},
std::array<float,2>{0.382863015f, 0.688441157f},
std::array<float,2>{0.734779835f, 0.249877304f},
std::array<float,2>{0.991614699f, 0.79894495f},
std::array<float,2>{0.212788492f, 0.442163795f},
std::array<float,2>{0.0997586772f, 0.956596017f},
std::array<float,2>{0.764912963f, 0.36205858f},
std::array<float,2>{0.6086694f, 0.613044977f},
std::array<float,2>{0.261285365f, 0.0894983038f},
std::array<float,2>{0.160221472f, 0.645263255f},
std::array<float,2>{0.914886117f, 0.145592779f},
std::array<float,2>{0.644212067f, 0.828547776f},
std::array<float,2>{0.452769905f, 0.388716936f},
std::array<float,2>{0.339007735f, 0.928854108f},
std::array<float,2>{0.515759766f, 0.294429094f},
std::array<float,2>{0.833374262f, 0.542491972f},
std::array<float,2>{0.0576180816f, 0.0308535397f},
std::array<float,2>{0.424604684f, 0.621484399f},
std::array<float,2>{0.708800673f, 0.0828405172f},
std::array<float,2>{0.949259996f, 0.9680776f},
std::array<float,2>{0.227899656f, 0.373733163f},
std::array<float,2>{0.0656790286f, 0.81201601f},
std::array<float,2>{0.805121422f, 0.448400468f},
std::array<float,2>{0.566997886f, 0.697242558f},
std::array<float,2>{0.308122903f, 0.234577417f},
std::array<float,2>{0.00308411638f, 0.529051542f},
std::array<float,2>{0.860346913f, 0.0325319134f},
std::array<float,2>{0.532377124f, 0.894555748f},
std::array<float,2>{0.345039964f, 0.250880003f},
std::array<float,2>{0.473748714f, 0.844453633f},
std::array<float,2>{0.658058286f, 0.413850725f},
std::array<float,2>{0.890066504f, 0.663744986f},
std::array<float,2>{0.146249101f, 0.165245533f},
std::array<float,2>{0.256137133f, 0.719822347f},
std::array<float,2>{0.600186408f, 0.211444631f},
std::array<float,2>{0.751882315f, 0.761213541f},
std::array<float,2>{0.104342736f, 0.495729178f},
std::array<float,2>{0.20878993f, 0.994870245f},
std::array<float,2>{0.994506955f, 0.341890395f},
std::array<float,2>{0.746181965f, 0.57671392f},
std::array<float,2>{0.382520527f, 0.105971158f},
std::array<float,2>{0.117230713f, 0.704422176f},
std::array<float,2>{0.777305901f, 0.223560333f},
std::array<float,2>{0.621058047f, 0.781616032f},
std::array<float,2>{0.280432582f, 0.454280168f},
std::array<float,2>{0.394248009f, 0.950151503f},
std::array<float,2>{0.72523582f, 0.358163923f},
std::array<float,2>{0.978234649f, 0.594116688f},
std::array<float,2>{0.199193865f, 0.0680422634f},
std::array<float,2>{0.372558951f, 0.556705832f},
std::array<float,2>{0.558906555f, 0.0121432729f},
std::array<float,2>{0.854378819f, 0.906263947f},
std::array<float,2>{0.0280377939f, 0.299037904f},
std::array<float,2>{0.133951917f, 0.815324545f},
std::array<float,2>{0.894300222f, 0.40434736f},
std::array<float,2>{0.677450716f, 0.630034983f},
std::array<float,2>{0.486732453f, 0.139407128f},
std::array<float,2>{0.245676652f, 0.590056002f},
std::array<float,2>{0.954888582f, 0.111932412f},
std::array<float,2>{0.699516535f, 0.981973112f},
std::array<float,2>{0.410673559f, 0.323791862f},
std::array<float,2>{0.294326097f, 0.767733216f},
std::array<float,2>{0.580598354f, 0.472100466f},
std::array<float,2>{0.783254087f, 0.741339624f},
std::array<float,2>{0.0855722204f, 0.199961215f},
std::array<float,2>{0.465382963f, 0.674711287f},
std::array<float,2>{0.630917668f, 0.180257559f},
std::array<float,2>{0.93691808f, 0.868141353f},
std::array<float,2>{0.17349723f, 0.427610368f},
std::array<float,2>{0.035180185f, 0.878639221f},
std::array<float,2>{0.822208345f, 0.270456344f},
std::array<float,2>{0.508218825f, 0.502119541f},
std::array<float,2>{0.312743336f, 0.0551325306f},
std::array<float,2>{0.129930124f, 0.702640176f},
std::array<float,2>{0.902678788f, 0.241921008f},
std::array<float,2>{0.682072043f, 0.806594908f},
std::array<float,2>{0.497417241f, 0.452205718f},
std::array<float,2>{0.364307642f, 0.962362885f},
std::array<float,2>{0.552482843f, 0.367683768f},
std::array<float,2>{0.850927949f, 0.618364215f},
std::array<float,2>{0.0189891607f, 0.0782463923f},
std::array<float,2>{0.402374268f, 0.545348346f},
std::array<float,2>{0.726855099f, 0.0251684599f},
std::array<float,2>{0.970650077f, 0.922750115f},
std::array<float,2>{0.190799057f, 0.291306823f},
std::array<float,2>{0.115895115f, 0.832045257f},
std::array<float,2>{0.771612406f, 0.386173874f},
std::array<float,2>{0.613578618f, 0.642948449f},
std::array<float,2>{0.268089741f, 0.142928049f},
std::array<float,2>{0.0445286818f, 0.573296666f},
std::array<float,2>{0.817738056f, 0.105179638f},
std::array<float,2>{0.501902342f, 0.997193992f},
std::array<float,2>{0.326667249f, 0.337872028f},
std::array<float,2>{0.45410496f, 0.763972282f},
std::array<float,2>{0.638029397f, 0.49711588f},
std::array<float,2>{0.924064517f, 0.725539744f},
std::array<float,2>{0.182942554f, 0.217071116f},
std::array<float,2>{0.285566002f, 0.657367051f},
std::array<float,2>{0.591984391f, 0.170256659f},
std::array<float,2>{0.792802334f, 0.84901768f},
std::array<float,2>{0.0878497362f, 0.407696337f},
std::array<float,2>{0.236333013f, 0.892450929f},
std::array<float,2>{0.96201396f, 0.255485296f},
std::array<float,2>{0.695096791f, 0.524064064f},
std::array<float,2>{0.421513259f, 0.0353559591f},
std::array<float,2>{0.0753807127f, 0.625918329f},
std::array<float,2>{0.801378191f, 0.1331826f},
std::array<float,2>{0.576707184f, 0.818194211f},
std::array<float,2>{0.298168838f, 0.402207017f},
std::array<float,2>{0.433685452f, 0.911024749f},
std::array<float,2>{0.716513932f, 0.304125816f},
std::array<float,2>{0.937739968f, 0.558701575f},
std::array<float,2>{0.221086591f, 0.00925828051f},
std::array<float,2>{0.328510016f, 0.599253356f},
std::array<float,2>{0.527825296f, 0.0660931021f},
std::array<float,2>{0.836887538f, 0.948351383f},
std::array<float,2>{0.0477815196f, 0.352797955f},
std::array<float,2>{0.170613632f, 0.787696302f},
std::array<float,2>{0.906810522f, 0.460758954f},
std::array<float,2>{0.655269206f, 0.710670054f},
std::array<float,2>{0.444867045f, 0.220990777f},
std::array<float,2>{0.216523334f, 0.506970167f},
std::array<float,2>{0.985433638f, 0.0597608872f},
std::array<float,2>{0.7386204f, 0.880709529f},
std::array<float,2>{0.38749212f, 0.266537279f},
std::array<float,2>{0.26193881f, 0.872905672f},
std::array<float,2>{0.604644895f, 0.422221035f},
std::array<float,2>{0.759055316f, 0.677684009f},
std::array<float,2>{0.0947439373f, 0.184089407f},
std::array<float,2>{0.477805376f, 0.736422122f},
std::array<float,2>{0.66629082f, 0.196589008f},
std::array<float,2>{0.877248704f, 0.771402776f},
std::array<float,2>{0.156170681f, 0.473649412f},
std::array<float,2>{0.0129263205f, 0.98045522f},
std::array<float,2>{0.867773294f, 0.326316625f},
std::array<float,2>{0.546869278f, 0.586436033f},
std::array<float,2>{0.359058976f, 0.114557527f},
std::array<float,2>{0.23201932f, 0.686917841f},
std::array<float,2>{0.945492327f, 0.178847075f},
std::array<float,2>{0.70581162f, 0.864385664f},
std::array<float,2>{0.428596705f, 0.433331341f},
std::array<float,2>{0.311343402f, 0.890343547f},
std::array<float,2>{0.563172579f, 0.275340527f},
std::array<float,2>{0.809890866f, 0.509046555f},
std::array<float,2>{0.0678140894f, 0.0481549054f},
std::array<float,2>{0.446020424f, 0.58579421f},
std::array<float,2>{0.647877932f, 0.118761688f},
std::array<float,2>{0.921450555f, 0.974244654f},
std::array<float,2>{0.157189384f, 0.315329462f},
std::array<float,2>{0.0593784042f, 0.777348399f},
std::array<float,2>{0.830639899f, 0.48428455f},
std::array<float,2>{0.519940257f, 0.742496908f},
std::array<float,2>{0.340831965f, 0.194381356f},
std::array<float,2>{0.106996603f, 0.547027588f},
std::array<float,2>{0.755686522f, 0.001761419f},
std::array<float,2>{0.593930602f, 0.91442126f},
std::array<float,2>{0.253594518f, 0.307295829f},
std::array<float,2>{0.375156462f, 0.826387107f},
std::array<float,2>{0.743159175f, 0.394096613f},
std::array<float,2>{0.999767065f, 0.633942366f},
std::array<float,2>{0.20321703f, 0.129429728f},
std::array<float,2>{0.35071981f, 0.71131593f},
std::array<float,2>{0.538373649f, 0.228331536f},
std::array<float,2>{0.866375983f, 0.795185208f},
std::array<float,2>{0.00494626351f, 0.462855697f},
std::array<float,2>{0.142177522f, 0.942717433f},
std::array<float,2>{0.883910716f, 0.345344156f},
std::array<float,2>{0.660425186f, 0.603222907f},
std::array<float,2>{0.471456259f, 0.0735496283f},
std::array<float,2>{0.0265294313f, 0.727051079f},
std::array<float,2>{0.857117534f, 0.210795835f},
std::array<float,2>{0.557683229f, 0.75163871f},
std::array<float,2>{0.368117183f, 0.487032384f},
std::array<float,2>{0.491589218f, 0.991048634f},
std::array<float,2>{0.67565608f, 0.331358731f},
std::array<float,2>{0.895214319f, 0.565558672f},
std::array<float,2>{0.137837738f, 0.0971128196f},
std::array<float,2>{0.273994088f, 0.517538369f},
std::array<float,2>{0.62450856f, 0.0435598642f},
std::array<float,2>{0.780233085f, 0.90265429f},
std::array<float,2>{0.121567123f, 0.259176791f},
std::array<float,2>{0.202669933f, 0.854857326f},
std::array<float,2>{0.981972992f, 0.417383403f},
std::array<float,2>{0.719713688f, 0.671198726f},
std::array<float,2>{0.396587968f, 0.156287298f},
std::array<float,2>{0.178413644f, 0.616465092f},
std::array<float,2>{0.932316661f, 0.0927808061f},
std::array<float,2>{0.626837611f, 0.960877001f},
std::array<float,2>{0.464108258f, 0.367108583f},
std::array<float,2>{0.317209452f, 0.8027246f},
std::array<float,2>{0.51244992f, 0.437832773f},
std::array<float,2>{0.826566696f, 0.69251734f},
std::array<float,2>{0.0341055579f, 0.243537754f},
std::array<float,2>{0.406918645f, 0.649209321f},
std::array<float,2>{0.697098672f, 0.15223752f},
std::array<float,2>{0.957288146f, 0.842427611f},
std::array<float,2>{0.24890478f, 0.377972305f},
std::array<float,2>{0.0782421157f, 0.93335408f},
std::array<float,2>{0.788667262f, 0.286063313f},
std::array<float,2>{0.582900226f, 0.535610557f},
std::array<float,2>{0.289223582f, 0.0178412013f},
std::array<float,2>{0.211481735f, 0.691364229f},
std::array<float,2>{0.991084099f, 0.247855365f},
std::array<float,2>{0.73624897f, 0.797425449f},
std::array<float,2>{0.383946091f, 0.445238322f},
std::array<float,2>{0.25999701f, 0.954491079f},
std::array<float,2>{0.60777235f, 0.360320419f},
std::array<float,2>{0.764608085f, 0.6106745f},
std::array<float,2>{0.101457663f, 0.0867553949f},
std::array<float,2>{0.481216878f, 0.534969687f},
std::array<float,2>{0.670728326f, 0.0214767791f},
std::array<float,2>{0.880395353f, 0.934464872f},
std::array<float,2>{0.151677623f, 0.284525156f},
std::array<float,2>{0.00877177715f, 0.838688135f},
std::array<float,2>{0.871986985f, 0.382429987f},
std::array<float,2>{0.541080356f, 0.654208124f},
std::array<float,2>{0.352362692f, 0.152426839f},
std::array<float,2>{0.0712610111f, 0.567151129f},
std::array<float,2>{0.798431277f, 0.100797243f},
std::array<float,2>{0.570882678f, 0.985964119f},
std::array<float,2>{0.30397141f, 0.33565709f},
std::array<float,2>{0.431193024f, 0.755866945f},
std::array<float,2>{0.713686049f, 0.489777118f},
std::array<float,2>{0.942253888f, 0.734306216f},
std::array<float,2>{0.225971758f, 0.206853971f},
std::array<float,2>{0.334253609f, 0.665267587f},
std::array<float,2>{0.524066925f, 0.160814777f},
std::array<float,2>{0.841582835f, 0.856316626f},
std::array<float,2>{0.0530430675f, 0.419767261f},
std::array<float,2>{0.167439684f, 0.898579061f},
std::array<float,2>{0.913099885f, 0.264882892f},
std::array<float,2>{0.65137738f, 0.52081269f},
std::array<float,2>{0.439333498f, 0.0408926755f},
std::array<float,2>{0.0410444736f, 0.640549839f},
std::array<float,2>{0.815891445f, 0.127050593f},
std::array<float,2>{0.506602407f, 0.820505619f},
std::array<float,2>{0.322563738f, 0.396985173f},
std::array<float,2>{0.459676445f, 0.917991161f},
std::array<float,2>{0.63383466f, 0.309179068f},
std::array<float,2>{0.929264903f, 0.553933263f},
std::array<float,2>{0.186702311f, 0.00703546591f},
std::array<float,2>{0.284961224f, 0.606571317f},
std::array<float,2>{0.586857498f, 0.0776885748f},
std::array<float,2>{0.796166539f, 0.939377546f},
std::array<float,2>{0.0933146924f, 0.349750072f},
std::array<float,2>{0.241818517f, 0.789136648f},
std::array<float,2>{0.96643275f, 0.467102408f},
std::array<float,2>{0.689098895f, 0.717347145f},
std::array<float,2>{0.416413665f, 0.233384296f},
std::array<float,2>{0.12889953f, 0.515194535f},
std::array<float,2>{0.899420679f, 0.0518107414f},
std::array<float,2>{0.686433613f, 0.885726273f},
std::array<float,2>{0.493836731f, 0.280852944f},
std::array<float,2>{0.363203555f, 0.861918211f},
std::array<float,2>{0.548486114f, 0.435019076f},
std::array<float,2>{0.844768107f, 0.682085752f},
std::array<float,2>{0.0222343039f, 0.172936916f},
std::array<float,2>{0.39911896f, 0.747198939f},
std::array<float,2>{0.732575238f, 0.191249356f},
std::array<float,2>{0.972872496f, 0.77411902f},
std::array<float,2>{0.194066539f, 0.478191227f},
std::array<float,2>{0.112345107f, 0.968951225f},
std::array<float,2>{0.767479062f, 0.319536328f},
std::array<float,2>{0.612062752f, 0.580754876f},
std::array<float,2>{0.269861817f, 0.122315109f},
std::array<float,2>{0.172736138f, 0.673358679f},
std::array<float,2>{0.93608892f, 0.182433665f},
std::array<float,2>{0.632637858f, 0.870467842f},
std::array<float,2>{0.465844512f, 0.428233892f},
std::array<float,2>{0.314151376f, 0.876261055f},
std::array<float,2>{0.509383976f, 0.27256462f},
std::array<float,2>{0.821253777f, 0.501455307f},
std::array<float,2>{0.0370545872f, 0.0572191402f},
std::array<float,2>{0.411368489f, 0.592755377f},
std::array<float,2>{0.700926602f, 0.109701484f},
std::array<float,2>{0.953685522f, 0.983015835f},
std::array<float,2>{0.244764581f, 0.322257608f},
std::array<float,2>{0.0840299129f, 0.765908301f},
std::array<float,2>{0.784367681f, 0.469043821f},
std::array<float,2>{0.581840515f, 0.740059793f},
std::array<float,2>{0.293540657f, 0.201444194f},
std::array<float,2>{0.0291721318f, 0.555650294f},
std::array<float,2>{0.855390489f, 0.014320693f},
std::array<float,2>{0.559966624f, 0.908503711f},
std::array<float,2>{0.37167725f, 0.297833949f},
std::array<float,2>{0.487674534f, 0.812998652f},
std::array<float,2>{0.676707923f, 0.403978616f},
std::array<float,2>{0.893524468f, 0.631624937f},
std::array<float,2>{0.133262262f, 0.138575211f},
std::array<float,2>{0.279994875f, 0.706111908f},
std::array<float,2>{0.619387031f, 0.226436704f},
std::array<float,2>{0.775434732f, 0.783875227f},
std::array<float,2>{0.118338645f, 0.455826759f},
std::array<float,2>{0.197575644f, 0.952099144f},
std::array<float,2>{0.977220953f, 0.355896831f},
std::array<float,2>{0.725964248f, 0.596547961f},
std::array<float,2>{0.393273383f, 0.0690070614f},
std::array<float,2>{0.105227895f, 0.721349776f},
std::array<float,2>{0.75066179f, 0.214740261f},
std::array<float,2>{0.601282895f, 0.758232474f},
std::array<float,2>{0.257554322f, 0.492307156f},
std::array<float,2>{0.381316066f, 0.993816078f},
std::array<float,2>{0.747477233f, 0.341273367f},
std::array<float,2>{0.996021986f, 0.575195789f},
std::array<float,2>{0.208006471f, 0.108363159f},
std::array<float,2>{0.344667614f, 0.530978203f},
std::array<float,2>{0.532197714f, 0.0339628272f},
std::array<float,2>{0.86110574f, 0.897873998f},
std::array<float,2>{0.00289804838f, 0.252195209f},
std::array<float,2>{0.144835874f, 0.847129881f},
std::array<float,2>{0.889099658f, 0.410253704f},
std::array<float,2>{0.656963408f, 0.661709368f},
std::array<float,2>{0.473302007f, 0.167902216f},
std::array<float,2>{0.226985484f, 0.624943972f},
std::array<float,2>{0.950533986f, 0.0851776302f},
std::array<float,2>{0.707084775f, 0.966053724f},
std::array<float,2>{0.425212026f, 0.372493595f},
std::array<float,2>{0.307369888f, 0.809497893f},
std::array<float,2>{0.567474246f, 0.44614929f},
std::array<float,2>{0.806602836f, 0.698639214f},
std::array<float,2>{0.0650943965f, 0.237455443f},
std::array<float,2>{0.451221526f, 0.646612108f},
std::array<float,2>{0.643422127f, 0.147779226f},
std::array<float,2>{0.91517067f, 0.831706583f},
std::array<float,2>{0.161867619f, 0.386990756f},
std::array<float,2>{0.0570688061f, 0.927092552f},
std::array<float,2>{0.83233732f, 0.295705795f},
std::array<float,2>{0.516894698f, 0.539818466f},
std::array<float,2>{0.337930202f, 0.0277366582f},
std::array<float,2>{0.15482989f, 0.736222565f},
std::array<float,2>{0.878790259f, 0.19810468f},
std::array<float,2>{0.667963386f, 0.773384929f},
std::array<float,2>{0.476586819f, 0.475991994f},
std::array<float,2>{0.357570827f, 0.976620853f},
std::array<float,2>{0.545090437f, 0.324902177f},
std::array<float,2>{0.868530571f, 0.588586271f},
std::array<float,2>{0.0117308646f, 0.115801677f},
std::array<float,2>{0.387986064f, 0.504310906f},
std::array<float,2>{0.739662409f, 0.0611219294f},
std::array<float,2>{0.985158503f, 0.882224619f},
std::array<float,2>{0.215520546f, 0.269105732f},
std::array<float,2>{0.0945756808f, 0.87480557f},
std::array<float,2>{0.758491158f, 0.424591392f},
std::array<float,2>{0.603889108f, 0.679321408f},
std::array<float,2>{0.263219446f, 0.186877117f},
std::array<float,2>{0.0479964986f, 0.60126102f},
std::array<float,2>{0.83780092f, 0.0628050715f},
std::array<float,2>{0.529157817f, 0.945489049f},
std::array<float,2>{0.329680294f, 0.354670852f},
std::array<float,2>{0.443462521f, 0.786812127f},
std::array<float,2>{0.655508459f, 0.458050847f},
std::array<float,2>{0.907675922f, 0.708337784f},
std::array<float,2>{0.171232253f, 0.219830483f},
std::array<float,2>{0.297387689f, 0.628438234f},
std::array<float,2>{0.578077674f, 0.135490388f},
std::array<float,2>{0.802405834f, 0.819159865f},
std::array<float,2>{0.0751290098f, 0.399665177f},
std::array<float,2>{0.222419888f, 0.913379967f},
std::array<float,2>{0.939249873f, 0.302134901f},
std::array<float,2>{0.71553719f, 0.562253594f},
std::array<float,2>{0.435026139f, 0.0112100802f},
std::array<float,2>{0.0868129954f, 0.65873313f},
std::array<float,2>{0.791782916f, 0.168719396f},
std::array<float,2>{0.59324646f, 0.849924922f},
std::array<float,2>{0.28627193f, 0.409326881f},
std::array<float,2>{0.420750976f, 0.893149436f},
std::array<float,2>{0.693802595f, 0.25649178f},
std::array<float,2>{0.961360455f, 0.526607871f},
std::array<float,2>{0.237852454f, 0.0380079485f},
std::array<float,2>{0.327225417f, 0.571933329f},
std::array<float,2>{0.500615895f, 0.102107234f},
std::array<float,2>{0.817156911f, 0.998897672f},
std::array<float,2>{0.0436340831f, 0.339003563f},
std::array<float,2>{0.182503134f, 0.763054252f},
std::array<float,2>{0.925418675f, 0.49884671f},
std::array<float,2>{0.637508392f, 0.722741008f},
std::array<float,2>{0.453978449f, 0.21601218f},
std::array<float,2>{0.19034563f, 0.543805122f},
std::array<float,2>{0.969085932f, 0.0265282281f},
std::array<float,2>{0.728214383f, 0.925305367f},
std::array<float,2>{0.404273689f, 0.290627629f},
std::array<float,2>{0.269223869f, 0.834223866f},
std::array<float,2>{0.614335418f, 0.383529007f},
std::array<float,2>{0.772481263f, 0.640864134f},
std::array<float,2>{0.116478518f, 0.141953275f},
std::array<float,2>{0.496819526f, 0.699656427f},
std::array<float,2>{0.683484077f, 0.239632651f},
std::array<float,2>{0.903543413f, 0.807568133f},
std::array<float,2>{0.12911813f, 0.449396372f},
std::array<float,2>{0.017691385f, 0.963022768f},
std::array<float,2>{0.849982798f, 0.369522959f},
std::array<float,2>{0.551324368f, 0.619289517f},
std::array<float,2>{0.363316327f, 0.08083307f},
std::array<float,2>{0.249591559f, 0.650905371f},
std::array<float,2>{0.958125532f, 0.148947582f},
std::array<float,2>{0.695736885f, 0.840347946f},
std::array<float,2>{0.408124268f, 0.375981212f},
std::array<float,2>{0.290311962f, 0.929979801f},
std::array<float,2>{0.583845139f, 0.288949549f},
std::array<float,2>{0.78735888f, 0.538535357f},
std::array<float,2>{0.0792205855f, 0.0170724597f},
std::array<float,2>{0.463012129f, 0.614540637f},
std::array<float,2>{0.625655413f, 0.0906477571f},
std::array<float,2>{0.933549702f, 0.958631396f},
std::array<float,2>{0.179007217f, 0.363610834f},
std::array<float,2>{0.0343191959f, 0.803706586f},
std::array<float,2>{0.827672601f, 0.439873308f},
std::array<float,2>{0.513256431f, 0.694969893f},
std::array<float,2>{0.317875922f, 0.24513945f},
std::array<float,2>{0.122384146f, 0.517962813f},
std::array<float,2>{0.781131685f, 0.0451618657f},
std::array<float,2>{0.623536289f, 0.905300856f},
std::array<float,2>{0.275073379f, 0.261112928f},
std::array<float,2>{0.397646934f, 0.853140116f},
std::array<float,2>{0.720373929f, 0.415231079f},
std::array<float,2>{0.981253386f, 0.66871506f},
std::array<float,2>{0.201365009f, 0.160013452f},
std::array<float,2>{0.368687898f, 0.72989285f},
std::array<float,2>{0.557346046f, 0.208068177f},
std::array<float,2>{0.856197596f, 0.753623664f},
std::array<float,2>{0.0263608042f, 0.485432923f},
std::array<float,2>{0.137319729f, 0.990057528f},
std::array<float,2>{0.895635962f, 0.32933557f},
std::array<float,2>{0.67402935f, 0.563499212f},
std::array<float,2>{0.491020441f, 0.0945020095f},
std::array<float,2>{0.00483176019f, 0.713386893f},
std::array<float,2>{0.866094649f, 0.229419142f},
std::array<float,2>{0.537860036f, 0.793638051f},
std::array<float,2>{0.350314826f, 0.464428455f},
std::array<float,2>{0.472641557f, 0.944455087f},
std::array<float,2>{0.661534905f, 0.346416801f},
std::array<float,2>{0.883019626f, 0.605224431f},
std::array<float,2>{0.141598985f, 0.0703192055f},
std::array<float,2>{0.252721876f, 0.548925757f},
std::array<float,2>{0.594840348f, 0.00214414066f},
std::array<float,2>{0.754721642f, 0.916416049f},
std::array<float,2>{0.105918512f, 0.305061877f},
std::array<float,2>{0.204552576f, 0.825188458f},
std::array<float,2>{0.998985231f, 0.391480535f},
std::array<float,2>{0.744107604f, 0.635078728f},
std::array<float,2>{0.376770407f, 0.131536782f},
std::array<float,2>{0.157417402f, 0.582690775f},
std::array<float,2>{0.920135021f, 0.12043079f},
std::array<float,2>{0.647093117f, 0.976435781f},
std::array<float,2>{0.447248697f, 0.313109696f},
std::array<float,2>{0.340341061f, 0.779851019f},
std::array<float,2>{0.521185994f, 0.480745167f},
std::array<float,2>{0.831955075f, 0.744327426f},
std::array<float,2>{0.0600552298f, 0.192428932f},
std::array<float,2>{0.428824604f, 0.685018718f},
std::array<float,2>{0.707018197f, 0.177196741f},
std::array<float,2>{0.946510196f, 0.866056085f},
std::array<float,2>{0.230945438f, 0.430517733f},
std::array<float,2>{0.0671863481f, 0.888382494f},
std::array<float,2>{0.808803976f, 0.276110798f},
std::array<float,2>{0.564184487f, 0.510108829f},
std::array<float,2>{0.312321991f, 0.0489769354f},
std::array<float,2>{0.222813979f, 0.730725944f},
std::array<float,2>{0.943985999f, 0.204090968f},
std::array<float,2>{0.712392151f, 0.754385233f},
std::array<float,2>{0.432859212f, 0.491159856f},
std::array<float,2>{0.302523285f, 0.986902595f},
std::array<float,2>{0.574088335f, 0.333382159f},
std::array<float,2>{0.798928142f, 0.57023102f},
std::array<float,2>{0.0740481243f, 0.097917065f},
std::array<float,2>{0.440705866f, 0.522412121f},
std::array<float,2>{0.649062634f, 0.0429424718f},
std::array<float,2>{0.910892546f, 0.902114511f},
std::array<float,2>{0.165629178f, 0.263423771f},
std::array<float,2>{0.0524577759f, 0.858825564f},
std::array<float,2>{0.843140721f, 0.421145707f},
std::array<float,2>{0.526382208f, 0.666683614f},
std::array<float,2>{0.332174182f, 0.162770763f},
std::array<float,2>{0.0992919505f, 0.611937582f},
std::array<float,2>{0.761925161f, 0.0887284577f},
std::array<float,2>{0.606823146f, 0.95534575f},
std::array<float,2>{0.259224802f, 0.362707943f},
std::array<float,2>{0.385266483f, 0.799953461f},
std::array<float,2>{0.738182843f, 0.442658097f},
std::array<float,2>{0.989506423f, 0.689332187f},
std::array<float,2>{0.213881418f, 0.248503625f},
std::array<float,2>{0.354692608f, 0.654940486f},
std::array<float,2>{0.540868044f, 0.155509159f},
std::array<float,2>{0.874904335f, 0.837021708f},
std::array<float,2>{0.0100752823f, 0.38058421f},
std::array<float,2>{0.14945358f, 0.937008321f},
std::array<float,2>{0.88259697f, 0.282045722f},
std::array<float,2>{0.669883549f, 0.533185303f},
std::array<float,2>{0.483952045f, 0.0218645725f},
std::array<float,2>{0.0197272412f, 0.679852426f},
std::array<float,2>{0.846253097f, 0.175765917f},
std::array<float,2>{0.550745666f, 0.859423518f},
std::array<float,2>{0.359686494f, 0.437117934f},
std::array<float,2>{0.495812625f, 0.884757519f},
std::array<float,2>{0.684462011f, 0.277866453f},
std::array<float,2>{0.901810646f, 0.51314044f},
std::array<float,2>{0.125379816f, 0.0543362387f},
std::array<float,2>{0.27329272f, 0.578162134f},
std::array<float,2>{0.610490382f, 0.123204254f},
std::array<float,2>{0.768990338f, 0.971722841f},
std::array<float,2>{0.109813906f, 0.31824705f},
std::array<float,2>{0.192740157f, 0.77681917f},
std::array<float,2>{0.976530492f, 0.479826957f},
std::array<float,2>{0.731149673f, 0.749716401f},
std::array<float,2>{0.402252138f, 0.187762693f},
std::array<float,2>{0.184731424f, 0.552226305f},
std::array<float,2>{0.926068366f, 0.00565165561f},
std::array<float,2>{0.635101378f, 0.920034945f},
std::array<float,2>{0.458611369f, 0.312073886f},
std::array<float,2>{0.322203666f, 0.822808921f},
std::array<float,2>{0.505677998f, 0.394794703f},
std::array<float,2>{0.813670814f, 0.638282418f},
std::array<float,2>{0.0401260443f, 0.125170007f},
std::array<float,2>{0.414873809f, 0.7156322f},
std::array<float,2>{0.690532207f, 0.231562063f},
std::array<float,2>{0.96827352f, 0.792932153f},
std::array<float,2>{0.239980012f, 0.466038376f},
std::array<float,2>{0.0913877785f, 0.941044152f},
std::array<float,2>{0.794766366f, 0.348941386f},
std::array<float,2>{0.588366687f, 0.607714593f},
std::array<float,2>{0.281773448f, 0.0761645362f},
std::array<float,2>{0.135334849f, 0.628998935f},
std::array<float,2>{0.891361356f, 0.139999807f},
std::array<float,2>{0.679398477f, 0.81553179f},
std::array<float,2>{0.485153854f, 0.405541718f},
std::array<float,2>{0.374190778f, 0.907745659f},
std::array<float,2>{0.561739624f, 0.300728649f},
std::array<float,2>{0.853196442f, 0.55846405f},
std::array<float,2>{0.0307256151f, 0.0126954978f},
std::array<float,2>{0.391650856f, 0.595316112f},
std::array<float,2>{0.724590063f, 0.0670912936f},
std::array<float,2>{0.978993237f, 0.950555146f},
std::array<float,2>{0.196890742f, 0.359218776f},
std::array<float,2>{0.119296163f, 0.782980382f},
std::array<float,2>{0.774495184f, 0.453307301f},
std::array<float,2>{0.618127048f, 0.703513741f},
std::array<float,2>{0.27777651f, 0.223799348f},
std::array<float,2>{0.0381537303f, 0.50380826f},
std::array<float,2>{0.823049188f, 0.0561586954f},
std::array<float,2>{0.510556161f, 0.877463579f},
std::array<float,2>{0.315413833f, 0.271306992f},
std::array<float,2>{0.467699081f, 0.868913352f},
std::array<float,2>{0.629537582f, 0.425924897f},
std::array<float,2>{0.933900535f, 0.67491293f},
std::array<float,2>{0.175455883f, 0.181513727f},
std::array<float,2>{0.295724839f, 0.74097544f},
std::array<float,2>{0.578584015f, 0.201000974f},
std::array<float,2>{0.782124758f, 0.768565476f},
std::array<float,2>{0.0831291825f, 0.471175581f},
std::array<float,2>{0.24390322f, 0.980785728f},
std::array<float,2>{0.956781983f, 0.322596997f},
std::array<float,2>{0.702221036f, 0.591451943f},
std::array<float,2>{0.413948894f, 0.113082357f},
std::array<float,2>{0.0638281852f, 0.696143687f},
std::array<float,2>{0.808223546f, 0.235673293f},
std::array<float,2>{0.570110381f, 0.810745418f},
std::array<float,2>{0.305793881f, 0.447949737f},
std::array<float,2>{0.423435658f, 0.967344999f},
std::array<float,2>{0.709291518f, 0.374583006f},
std::array<float,2>{0.95259732f, 0.622979105f},
std::array<float,2>{0.229324967f, 0.0830474645f},
std::array<float,2>{0.336962342f, 0.541358173f},
std::array<float,2>{0.517710268f, 0.0293200146f},
std::array<float,2>{0.835433662f, 0.928257704f},
std::array<float,2>{0.054890912f, 0.293166339f},
std::array<float,2>{0.163965657f, 0.829761863f},
std::array<float,2>{0.916722059f, 0.390046358f},
std::array<float,2>{0.641679168f, 0.646464646f},
std::array<float,2>{0.449319065f, 0.145445764f},
std::array<float,2>{0.209471777f, 0.577324688f},
std::array<float,2>{0.992726505f, 0.107036427f},
std::array<float,2>{0.749877751f, 0.995989263f},
std::array<float,2>{0.380286634f, 0.343237489f},
std::array<float,2>{0.255538642f, 0.760483921f},
std::array<float,2>{0.598312438f, 0.494181782f},
std::array<float,2>{0.752483606f, 0.719046056f},
std::array<float,2>{0.101861432f, 0.212005854f},
std::array<float,2>{0.475186825f, 0.663025975f},
std::array<float,2>{0.660024762f, 0.164348111f},
std::array<float,2>{0.88726151f, 0.844893157f},
std::array<float,2>{0.147073478f, 0.412875891f},
std::array<float,2>{0.000574618112f, 0.896224618f},
std::array<float,2>{0.861928761f, 0.25185293f},
std::array<float,2>{0.533865869f, 0.527997077f},
std::array<float,2>{0.34605971f, 0.0313968509f},
std::array<float,2>{0.168173447f, 0.709296048f},
std::array<float,2>{0.909844279f, 0.222600088f},
std::array<float,2>{0.652909577f, 0.788683593f},
std::array<float,2>{0.441879958f, 0.459870756f},
std::array<float,2>{0.330455214f, 0.947581291f},
std::array<float,2>{0.530456305f, 0.351888627f},
std::array<float,2>{0.838732898f, 0.598626673f},
std::array<float,2>{0.048868034f, 0.0649305135f},
std::array<float,2>{0.435787141f, 0.560378015f},
std::array<float,2>{0.7172876f, 0.00792348664f},
std::array<float,2>{0.941288412f, 0.911391675f},
std::array<float,2>{0.220217973f, 0.303478122f},
std::array<float,2>{0.0776922181f, 0.816841722f},
std::array<float,2>{0.802792192f, 0.400975645f},
std::array<float,2>{0.5756405f, 0.626505613f},
std::array<float,2>{0.300062507f, 0.134345174f},
std::array<float,2>{0.0139549924f, 0.587645113f},
std::array<float,2>{0.870661139f, 0.113752142f},
std::array<float,2>{0.544549823f, 0.979407668f},
std::array<float,2>{0.356270432f, 0.327213019f},
std::array<float,2>{0.480383426f, 0.770258784f},
std::array<float,2>{0.665077686f, 0.472755551f},
std::array<float,2>{0.876823008f, 0.737753391f},
std::array<float,2>{0.153526589f, 0.195885569f},
std::array<float,2>{0.264360309f, 0.676023245f},
std::array<float,2>{0.602744162f, 0.184602812f},
std::array<float,2>{0.761241376f, 0.871443391f},
std::array<float,2>{0.0958521217f, 0.42351526f},
std::array<float,2>{0.216839835f, 0.879047096f},
std::array<float,2>{0.988026083f, 0.267485261f},
std::array<float,2>{0.741793513f, 0.506297231f},
std::array<float,2>{0.389822304f, 0.0586451739f},
std::array<float,2>{0.113865718f, 0.644399643f},
std::array<float,2>{0.770160437f, 0.143997118f},
std::array<float,2>{0.617063105f, 0.833145857f},
std::array<float,2>{0.265763372f, 0.385169744f},
std::array<float,2>{0.405474395f, 0.92335093f},
std::array<float,2>{0.729673386f, 0.292744428f},
std::array<float,2>{0.971289754f, 0.545906723f},
std::array<float,2>{0.189001784f, 0.0241279695f},
std::array<float,2>{0.366768897f, 0.617369831f},
std::array<float,2>{0.554601669f, 0.0793028623f},
std::array<float,2>{0.848369479f, 0.961695492f},
std::array<float,2>{0.0174906235f, 0.368179828f},
std::array<float,2>{0.131440207f, 0.805337846f},
std::array<float,2>{0.904846847f, 0.451711923f},
std::array<float,2>{0.680152297f, 0.701385796f},
std::array<float,2>{0.499826193f, 0.24090685f},
std::array<float,2>{0.234385654f, 0.525128007f},
std::array<float,2>{0.964551449f, 0.0369021185f},
std::array<float,2>{0.692350328f, 0.890666485f},
std::array<float,2>{0.418521374f, 0.254416972f},
std::array<float,2>{0.288417459f, 0.848063648f},
std::array<float,2>{0.59041667f, 0.406860024f},
std::array<float,2>{0.789075971f, 0.656870604f},
std::array<float,2>{0.0884061903f, 0.171328828f},
std::array<float,2>{0.455398142f, 0.725964785f},
std::array<float,2>{0.638921201f, 0.21846506f},
std::array<float,2>{0.923774302f, 0.765392303f},
std::array<float,2>{0.180802777f, 0.496708542f},
std::array<float,2>{0.046367377f, 0.996792257f},
std::array<float,2>{0.819666207f, 0.336359769f},
std::array<float,2>{0.503538311f, 0.573075712f},
std::array<float,2>{0.32506755f, 0.10384085f},
std::array<float,2>{0.20065096f, 0.670091987f},
std::array<float,2>{0.983710706f, 0.158044919f},
std::array<float,2>{0.72181052f, 0.8538661f},
std::array<float,2>{0.39561522f, 0.416226745f},
std::array<float,2>{0.276831329f, 0.9037714f},
std::array<float,2>{0.621542454f, 0.258676231f},
std::array<float,2>{0.778649092f, 0.516206503f},
std::array<float,2>{0.124260254f, 0.0444568954f},
std::array<float,2>{0.489406735f, 0.565082967f},
std::array<float,2>{0.672415853f, 0.096298188f},
std::array<float,2>{0.896719992f, 0.991343796f},
std::array<float,2>{0.139633149f, 0.330448717f},
std::array<float,2>{0.0237305518f, 0.750856221f},
std::array<float,2>{0.85754931f, 0.487385035f},
std::array<float,2>{0.555685222f, 0.728316128f},
std::array<float,2>{0.369775474f, 0.209893882f},
std::array<float,2>{0.0815049931f, 0.536805212f},
std::array<float,2>{0.785250843f, 0.0191784054f},
std::array<float,2>{0.584285438f, 0.931778252f},
std::array<float,2>{0.292274714f, 0.286319911f},
std::array<float,2>{0.409232199f, 0.843146682f},
std::array<float,2>{0.697735667f, 0.377417207f},
std::array<float,2>{0.95957917f, 0.649856567f},
std::array<float,2>{0.247141302f, 0.150451288f},
std::array<float,2>{0.319480985f, 0.691787422f},
std::array<float,2>{0.515281081f, 0.242889822f},
std::array<float,2>{0.825810194f, 0.800944209f},
std::array<float,2>{0.033028625f, 0.439427376f},
std::array<float,2>{0.176885247f, 0.959268034f},
std::array<float,2>{0.930579245f, 0.366038114f},
std::array<float,2>{0.627852917f, 0.616206169f},
std::array<float,2>{0.462720722f, 0.0926957205f},
std::array<float,2>{0.0614670776f, 0.743889213f},
std::array<float,2>{0.829311013f, 0.193441659f},
std::array<float,2>{0.522391498f, 0.779172361f},
std::array<float,2>{0.343127728f, 0.482857049f},
std::array<float,2>{0.448414385f, 0.97335273f},
std::array<float,2>{0.64594841f, 0.315808207f},
std::array<float,2>{0.918557942f, 0.584297657f},
std::array<float,2>{0.159913331f, 0.117807381f},
std::array<float,2>{0.309835613f, 0.50823915f},
std::array<float,2>{0.566008747f, 0.0474746972f},
std::array<float,2>{0.812191546f, 0.889532506f},
std::array<float,2>{0.0690924451f, 0.274138808f},
std::array<float,2>{0.233611837f, 0.863375008f},
std::array<float,2>{0.947648466f, 0.431823552f},
std::array<float,2>{0.704724431f, 0.686107218f},
std::array<float,2>{0.426729918f, 0.178565919f},
std::array<float,2>{0.143541738f, 0.60170269f},
std::array<float,2>{0.886211038f, 0.0725934654f},
std::array<float,2>{0.66348213f, 0.941417813f},
std::array<float,2>{0.47000733f, 0.344064713f},
std::array<float,2>{0.349081457f, 0.79646492f},
std::array<float,2>{0.536761701f, 0.461720377f},
std::array<float,2>{0.863412261f, 0.712119877f},
std::array<float,2>{0.00759359449f, 0.226759195f},
std::array<float,2>{0.378465354f, 0.633101344f},
std::array<float,2>{0.745760977f, 0.130665556f},
std::array<float,2>{0.997021794f, 0.827393711f},
std::array<float,2>{0.205333948f, 0.393478513f},
std::array<float,2>{0.108987294f, 0.915836275f},
std::array<float,2>{0.757707655f, 0.308265716f},
std::array<float,2>{0.595973194f, 0.548491001f},
std::array<float,2>{0.251762539f, 0.000449750252f},
std::array<float,2>{0.24683851f, 0.695251703f},
std::array<float,2>{0.960166752f, 0.245466128f},
std::array<float,2>{0.698911786f, 0.803361058f},
std::array<float,2>{0.408817023f, 0.439499527f},
std::array<float,2>{0.291633785f, 0.958870411f},
std::array<float,2>{0.585062921f, 0.36349389f},
std::array<float,2>{0.786143005f, 0.614366472f},
std::array<float,2>{0.0808397532f, 0.090433985f},
std::array<float,2>{0.461412728f, 0.538166404f},
std::array<float,2>{0.628227949f, 0.0166481994f},
std::array<float,2>{0.931325436f, 0.929690599f},
std::array<float,2>{0.176112562f, 0.288771033f},
std::array<float,2>{0.0315004773f, 0.84079051f},
std::array<float,2>{0.824362814f, 0.376297683f},
std::array<float,2>{0.514031589f, 0.651226044f},
std::array<float,2>{0.318926841f, 0.149303347f},
std::array<float,2>{0.123697907f, 0.563858569f},
std::array<float,2>{0.778018236f, 0.0944163054f},
std::array<float,2>{0.622993648f, 0.989789784f},
std::array<float,2>{0.275909215f, 0.329575151f},
std::array<float,2>{0.394725323f, 0.753740788f},
std::array<float,2>{0.720891178f, 0.48571974f},
std::array<float,2>{0.983159721f, 0.72966367f},
std::array<float,2>{0.200036108f, 0.208320171f},
std::array<float,2>{0.370443076f, 0.668461859f},
std::array<float,2>{0.55492419f, 0.15980342f},
std::array<float,2>{0.859142661f, 0.853428364f},
std::array<float,2>{0.0251059569f, 0.415391773f},
std::array<float,2>{0.139822915f, 0.905760884f},
std::array<float,2>{0.898117542f, 0.260923505f},
std::array<float,2>{0.673033237f, 0.517658949f},
std::array<float,2>{0.489190817f, 0.0452721082f},
std::array<float,2>{0.00616125436f, 0.634805202f},
std::array<float,2>{0.86441499f, 0.131637231f},
std::array<float,2>{0.535285652f, 0.824831665f},
std::array<float,2>{0.348005861f, 0.391165048f},
std::array<float,2>{0.469309866f, 0.916083097f},
std::array<float,2>{0.66217804f, 0.304792106f},
std::array<float,2>{0.88563931f, 0.54924798f},
std::array<float,2>{0.144261271f, 0.00235777488f},
std::array<float,2>{0.25087437f, 0.605433047f},
std::array<float,2>{0.597579479f, 0.0707941353f},
std::array<float,2>{0.756102145f, 0.944670558f},
std::array<float,2>{0.107941397f, 0.346558928f},
std::array<float,2>{0.206450343f, 0.793842256f},
std::array<float,2>{0.99792999f, 0.464804977f},
std::array<float,2>{0.744758844f, 0.713738859f},
std::array<float,2>{0.377746075f, 0.229158804f},
std::array<float,2>{0.159069225f, 0.509791136f},
std::array<float,2>{0.919284642f, 0.0491519272f},
std::array<float,2>{0.644969642f, 0.888518274f},
std::array<float,2>{0.447576642f, 0.276171625f},
std::array<float,2>{0.342222303f, 0.865764976f},
std::array<float,2>{0.523083389f, 0.430308819f},
std::array<float,2>{0.828513622f, 0.684728324f},
std::array<float,2>{0.0618419275f, 0.176773831f},
std::array<float,2>{0.426984936f, 0.744544685f},
std::array<float,2>{0.70353502f, 0.19271487f},
std::array<float,2>{0.94884485f, 0.780046046f},
std::array<float,2>{0.232994795f, 0.480680525f},
std::array<float,2>{0.0694697052f, 0.976243734f},
std::array<float,2>{0.8107481f, 0.313338339f},
std::array<float,2>{0.564528525f, 0.582940698f},
std::array<float,2>{0.309000701f, 0.120207831f},
std::array<float,2>{0.152767926f, 0.679552734f},
std::array<float,2>{0.875927508f, 0.186721161f},
std::array<float,2>{0.664081275f, 0.874600112f},
std::array<float,2>{0.479243279f, 0.424392372f},
std::array<float,2>{0.356568754f, 0.881889641f},
std::array<float,2>{0.543353617f, 0.269345462f},
std::array<float,2>{0.869676709f, 0.50408566f},
std::array<float,2>{0.0146834338f, 0.0613781959f},
std::array<float,2>{0.389282405f, 0.588865519f},
std::array<float,2>{0.741136551f, 0.116126508f},
std::array<float,2>{0.986472726f, 0.976981819f},
std::array<float,2>{0.218389675f, 0.325171143f},
std::array<float,2>{0.0973349586f, 0.773072779f},
std::array<float,2>{0.760039806f, 0.475812584f},
std::array<float,2>{0.601586103f, 0.736006916f},
std::array<float,2>{0.264882296f, 0.197821543f},
std::array<float,2>{0.0502852686f, 0.56235832f},
std::array<float,2>{0.839369595f, 0.0108393263f},
std::array<float,2>{0.529819608f, 0.913205624f},
std::array<float,2>{0.332023174f, 0.301963687f},
std::array<float,2>{0.443148762f, 0.819019556f},
std::array<float,2>{0.654190183f, 0.399440944f},
std::array<float,2>{0.908452451f, 0.628829479f},
std::array<float,2>{0.168987975f, 0.135577232f},
std::array<float,2>{0.299239397f, 0.708056867f},
std::array<float,2>{0.574960768f, 0.220094576f},
std::array<float,2>{0.803890586f, 0.787041724f},
std::array<float,2>{0.0771482363f, 0.458417296f},
std::array<float,2>{0.219426826f, 0.945700049f},
std::array<float,2>{0.939791143f, 0.354910374f},
std::array<float,2>{0.7186988f, 0.601522684f},
std::array<float,2>{0.437291563f, 0.062657252f},
std::array<float,2>{0.0889066681f, 0.723048389f},
std::array<float,2>{0.790507793f, 0.216171652f},
std::array<float,2>{0.591035366f, 0.762855172f},
std::array<float,2>{0.287614137f, 0.498546898f},
std::array<float,2>{0.419534266f, 0.998731077f},
std::array<float,2>{0.693184435f, 0.339344174f},
std::array<float,2>{0.963608325f, 0.572114468f},
std::array<float,2>{0.235356972f, 0.102516167f},
std::array<float,2>{0.325551897f, 0.52676034f},
std::array<float,2>{0.502768159f, 0.0377337225f},
std::array<float,2>{0.818750501f, 0.893325806f},
std::array<float,2>{0.0452221408f, 0.256617099f},
std::array<float,2>{0.179776698f, 0.849839687f},
std::array<float,2>{0.922708571f, 0.409522831f},
std::array<float,2>{0.640538812f, 0.658936977f},
std::array<float,2>{0.456816435f, 0.168601543f},
std::array<float,2>{0.188286081f, 0.619507253f},
std::array<float,2>{0.972231567f, 0.0807669535f},
std::array<float,2>{0.728821039f, 0.963151157f},
std::array<float,2>{0.405097365f, 0.36915648f},
std::array<float,2>{0.267008245f, 0.807158768f},
std::array<float,2>{0.616196632f, 0.449652016f},
std::array<float,2>{0.770653009f, 0.699304819f},
std::array<float,2>{0.114344962f, 0.239436701f},
std::array<float,2>{0.498998404f, 0.640887558f},
std::array<float,2>{0.681272566f, 0.141700745f},
std::array<float,2>{0.906159103f, 0.83443439f},
std::array<float,2>{0.13272959f, 0.383619189f},
std::array<float,2>{0.0158549417f, 0.925601542f},
std::array<float,2>{0.848894119f, 0.290866047f},
std::array<float,2>{0.553622782f, 0.543531239f},
std::array<float,2>{0.365962654f, 0.0267043002f},
std::array<float,2>{0.174447179f, 0.739770412f},
std::array<float,2>{0.934879303f, 0.201200515f},
std::array<float,2>{0.630403936f, 0.765840709f},
std::array<float,2>{0.468127131f, 0.468900383f},
std::array<float,2>{0.315798908f, 0.983374178f},
std::array<float,2>{0.5112679f, 0.321985841f},
std::array<float,2>{0.823876917f, 0.5923388f},
std::array<float,2>{0.0380633548f, 0.109413885f},
std::array<float,2>{0.412702024f, 0.501041472f},
std::array<float,2>{0.70145905f, 0.0574624166f},
std::array<float,2>{0.955429971f, 0.876018703f},
std::array<float,2>{0.242978096f, 0.272874564f},
std::array<float,2>{0.0827334672f, 0.870122492f},
std::array<float,2>{0.782661498f, 0.428558975f},
std::array<float,2>{0.579949737f, 0.673609912f},
std::array<float,2>{0.296422154f, 0.182286486f},
std::array<float,2>{0.0302350707f, 0.596246123f},
std::array<float,2>{0.851922452f, 0.0692353845f},
std::array<float,2>{0.560727119f, 0.951873839f},
std::array<float,2>{0.373219281f, 0.355596185f},
std::array<float,2>{0.486280322f, 0.784085095f},
std::array<float,2>{0.678622425f, 0.455640554f},
std::array<float,2>{0.892375171f, 0.706460953f},
std::array<float,2>{0.136003718f, 0.226118863f},
std::array<float,2>{0.27892676f, 0.631408513f},
std::array<float,2>{0.61829412f, 0.138198107f},
std::array<float,2>{0.77353543f, 0.813297451f},
std::array<float,2>{0.120527811f, 0.404286146f},
std::array<float,2>{0.195501819f, 0.908277988f},
std::array<float,2>{0.980413556f, 0.297537267f},
std::array<float,2>{0.723141134f, 0.555294394f},
std::array<float,2>{0.390981644f, 0.0145213017f},
std::array<float,2>{0.103026569f, 0.66206634f},
std::array<float,2>{0.753292322f, 0.167610809f},
std::array<float,2>{0.599296033f, 0.84678334f},
std::array<float,2>{0.254330188f, 0.410431474f},
std::array<float,2>{0.379163235f, 0.897461176f},
std::array<float,2>{0.748620927f, 0.25228399f},
std::array<float,2>{0.993200958f, 0.531179607f},
std::array<float,2>{0.21014002f, 0.0339216739f},
std::array<float,2>{0.346718341f, 0.575671732f},
std::array<float,2>{0.534393668f, 0.10803239f},
std::array<float,2>{0.862699986f, 0.993903935f},
std::array<float,2>{0.00183828908f, 0.340990335f},
std::array<float,2>{0.147492662f, 0.757967651f},
std::array<float,2>{0.888478696f, 0.492454052f},
std::array<float,2>{0.658712447f, 0.721533954f},
std::array<float,2>{0.475590527f, 0.214550123f},
std::array<float,2>{0.230108202f, 0.539634109f},
std::array<float,2>{0.95132184f, 0.0275247246f},
std::array<float,2>{0.710859895f, 0.926783085f},
std::array<float,2>{0.422211051f, 0.295455456f},
std::array<float,2>{0.304906934f, 0.831848025f},
std::array<float,2>{0.569188833f, 0.386924297f},
std::array<float,2>{0.807172716f, 0.646785259f},
std::array<float,2>{0.0625159815f, 0.147611216f},
std::array<float,2>{0.45069769f, 0.69828254f},
std::array<float,2>{0.641083837f, 0.237763107f},
std::array<float,2>{0.917554975f, 0.809286952f},
std::array<float,2>{0.162351608f, 0.445856273f},
std::array<float,2>{0.0560439862f, 0.9660694f},
std::array<float,2>{0.834052503f, 0.372291833f},
std::array<float,2>{0.51899159f, 0.624629378f},
std::array<float,2>{0.336375505f, 0.0853682533f},
std::array<float,2>{0.212905079f, 0.653978825f},
std::array<float,2>{0.9887622f, 0.152733698f},
std::array<float,2>{0.737114608f, 0.838463604f},
std::array<float,2>{0.386277288f, 0.382752478f},
std::array<float,2>{0.25788191f, 0.934228182f},
std::array<float,2>{0.606074452f, 0.284304261f},
std::array<float,2>{0.763651848f, 0.534816027f},
std::array<float,2>{0.0980429649f, 0.0212202985f},
std::array<float,2>{0.482432246f, 0.610579967f},
std::array<float,2>{0.668328404f, 0.0864880458f},
std::array<float,2>{0.881314278f, 0.954343975f},
std::array<float,2>{0.148765072f, 0.36007151f},
std::array<float,2>{0.0114641637f, 0.797749102f},
std::array<float,2>{0.873360455f, 0.444835693f},
std::array<float,2>{0.539256215f, 0.691075027f},
std::array<float,2>{0.353961974f, 0.247666478f},
std::array<float,2>{0.0726846755f, 0.52053535f},
std::array<float,2>{0.800274312f, 0.0405916125f},
std::array<float,2>{0.572838724f, 0.898837745f},
std::array<float,2>{0.3012622f, 0.265081048f},
std::array<float,2>{0.432235479f, 0.856077313f},
std::array<float,2>{0.711528301f, 0.419454128f},
std::array<float,2>{0.944893956f, 0.665413558f},
std::array<float,2>{0.22432676f, 0.16095145f},
std::array<float,2>{0.333318472f, 0.733948529f},
std::array<float,2>{0.52624315f, 0.206781268f},
std::array<float,2>{0.841930449f, 0.756136715f},
std::array<float,2>{0.0511292554f, 0.490125984f},
std::array<float,2>{0.164305285f, 0.986160278f},
std::array<float,2>{0.911290467f, 0.33571133f},
std::array<float,2>{0.649672985f, 0.566900551f},
std::array<float,2>{0.440289855f, 0.100959793f},
std::array<float,2>{0.0396676473f, 0.717660725f},
std::array<float,2>{0.813454747f, 0.232958585f},
std::array<float,2>{0.50435394f, 0.789373934f},
std::array<float,2>{0.321159095f, 0.466856837f},
std::array<float,2>{0.457051128f, 0.939121008f},
std::array<float,2>{0.63577199f, 0.350029677f},
std::array<float,2>{0.927172303f, 0.60676074f},
std::array<float,2>{0.184168056f, 0.0780845806f},
std::array<float,2>{0.283177316f, 0.554136753f},
std::array<float,2>{0.589840949f, 0.00711262226f},
std::array<float,2>{0.793318093f, 0.918383896f},
std::array<float,2>{0.0900841355f, 0.309406549f},
std::array<float,2>{0.238496333f, 0.820728302f},
std::array<float,2>{0.967551231f, 0.397445291f},
std::array<float,2>{0.689831972f, 0.640289366f},
std::array<float,2>{0.415087163f, 0.127262443f},
std::array<float,2>{0.126773521f, 0.580985606f},
std::array<float,2>{0.900495887f, 0.12224301f},
std::array<float,2>{0.684727073f, 0.969220936f},
std::array<float,2>{0.494736403f, 0.319716305f},
std::array<float,2>{0.360522717f, 0.774316788f},
std::array<float,2>{0.549562633f, 0.478471786f},
std::array<float,2>{0.847397029f, 0.747463703f},
std::array<float,2>{0.0208448432f, 0.191074103f},
std::array<float,2>{0.401269436f, 0.681862414f},
std::array<float,2>{0.731815815f, 0.173113212f},
std::array<float,2>{0.975462139f, 0.862122059f},
std::array<float,2>{0.191782892f, 0.434720695f},
std::array<float,2>{0.110375576f, 0.88543278f},
std::array<float,2>{0.76771611f, 0.281237036f},
std::array<float,2>{0.61017108f, 0.515599668f},
std::array<float,2>{0.27194196f, 0.0520797744f},
std::array<float,2>{0.202563941f, 0.728265703f},
std::array<float,2>{0.981905878f, 0.209507331f},
std::array<float,2>{0.718765914f, 0.750723541f},
std::array<float,2>{0.397236615f, 0.48769474f},
std::array<float,2>{0.273772717f, 0.991593063f},
std::array<float,2>{0.624633014f, 0.330189705f},
std::array<float,2>{0.779555261f, 0.565273523f},
std::array<float,2>{0.121834897f, 0.096547462f},
std::array<float,2>{0.491897136f, 0.516455054f},
std::array<float,2>{0.674939334f, 0.0447062664f},
std::array<float,2>{0.894923568f, 0.903415203f},
std::array<float,2>{0.138556451f, 0.258315176f},
std::array<float,2>{0.0268866643f, 0.853640079f},
std::array<float,2>{0.856562018f, 0.416355282f},
std::array<float,2>{0.558212042f, 0.670393765f},
std::array<float,2>{0.367560595f, 0.157760173f},
std::array<float,2>{0.0786406547f, 0.615829289f},
std::array<float,2>{0.788517177f, 0.0924696326f},
std::array<float,2>{0.582040727f, 0.95914042f},
std::array<float,2>{0.289977223f, 0.365925014f},
std::array<float,2>{0.406721324f, 0.801230788f},
std::array<float,2>{0.696692467f, 0.439100742f},
std::array<float,2>{0.957556188f, 0.691629827f},
std::array<float,2>{0.248136818f, 0.242989808f},
std::array<float,2>{0.316864729f, 0.649449229f},
std::array<float,2>{0.511954844f, 0.150726318f},
std::array<float,2>{0.827121496f, 0.842838347f},
std::array<float,2>{0.0336504467f, 0.377130955f},
std::array<float,2>{0.178139925f, 0.932065547f},
std::array<float,2>{0.931960225f, 0.286510795f},
std::array<float,2>{0.626386642f, 0.537071586f},
std::array<float,2>{0.464648545f, 0.0195243675f},
std::array<float,2>{0.058899384f, 0.686428905f},
std::array<float,2>{0.830245733f, 0.178292111f},
std::array<float,2>{0.52018708f, 0.863736689f},
std::array<float,2>{0.341498375f, 0.43189469f},
std::array<float,2>{0.445559621f, 0.889201641f},
std::array<float,2>{0.648378015f, 0.274173051f},
std::array<float,2>{0.921373606f, 0.508042634f},
std::array<float,2>{0.156332105f, 0.0476790033f},
std::array<float,2>{0.310664088f, 0.584134698f},
std::array<float,2>{0.562874615f, 0.117977545f},
std::array<float,2>{0.810370684f, 0.973436654f},
std::array<float,2>{0.068170622f, 0.315594405f},
std::array<float,2>{0.231783584f, 0.77897644f},
std::array<float,2>{0.946222186f, 0.482436419f},
std::array<float,2>{0.70548147f, 0.74413085f},
std::array<float,2>{0.428114593f, 0.193739787f},
std::array<float,2>{0.141675532f, 0.548782706f},
std::array<float,2>{0.884318054f, 2.49664481e-05f},
std::array<float,2>{0.661041796f, 0.915644705f},
std::array<float,2>{0.471079469f, 0.308511287f},
std::array<float,2>{0.351290733f, 0.827183127f},
std::array<float,2>{0.538930237f, 0.393109441f},
std::array<float,2>{0.866772234f, 0.632865191f},
std::array<float,2>{0.00539479824f, 0.130451486f},
std::array<float,2>{0.375885189f, 0.71219784f},
std::array<float,2>{0.742297828f, 0.227046043f},
std::array<float,2>{0.999193609f, 0.796700358f},
std::array<float,2>{0.203697592f, 0.461566001f},
std::array<float,2>{0.106658563f, 0.94168365f},
std::array<float,2>{0.75491488f, 0.343916357f},
std::array<float,2>{0.59437561f, 0.601947844f},
std::array<float,2>{0.253048927f, 0.0722864419f},
std::array<float,2>{0.170166343f, 0.626832008f},
std::array<float,2>{0.906524122f, 0.134571627f},
std::array<float,2>{0.654704034f, 0.81653595f},
std::array<float,2>{0.444601864f, 0.40125677f},
std::array<float,2>{0.328635693f, 0.911350012f},
std::array<float,2>{0.527858555f, 0.303265482f},
std::array<float,2>{0.836126745f, 0.560162067f},
std::array<float,2>{0.046987772f, 0.00810967479f},
std::array<float,2>{0.434525847f, 0.598195076f},
std::array<float,2>{0.715844274f, 0.0644981414f},
std::array<float,2>{0.938292325f, 0.947461545f},
std::array<float,2>{0.221638411f, 0.351654857f},
std::array<float,2>{0.0760327354f, 0.788987339f},
std::array<float,2>{0.800813198f, 0.459626526f},
std::array<float,2>{0.576568842f, 0.70906657f},
std::array<float,2>{0.298455417f, 0.222209558f},
std::array<float,2>{0.0134666432f, 0.506004155f},
std::array<float,2>{0.86761272f, 0.0589805469f},
std::array<float,2>{0.545900762f, 0.879181981f},
std::array<float,2>{0.358657092f, 0.267159015f},
std::array<float,2>{0.478310227f, 0.871130705f},
std::array<float,2>{0.666742861f, 0.423702449f},
std::array<float,2>{0.877539754f, 0.676199317f},
std::array<float,2>{0.155676052f, 0.184932932f},
std::array<float,2>{0.262414128f, 0.737400413f},
std::array<float,2>{0.605275452f, 0.196285188f},
std::array<float,2>{0.759548903f, 0.770412922f},
std::array<float,2>{0.0956696048f, 0.473075837f},
std::array<float,2>{0.216037586f, 0.97918272f},
std::array<float,2>{0.986190557f, 0.327594757f},
std::array<float,2>{0.739103675f, 0.587827206f},
std::array<float,2>{0.387084812f, 0.113285162f},
std::array<float,2>{0.115435302f, 0.701639712f},
std::array<float,2>{0.772372782f, 0.241043314f},
std::array<float,2>{0.614061773f, 0.805472314f},
std::array<float,2>{0.267970026f, 0.452052206f},
std::array<float,2>{0.402854174f, 0.961500108f},
std::array<float,2>{0.727509499f, 0.368463695f},
std::array<float,2>{0.969843447f, 0.617561817f},
std::array<float,2>{0.191339567f, 0.0795062631f},
std::array<float,2>{0.364847392f, 0.546277821f},
std::array<float,2>{0.552186668f, 0.024213735f},
std::array<float,2>{0.851075768f, 0.923792243f},
std::array<float,2>{0.0192872956f, 0.292523533f},
std::array<float,2>{0.130814761f, 0.833346963f},
std::array<float,2>{0.902935266f, 0.384922177f},
std::array<float,2>{0.682308912f, 0.644128561f},
std::array<float,2>{0.497838438f, 0.143705532f},
std::array<float,2>{0.237157732f, 0.572905719f},
std::array<float,2>{0.962599933f, 0.103560843f},
std::array<float,2>{0.694707096f, 0.996920705f},
std::array<float,2>{0.421349436f, 0.335990667f},
std::array<float,2>{0.286013424f, 0.765194237f},
std::array<float,2>{0.592396259f, 0.496833265f},
std::array<float,2>{0.792314768f, 0.725795269f},
std::array<float,2>{0.0869526789f, 0.218702137f},
std::array<float,2>{0.454607636f, 0.657088757f},
std::array<float,2>{0.638290524f, 0.171058908f},
std::array<float,2>{0.924442589f, 0.847858906f},
std::array<float,2>{0.183170661f, 0.407035291f},
std::array<float,2>{0.0442268103f, 0.891039252f},
std::array<float,2>{0.817991614f, 0.254844844f},
std::array<float,2>{0.50112319f, 0.525191963f},
std::array<float,2>{0.326357812f, 0.0367130786f},
std::array<float,2>{0.134762064f, 0.703287601f},
std::array<float,2>{0.893590152f, 0.224012613f},
std::array<float,2>{0.676887453f, 0.782887459f},
std::array<float,2>{0.487264901f, 0.453526914f},
std::array<float,2>{0.372089803f, 0.9503299f},
std::array<float,2>{0.559227586f, 0.358960509f},
std::array<float,2>{0.853838921f, 0.595563293f},
std::array<float,2>{0.0276680272f, 0.0673389807f},
std::array<float,2>{0.393570393f, 0.558304429f},
std::array<float,2>{0.724637806f, 0.0130610485f},
std::array<float,2>{0.977999806f, 0.908051848f},
std::array<float,2>{0.198672995f, 0.300414979f},
std::array<float,2>{0.117857121f, 0.815792382f},
std::array<float,2>{0.776848435f, 0.405447006f},
std::array<float,2>{0.620212555f, 0.629191279f},
std::array<float,2>{0.280833453f, 0.139842734f},
std::array<float,2>{0.0360745713f, 0.591646969f},
std::array<float,2>{0.82167536f, 0.113001309f},
std::array<float,2>{0.508672833f, 0.980505884f},
std::array<float,2>{0.313236266f, 0.322463304f},
std::array<float,2>{0.465167612f, 0.769022882f},
std::array<float,2>{0.631503344f, 0.47082293f},
std::array<float,2>{0.937446415f, 0.740906954f},
std::array<float,2>{0.173305795f, 0.200780079f},
std::array<float,2>{0.294643849f, 0.675186276f},
std::array<float,2>{0.580102324f, 0.181221411f},
std::array<float,2>{0.783961892f, 0.868881643f},
std::array<float,2>{0.085361667f, 0.42611146f},
std::array<float,2>{0.245263919f, 0.877879798f},
std::array<float,2>{0.954206586f, 0.271037072f},
std::array<float,2>{0.699807286f, 0.503548443f},
std::array<float,2>{0.410610259f, 0.056518171f},
std::array<float,2>{0.0661406368f, 0.646173775f},
std::array<float,2>{0.805662274f, 0.145042673f},
std::array<float,2>{0.566426277f, 0.829973638f},
std::array<float,2>{0.307702094f, 0.389825344f},
std::array<float,2>{0.424222171f, 0.928645134f},
std::array<float,2>{0.7082358f, 0.293456495f},
std::array<float,2>{0.949872315f, 0.541175723f},
std::array<float,2>{0.228504613f, 0.0296114534f},
std::array<float,2>{0.339637399f, 0.622650802f},
std::array<float,2>{0.516321242f, 0.0834264085f},
std::array<float,2>{0.833648205f, 0.967708886f},
std::array<float,2>{0.058367528f, 0.374796957f},
std::array<float,2>{0.160975397f, 0.81094867f},
std::array<float,2>{0.914510369f, 0.448234886f},
std::array<float,2>{0.643715203f, 0.695821106f},
std::array<float,2>{0.452191144f, 0.235579267f},
std::array<float,2>{0.208263665f, 0.528236091f},
std::array<float,2>{0.99466455f, 0.0316442139f},
std::array<float,2>{0.746633291f, 0.896277428f},
std::array<float,2>{0.382140487f, 0.251526326f},
std::array<float,2>{0.256388456f, 0.845040858f},
std::array<float,2>{0.599912822f, 0.412747681f},
std::array<float,2>{0.751167178f, 0.662603259f},
std::array<float,2>{0.10367237f, 0.164268062f},
std::array<float,2>{0.474554032f, 0.718961298f},
std::array<float,2>{0.657455325f, 0.212241516f},
std::array<float,2>{0.890168011f, 0.760548353f},
std::array<float,2>{0.14597632f, 0.494415551f},
std::array<float,2>{0.00383831048f, 0.9956339f},
std::array<float,2>{0.859479427f, 0.342804521f},
std::array<float,2>{0.533133566f, 0.57750535f},
std::array<float,2>{0.345496118f, 0.107396856f},
std::array<float,2>{0.22518225f, 0.666958511f},
std::array<float,2>{0.942933917f, 0.16290164f},
std::array<float,2>{0.714167416f, 0.858512342f},
std::array<float,2>{0.430542201f, 0.4209795f},
std::array<float,2>{0.302745938f, 0.901858389f},
std::array<float,2>{0.571291924f, 0.263449013f},
std::array<float,2>{0.797168374f, 0.521990776f},
std::array<float,2>{0.0722019225f, 0.0426789187f},
std::array<float,2>{0.4381845f, 0.570015788f},
std::array<float,2>{0.650446415f, 0.0976808891f},
std::array<float,2>{0.91297698f, 0.987217009f},
std::array<float,2>{0.166206419f, 0.333233356f},
std::array<float,2>{0.0537537001f, 0.753969848f},
std::array<float,2>{0.840283751f, 0.490812391f},
std::array<float,2>{0.525097251f, 0.730606735f},
std::array<float,2>{0.335819989f, 0.203776628f},
std::array<float,2>{0.1001762f, 0.532823622f},
std::array<float,2>{0.765567183f, 0.0215239134f},
std::array<float,2>{0.609020174f, 0.936653674f},
std::array<float,2>{0.261117369f, 0.281833708f},
std::array<float,2>{0.383609414f, 0.837235332f},
std::array<float,2>{0.735186517f, 0.380793452f},
std::array<float,2>{0.992177188f, 0.655102611f},
std::array<float,2>{0.212144926f, 0.155630678f},
std::array<float,2>{0.352773428f, 0.689113915f},
std::array<float,2>{0.542939723f, 0.248213157f},
std::array<float,2>{0.872796118f, 0.800085008f},
std::array<float,2>{0.00973092671f, 0.442484379f},
std::array<float,2>{0.150753573f, 0.955221832f},
std::array<float,2>{0.879707932f, 0.362305105f},
std::array<float,2>{0.670967579f, 0.612223148f},
std::array<float,2>{0.481703162f, 0.0884469673f},
std::array<float,2>{0.0231960099f, 0.749767661f},
std::array<float,2>{0.843898296f, 0.187645227f},
std::array<float,2>{0.547420263f, 0.776430726f},
std::array<float,2>{0.361393332f, 0.479524016f},
std::array<float,2>{0.492526889f, 0.972094238f},
std::array<float,2>{0.68661809f, 0.317997158f},
std::array<float,2>{0.899045885f, 0.578542471f},
std::array<float,2>{0.127262101f, 0.123440176f},
std::array<float,2>{0.270804644f, 0.512878239f},
std::array<float,2>{0.613054156f, 0.0546768904f},
std::array<float,2>{0.766466856f, 0.88449043f},
std::array<float,2>{0.11163941f, 0.278096616f},
std::array<float,2>{0.195006132f, 0.859741807f},
std::array<float,2>{0.973944187f, 0.437296152f},
std::array<float,2>{0.733948886f, 0.680064857f},
std::array<float,2>{0.39981547f, 0.175425723f},
std::array<float,2>{0.185586154f, 0.607635558f},
std::array<float,2>{0.928443968f, 0.0757049769f},
std::array<float,2>{0.633373559f, 0.941282392f},
std::array<float,2>{0.460449457f, 0.348867655f},
std::array<float,2>{0.324013591f, 0.792702734f},
std::array<float,2>{0.506875634f, 0.466195613f},
std::array<float,2>{0.815256417f, 0.715499759f},
std::array<float,2>{0.042584803f, 0.23170428f},
std::array<float,2>{0.41720739f, 0.63858366f},
std::array<float,2>{0.687844157f, 0.125349492f},
std::array<float,2>{0.964876771f, 0.823225796f},
std::array<float,2>{0.240732685f, 0.394715488f},
std::array<float,2>{0.09199889f, 0.920407116f},
std::array<float,2>{0.795278132f, 0.312323302f},
std::array<float,2>{0.587784111f, 0.551903427f},
std::array<float,2>{0.284112483f, 0.00546104368f},
std::array<float,2>{0.204738632f, 0.714654863f},
std::array<float,2>{0.99852252f, 0.229717553f},
std::array<float,2>{0.743635356f, 0.793959439f},
std::array<float,2>{0.376016051f, 0.463331074f},
std::array<float,2>{0.252259105f, 0.944301426f},
std::array<float,2>{0.595618367f, 0.34728846f},
std::array<float,2>{0.754000843f, 0.603733897f},
std::array<float,2>{0.105987012f, 0.0713608339f},
std::array<float,2>{0.471933693f, 0.550119579f},
std::array<float,2>{0.661786497f, 0.0036272225f},
std::array<float,2>{0.883469939f, 0.917740881f},
std::array<float,2>{0.140921026f, 0.306468397f},
std::array<float,2>{0.00406756019f, 0.825687706f},
std::array<float,2>{0.865323186f, 0.391974419f},
std::array<float,2>{0.537558377f, 0.636173725f},
std::array<float,2>{0.34979248f, 0.132685706f},
std::array<float,2>{0.0668671355f, 0.58318305f},
std::array<float,2>{0.809494495f, 0.119756453f},
std::array<float,2>{0.563762128f, 0.975477159f},
std::array<float,2>{0.31185326f, 0.313504845f},
std::array<float,2>{0.429533333f, 0.780301392f},
std::array<float,2>{0.706301033f, 0.482049137f},
std::array<float,2>{0.947261274f, 0.745663166f},
std::array<float,2>{0.231273592f, 0.191821098f},
std::array<float,2>{0.33985281f, 0.68423003f},
std::array<float,2>{0.520527422f, 0.176550314f},
std::array<float,2>{0.831141055f, 0.866300523f},
std::array<float,2>{0.0603572316f, 0.431298941f},
std::array<float,2>{0.157725915f, 0.887265861f},
std::array<float,2>{0.920600951f, 0.27670756f},
std::array<float,2>{0.64651376f, 0.511305153f},
std::array<float,2>{0.4466438f, 0.0500758365f},
std::array<float,2>{0.0350124016f, 0.65155834f},
std::array<float,2>{0.827419758f, 0.149626419f},
std::array<float,2>{0.51302439f, 0.84124583f},
std::array<float,2>{0.317467153f, 0.375339776f},
std::array<float,2>{0.463698596f, 0.930880189f},
std::array<float,2>{0.625346422f, 0.287193f},
std::array<float,2>{0.932935596f, 0.537409544f},
std::array<float,2>{0.179631621f, 0.0157967974f},
std::array<float,2>{0.290996075f, 0.613891423f},
std::array<float,2>{0.583118439f, 0.0908253565f},
std::array<float,2>{0.787859499f, 0.957157493f},
std::array<float,2>{0.0798873901f, 0.364868581f},
std::array<float,2>{0.249368206f, 0.804362476f},
std::array<float,2>{0.958499491f, 0.440713733f},
std::array<float,2>{0.695869088f, 0.693957865f},
std::array<float,2>{0.407481879f, 0.245064199f},
std::array<float,2>{0.137083411f, 0.519403875f},
std::array<float,2>{0.896346688f, 0.046168182f},
std::array<float,2>{0.674471319f, 0.904351056f},
std::array<float,2>{0.490442067f, 0.260509908f},
std::array<float,2>{0.368403882f, 0.851609886f},
std::array<float,2>{0.556806684f, 0.414662331f},
std::array<float,2>{0.855552375f, 0.669383168f},
std::array<float,2>{0.02547759f, 0.158480689f},
std::array<float,2>{0.398090124f, 0.728551805f},
std::array<float,2>{0.719866216f, 0.207545742f},
std::array<float,2>{0.980670154f, 0.752607942f},
std::array<float,2>{0.201818839f, 0.484493822f},
std::array<float,2>{0.122635201f, 0.988286257f},
std::array<float,2>{0.78049475f, 0.328834653f},
std::array<float,2>{0.623356462f, 0.563378751f},
std::array<float,2>{0.274600565f, 0.0949965641f},
std::array<float,2>{0.181892589f, 0.659670234f},
std::array<float,2>{0.925118685f, 0.16936937f},
std::array<float,2>{0.636743426f, 0.850942791f},
std::array<float,2>{0.453497171f, 0.408562303f},
std::array<float,2>{0.32774052f, 0.893841505f},
std::array<float,2>{0.5003438f, 0.257612348f},
std::array<float,2>{0.816442192f, 0.52610296f},
std::array<float,2>{0.0432262085f, 0.0383560508f},
std::array<float,2>{0.420302778f, 0.570454597f},
std::array<float,2>{0.694090962f, 0.103270493f},
std::array<float,2>{0.96158874f, 0.999295592f},
std::array<float,2>{0.237360984f, 0.338854581f},
std::array<float,2>{0.0863705948f, 0.762170434f},
std::array<float,2>{0.791395843f, 0.499616057f},
std::array<float,2>{0.593315661f, 0.72451359f},
std::array<float,2>{0.286956906f, 0.215342477f},
std::array<float,2>{0.0182470679f, 0.544143021f},
std::array<float,2>{0.850194931f, 0.0260699056f},
std::array<float,2>{0.55079031f, 0.923995852f},
std::array<float,2>{0.364121765f, 0.289482147f},
std::array<float,2>{0.496415347f, 0.835163295f},
std::array<float,2>{0.682979643f, 0.384192944f},
std::array<float,2>{0.903818429f, 0.642461777f},
std::array<float,2>{0.129675552f, 0.141532063f},
std::array<float,2>{0.268669814f, 0.700886428f},
std::array<float,2>{0.615178585f, 0.239051908f},
std::array<float,2>{0.773133993f, 0.807778239f},
std::array<float,2>{0.116913103f, 0.451042563f},
std::array<float,2>{0.189847082f, 0.963949323f},
std::array<float,2>{0.969341218f, 0.370362997f},
std::array<float,2>{0.727553129f, 0.620398283f},
std::array<float,2>{0.403627068f, 0.0810856149f},
std::array<float,2>{0.0941717997f, 0.734448731f},
std::array<float,2>{0.758087814f, 0.198400542f},
std::array<float,2>{0.604022563f, 0.771678746f},
std::array<float,2>{0.263162941f, 0.475502938f},
std::array<float,2>{0.388492256f, 0.977561593f},
std::array<float,2>{0.739842653f, 0.325451195f},
std::array<float,2>{0.984594107f, 0.589008808f},
std::array<float,2>{0.215069577f, 0.117049754f},
std::array<float,2>{0.358222216f, 0.505432487f},
std::array<float,2>{0.545430124f, 0.0624581203f},
std::array<float,2>{0.869018197f, 0.881261706f},
std::array<float,2>{0.0124625796f, 0.268433511f},
std::array<float,2>{0.154735118f, 0.873888195f},
std::array<float,2>{0.878122509f, 0.425690442f},
std::array<float,2>{0.667196035f, 0.678051293f},
std::array<float,2>{0.477218121f, 0.18625769f},
std::array<float,2>{0.221805066f, 0.600030303f},
std::array<float,2>{0.938911438f, 0.0641293377f},
std::array<float,2>{0.715031326f, 0.946320057f},
std::array<float,2>{0.43537277f, 0.353915721f},
std::array<float,2>{0.297245145f, 0.785989344f},
std::array<float,2>{0.577304661f, 0.457253307f},
std::array<float,2>{0.801771283f, 0.707617223f},
std::array<float,2>{0.0746295601f, 0.218779832f},
std::array<float,2>{0.444077671f, 0.627506912f},
std::array<float,2>{0.655855119f, 0.135804474f},
std::array<float,2>{0.908173859f, 0.8202191f},
std::array<float,2>{0.171628401f, 0.398753434f},
std::array<float,2>{0.0486109331f, 0.912642717f},
std::array<float,2>{0.837124228f, 0.301325589f},
std::array<float,2>{0.528666973f, 0.561477959f},
std::array<float,2>{0.329452425f, 0.0102750231f},
std::array<float,2>{0.145127788f, 0.722207427f},
std::array<float,2>{0.889221966f, 0.212948427f},
std::array<float,2>{0.656639934f, 0.759002328f},
std::array<float,2>{0.472994328f, 0.493413448f},
std::array<float,2>{0.344065636f, 0.992725909f},
std::array<float,2>{0.531287551f, 0.340345591f},
std::array<float,2>{0.860695362f, 0.574745119f},
std::array<float,2>{0.00224822666f, 0.108875424f},
std::array<float,2>{0.381721616f, 0.529849887f},
std::array<float,2>{0.747744083f, 0.034206003f},
std::array<float,2>{0.995445609f, 0.896569788f},
std::array<float,2>{0.20748423f, 0.253719509f},
std::array<float,2>{0.104514018f, 0.846244574f},
std::array<float,2>{0.750466228f, 0.411889404f},
std::array<float,2>{0.600961566f, 0.660223246f},
std::array<float,2>{0.256924957f, 0.166387379f},
std::array<float,2>{0.057281848f, 0.623571575f},
std::array<float,2>{0.832917213f, 0.0843089223f},
std::array<float,2>{0.517275751f, 0.965530992f},
std::array<float,2>{0.338803649f, 0.371994942f},
std::array<float,2>{0.451918006f, 0.810343266f},
std::array<float,2>{0.642607033f, 0.446903199f},
std::array<float,2>{0.91591382f, 0.697353899f},
std::array<float,2>{0.161207318f, 0.236530349f},
std::array<float,2>{0.306958318f, 0.648041129f},
std::array<float,2>{0.567939639f, 0.147134766f},
std::array<float,2>{0.80599308f, 0.830266178f},
std::array<float,2>{0.0648305789f, 0.388629675f},
std::array<float,2>{0.227147549f, 0.926347196f},
std::array<float,2>{0.950766087f, 0.296535909f},
std::array<float,2>{0.707593024f, 0.540693998f},
std::array<float,2>{0.425507009f, 0.0283748228f},
std::array<float,2>{0.0847726241f, 0.672176898f},
std::array<float,2>{0.784996212f, 0.183286875f},
std::array<float,2>{0.581379116f, 0.869682133f},
std::array<float,2>{0.293100506f, 0.429669797f},
std::array<float,2>{0.411784679f, 0.875757694f},
std::array<float,2>{0.700521111f, 0.272215694f},
std::array<float,2>{0.95312804f, 0.50055486f},
std::array<float,2>{0.244558781f, 0.0580042787f},
std::array<float,2>{0.313842952f, 0.592976511f},
std::array<float,2>{0.508867681f, 0.110440329f},
std::array<float,2>{0.820509195f, 0.983675957f},
std::array<float,2>{0.0366028585f, 0.321199954f},
std::array<float,2>{0.172036558f, 0.766862214f},
std::array<float,2>{0.935676455f, 0.470309883f},
std::array<float,2>{0.632252634f, 0.738919139f},
std::array<float,2>{0.466793597f, 0.202947572f},
std::array<float,2>{0.197962299f, 0.555726171f},
std::array<float,2>{0.976964176f, 0.0146552697f},
std::array<float,2>{0.726432383f, 0.909901857f},
std::array<float,2>{0.392610043f, 0.298171163f},
std::array<float,2>{0.279411912f, 0.813775778f},
std::array<float,2>{0.619880676f, 0.402649224f},
std::array<float,2>{0.776280582f, 0.631909549f},
std::array<float,2>{0.119004123f, 0.137270913f},
std::array<float,2>{0.488182932f, 0.705958784f},
std::array<float,2>{0.676032364f, 0.225002185f},
std::array<float,2>{0.892916977f, 0.784833252f},
std::array<float,2>{0.133593678f, 0.45687443f},
std::array<float,2>{0.0284885783f, 0.952978611f},
std::array<float,2>{0.854536593f, 0.356535733f},
std::array<float,2>{0.560457528f, 0.597317576f},
std::array<float,2>{0.37156415f, 0.069685407f},
std::array<float,2>{0.241509303f, 0.638726413f},
std::array<float,2>{0.966149926f, 0.128533244f},
std::array<float,2>{0.688788474f, 0.822083354f},
std::array<float,2>{0.416763633f, 0.398241401f},
std::array<float,2>{0.284347594f, 0.919464767f},
std::array<float,2>{0.586149931f, 0.309722573f},
std::array<float,2>{0.796871066f, 0.552880406f},
std::array<float,2>{0.0929906666f, 0.00647303183f},
std::array<float,2>{0.459247738f, 0.605656683f},
std::array<float,2>{0.634396493f, 0.0765809193f},
std::array<float,2>{0.929097533f, 0.938138485f},
std::array<float,2>{0.187168092f, 0.35128805f},
std::array<float,2>{0.0418924838f, 0.790061653f},
std::array<float,2>{0.816300333f, 0.467829555f},
std::array<float,2>{0.505973697f, 0.717775702f},
std::array<float,2>{0.323072046f, 0.234260112f},
std::array<float,2>{0.112892926f, 0.513825178f},
std::array<float,2>{0.766618729f, 0.0510137901f},
std::array<float,2>{0.611512363f, 0.886061728f},
std::array<float,2>{0.270460159f, 0.279753596f},
std::array<float,2>{0.398894221f, 0.862943411f},
std::array<float,2>{0.733226836f, 0.434376478f},
std::array<float,2>{0.973428845f, 0.683363378f},
std::array<float,2>{0.193840876f, 0.171955556f},
std::array<float,2>{0.362634182f, 0.746608555f},
std::array<float,2>{0.548083603f, 0.190236688f},
std::array<float,2>{0.84537369f, 0.774437308f},
std::array<float,2>{0.0215165894f, 0.477424085f},
std::array<float,2>{0.128012434f, 0.969784141f},
std::array<float,2>{0.900330365f, 0.318415731f},
std::array<float,2>{0.685967445f, 0.582022309f},
std::array<float,2>{0.493360162f, 0.121135302f},
std::array<float,2>{0.00824728142f, 0.690248013f},
std::array<float,2>{0.871125221f, 0.246499032f},
std::array<float,2>{0.54181993f, 0.798166037f},
std::array<float,2>{0.351861984f, 0.443465203f},
std::array<float,2>{0.480913579f, 0.953702509f},
std::array<float,2>{0.669945121f, 0.360520542f},
std::array<float,2>{0.880175292f, 0.609630167f},
std::array<float,2>{0.152297437f, 0.0876136199f},
std::array<float,2>{0.260473073f, 0.533751726f},
std::array<float,2>{0.607922256f, 0.0204579588f},
std::array<float,2>{0.763843119f, 0.935134292f},
std::array<float,2>{0.10080006f, 0.283441991f},
std::array<float,2>{0.211057618f, 0.839342654f},
std::array<float,2>{0.990641475f, 0.381190151f},
std::array<float,2>{0.735670924f, 0.652593613f},
std::array<float,2>{0.384499073f, 0.153455287f},
std::array<float,2>{0.167946562f, 0.567824066f},
std::array<float,2>{0.913952649f, 0.100116596f},
std::array<float,2>{0.652307689f, 0.98477f},
std::array<float,2>{0.438633263f, 0.334068507f},
std::array<float,2>{0.334881753f, 0.757661343f},
std::array<float,2>{0.523650169f, 0.488292754f},
std::array<float,2>{0.841281533f, 0.732490301f},
std::array<float,2>{0.053596925f, 0.205366746f},
std::array<float,2>{0.430720508f, 0.664624631f},
std::array<float,2>{0.713366508f, 0.162057534f},
std::array<float,2>{0.941821814f, 0.857102036f},
std::array<float,2>{0.2261969f, 0.418238372f},
std::array<float,2>{0.0706847385f, 0.900150239f},
std::array<float,2>{0.79824245f, 0.263993144f},
std::array<float,2>{0.570602357f, 0.520061195f},
std::array<float,2>{0.304615289f, 0.0392452888f},
std::array<float,2>{0.233983457f, 0.74222815f},
std::array<float,2>{0.948030949f, 0.194755003f},
std::array<float,2>{0.704378486f, 0.777753711f},
std::array<float,2>{0.426113546f, 0.484013468f},
std::array<float,2>{0.310413212f, 0.974368274f},
std::array<float,2>{0.565543473f, 0.314986676f},
std::array<float,2>{0.811863959f, 0.585583448f},
std::array<float,2>{0.0685896352f, 0.119056351f},
std::array<float,2>{0.448961884f, 0.508896768f},
std::array<float,2>{0.646424711f, 0.04788379f},
std::array<float,2>{0.91838181f, 0.890468836f},
std::array<float,2>{0.159456208f, 0.275001526f},
std::array<float,2>{0.0609771386f, 0.864678979f},
std::array<float,2>{0.830037892f, 0.43358773f},
std::array<float,2>{0.521727979f, 0.686575711f},
std::array<float,2>{0.343501687f, 0.179064751f},
std::array<float,2>{0.108560637f, 0.603327513f},
std::array<float,2>{0.756881773f, 0.0734681189f},
std::array<float,2>{0.596273839f, 0.94257021f},
std::array<float,2>{0.25132826f, 0.345642239f},
std::array<float,2>{0.378181428f, 0.795052052f},
std::array<float,2>{0.745192409f, 0.462464571f},
std::array<float,2>{0.996306002f, 0.711045802f},
std::array<float,2>{0.205907613f, 0.228261143f},
std::array<float,2>{0.34923175f, 0.634114623f},
std::array<float,2>{0.536422253f, 0.129691735f},
std::array<float,2>{0.863868117f, 0.826575518f},
std::array<float,2>{0.00702424999f, 0.394488603f},
std::array<float,2>{0.14297393f, 0.914189875f},
std::array<float,2>{0.886449218f, 0.307510942f},
std::array<float,2>{0.663903058f, 0.547313094f},
std::array<float,2>{0.470585376f, 0.00157610874f},
std::array<float,2>{0.0240002945f, 0.670903146f},
std::array<float,2>{0.858112276f, 0.156624943f},
std::array<float,2>{0.556252241f, 0.854526699f},
std::array<float,2>{0.369319737f, 0.417143404f},
std::array<float,2>{0.489984363f, 0.902505457f},
std::array<float,2>{0.672180653f, 0.258986771f},
std::array<float,2>{0.897379756f, 0.517117679f},
std::array<float,2>{0.139011934f, 0.0438748933f},
std::array<float,2>{0.277189672f, 0.565778553f},
std::array<float,2>{0.621599317f, 0.0966845453f},
std::array<float,2>{0.778988957f, 0.990825593f},
std::array<float,2>{0.124816798f, 0.331190586f},
std::array<float,2>{0.200799078f, 0.751743257f},
std::array<float,2>{0.984326601f, 0.487066269f},
std::array<float,2>{0.722419858f, 0.727313161f},
std::array<float,2>{0.396066666f, 0.210479721f},
std::array<float,2>{0.177310139f, 0.535157144f},
std::array<float,2>{0.930157542f, 0.0176613368f},
std::array<float,2>{0.626995802f, 0.933260441f},
std::array<float,2>{0.462367505f, 0.285804719f},
std::array<float,2>{0.320147723f, 0.84270674f},
std::array<float,2>{0.514997423f, 0.378295958f},
std::array<float,2>{0.825496078f, 0.649146855f},
std::array<float,2>{0.0323582292f, 0.151967838f},
std::array<float,2>{0.409676343f, 0.692817986f},
std::array<float,2>{0.698240876f, 0.243182525f},
std::array<float,2>{0.959230125f, 0.802439809f},
std::array<float,2>{0.24804315f, 0.437594444f},
std::array<float,2>{0.0817339122f, 0.960535407f},
std::array<float,2>{0.785692871f, 0.366914958f},
std::array<float,2>{0.584922552f, 0.616414309f},
std::array<float,2>{0.292704314f, 0.0931157917f},
std::array<float,2>{0.131083369f, 0.642626405f},
std::array<float,2>{0.904723644f, 0.142713487f},
std::array<float,2>{0.680648685f, 0.832485616f},
std::array<float,2>{0.499024361f, 0.385872632f},
std::array<float,2>{0.366298288f, 0.922605157f},
std::array<float,2>{0.55371815f, 0.291199178f},
std::array<float,2>{0.847819865f, 0.545117319f},
std::array<float,2>{0.0167027097f, 0.0250548441f},
std::array<float,2>{0.406104833f, 0.618608773f},
std::array<float,2>{0.730460882f, 0.0784721673f},
std::array<float,2>{0.971030295f, 0.962068021f},
std::array<float,2>{0.188787043f, 0.367977858f},
std::array<float,2>{0.113645554f, 0.806204915f},
std::array<float,2>{0.769554734f, 0.452437282f},
std::array<float,2>{0.616624355f, 0.703089833f},
std::array<float,2>{0.266185015f, 0.24205929f},
std::array<float,2>{0.0464844666f, 0.524229705f},
std::array<float,2>{0.819903612f, 0.0354779288f},
std::array<float,2>{0.503402889f, 0.892175972f},
std::array<float,2>{0.324382961f, 0.255753875f},
std::array<float,2>{0.455933064f, 0.848863065f},
std::array<float,2>{0.639515221f, 0.407415956f},
std::array<float,2>{0.923201859f, 0.657615244f},
std::array<float,2>{0.181388766f, 0.169973657f},
std::array<float,2>{0.288576216f, 0.725301981f},
std::array<float,2>{0.590143263f, 0.21696572f},
std::array<float,2>{0.789629579f, 0.76383394f},
std::array<float,2>{0.0882453769f, 0.49740991f},
std::array<float,2>{0.235201553f, 0.997367442f},
std::array<float,2>{0.963901818f, 0.337424695f},
std::array<float,2>{0.69151175f, 0.573577762f},
std::array<float,2>{0.418180048f, 0.105411828f},
std::array<float,2>{0.0775383189f, 0.710852444f},
std::array<float,2>{0.803429902f, 0.220817149f},
std::array<float,2>{0.575943828f, 0.788005769f},
std::array<float,2>{0.300460309f, 0.460633785f},
std::array<float,2>{0.436334044f, 0.948715508f},
std::array<float,2>{0.716948152f, 0.35275948f},
std::array<float,2>{0.940898001f, 0.599467754f},
std::array<float,2>{0.219771534f, 0.0661869124f},
std::array<float,2>{0.33101359f, 0.559072375f},
std::array<float,2>{0.531062901f, 0.00879038032f},
std::array<float,2>{0.837954879f, 0.910769165f},
std::array<float,2>{0.0493488796f, 0.303943098f},
std::array<float,2>{0.168698072f, 0.818025887f},
std::array<float,2>{0.909588099f, 0.402093381f},
std::array<float,2>{0.652435303f, 0.625708103f},
std::array<float,2>{0.441916287f, 0.133037508f},
std::array<float,2>{0.2175868f, 0.586864531f},
std::array<float,2>{0.987661123f, 0.114463903f},
std::array<float,2>{0.741692841f, 0.980010271f},
std::array<float,2>{0.390149564f, 0.326526105f},
std::array<float,2>{0.264124632f, 0.771045148f},
std::array<float,2>{0.60332644f, 0.473882973f},
std::array<float,2>{0.761070549f, 0.736730993f},
std::array<float,2>{0.0964243785f, 0.196400851f},
std::array<float,2>{0.479572535f, 0.677371502f},
std::array<float,2>{0.665597737f, 0.184361652f},
std::array<float,2>{0.876441836f, 0.872737408f},
std::array<float,2>{0.154169559f, 0.421976745f},
std::array<float,2>{0.0144006386f, 0.880545259f},
std::array<float,2>{0.870472729f, 0.266348273f},
std::array<float,2>{0.544397652f, 0.507316649f},
std::array<float,2>{0.355659097f, 0.0598463416f},
std::array<float,2>{0.163189083f, 0.696876764f},
std::array<float,2>{0.916483045f, 0.234794348f},
std::array<float,2>{0.642480314f, 0.812295973f},
std::array<float,2>{0.449916214f, 0.448637903f},
std::array<float,2>{0.337666601f, 0.968009412f},
std::array<float,2>{0.518293619f, 0.373964727f},
std::array<float,2>{0.835734904f, 0.621136785f},
std::array<float,2>{0.0554666594f, 0.0826425627f},
std::array<float,2>{0.423273265f, 0.542732656f},
std::array<float,2>{0.709837615f, 0.03104195f},
std::array<float,2>{0.952828348f, 0.929157078f},
std::array<float,2>{0.228593811f, 0.29418835f},
std::array<float,2>{0.0642726049f, 0.828359306f},
std::array<float,2>{0.807709515f, 0.389051884f},
std::array<float,2>{0.569469512f, 0.64530015f},
std::array<float,2>{0.306372613f, 0.145899475f},
std::array<float,2>{0.000379197882f, 0.57691896f},
std::array<float,2>{0.861668348f, 0.106365055f},
std::array<float,2>{0.533650935f, 0.99504149f},
std::array<float,2>{0.346283793f, 0.342263818f},
std::array<float,2>{0.474849284f, 0.760787666f},
std::array<float,2>{0.659196198f, 0.495872796f},
std::array<float,2>{0.886738539f, 0.7200858f},
std::array<float,2>{0.146664798f, 0.211687058f},
std::array<float,2>{0.254896641f, 0.664055824f},
std::array<float,2>{0.597956598f, 0.165462688f},
std::array<float,2>{0.752145946f, 0.844591022f},
std::array<float,2>{0.102075793f, 0.413653642f},
std::array<float,2>{0.209509552f, 0.894824326f},
std::array<float,2>{0.992576957f, 0.250558943f},
std::array<float,2>{0.749466538f, 0.529133201f},
std::array<float,2>{0.380817294f, 0.0322440527f},
std::array<float,2>{0.119757123f, 0.630262077f},
std::array<float,2>{0.775010467f, 0.139313176f},
std::array<float,2>{0.617393792f, 0.81499505f},
std::array<float,2>{0.278115004f, 0.404765278f},
std::array<float,2>{0.392425358f, 0.906521797f},
std::array<float,2>{0.723662853f, 0.299259454f},
std::array<float,2>{0.979276419f, 0.557060719f},
std::array<float,2>{0.196458995f, 0.0117799826f},
std::array<float,2>{0.374714285f, 0.593815982f},
std::array<float,2>{0.562349558f, 0.0681917816f},
std::array<float,2>{0.852603734f, 0.949793994f},
std::array<float,2>{0.0310979746f, 0.358103961f},
std::array<float,2>{0.13514404f, 0.781384468f},
std::array<float,2>{0.890703022f, 0.454486281f},
std::array<float,2>{0.678793252f, 0.704269707f},
std::array<float,2>{0.484380037f, 0.223322123f},
std::array<float,2>{0.243396595f, 0.502326667f},
std::array<float,2>{0.956329644f, 0.0549287982f},
std::array<float,2>{0.702642739f, 0.878696144f},
std::array<float,2>{0.413230449f, 0.27023083f},
std::array<float,2>{0.29502964f, 0.867833972f},
std::array<float,2>{0.578955889f, 0.427281499f},
std::array<float,2>{0.781539321f, 0.674509466f},
std::array<float,2>{0.0838971511f, 0.180577174f},
std::array<float,2>{0.467056394f, 0.741544127f},
std::array<float,2>{0.628926039f, 0.199831605f},
std::array<float,2>{0.934311271f, 0.767988205f},
std::array<float,2>{0.17511341f, 0.471854657f},
std::array<float,2>{0.0388795398f, 0.982344449f},
std::array<float,2>{0.822548211f, 0.323996246f},
std::array<float,2>{0.509971201f, 0.590132833f},
std::array<float,2>{0.314745188f, 0.112103589f},
std::array<float,2>{0.19324179f, 0.68134582f},
std::array<float,2>{0.975763619f, 0.174014345f},
std::array<float,2>{0.730625868f, 0.860749066f},
std::array<float,2>{0.401614696f, 0.436054349f},
std::array<float,2>{0.272548586f, 0.883612394f},
std::array<float,2>{0.610846877f, 0.278639227f},
std::array<float,2>{0.769078612f, 0.511724412f},
std::array<float,2>{0.109864406f, 0.053294234f},
std::array<float,2>{0.495127827f, 0.579947352f},
std::array<float,2>{0.68366611f, 0.124540202f},
std::array<float,2>{0.902266502f, 0.97140497f},
std::array<float,2>{0.125707164f, 0.316649914f},
std::array<float,2>{0.0200975221f, 0.776292384f},
std::array<float,2>{0.845717013f, 0.478588939f},
std::array<float,2>{0.55009228f, 0.748152316f},
std::array<float,2>{0.360026687f, 0.18893896f},
std::array<float,2>{0.0910009667f, 0.551134288f},
std::array<float,2>{0.794025302f, 0.00423242198f},
std::array<float,2>{0.588463187f, 0.921341538f},
std::array<float,2>{0.281501651f, 0.311390877f},
std::array<float,2>{0.414070129f, 0.823648214f},
std::array<float,2>{0.691344261f, 0.395802945f},
std::array<float,2>{0.967891276f, 0.637592912f},
std::array<float,2>{0.239288837f, 0.126177967f},
std::array<float,2>{0.321586043f, 0.716545224f},
std::array<float,2>{0.50489831f, 0.230917215f},
std::array<float,2>{0.813980579f, 0.791418374f},
std::array<float,2>{0.0406748541f, 0.465741396f},
std::array<float,2>{0.185504645f, 0.940372467f},
std::array<float,2>{0.926713109f, 0.348315209f},
std::array<float,2>{0.635706604f, 0.609345853f},
std::array<float,2>{0.458111197f, 0.0750462413f},
std::array<float,2>{0.0521634817f, 0.732369959f},
std::array<float,2>{0.843367279f, 0.20490028f},
std::array<float,2>{0.526968002f, 0.754927635f},
std::array<float,2>{0.332599699f, 0.492130309f},
std::array<float,2>{0.440959573f, 0.987481534f},
std::array<float,2>{0.648533285f, 0.332416981f},
std::array<float,2>{0.91042161f, 0.568664789f},
std::array<float,2>{0.165371984f, 0.0991677567f},
std::array<float,2>{0.302161127f, 0.523431242f},
std::array<float,2>{0.573338807f, 0.0413570628f},
std::array<float,2>{0.799501002f, 0.900852501f},
std::array<float,2>{0.073465623f, 0.262222648f},
std::array<float,2>{0.223411798f, 0.858035028f},
std::array<float,2>{0.943628073f, 0.42039147f},
std::array<float,2>{0.712630272f, 0.667082846f},
std::array<float,2>{0.43358326f, 0.163408414f},
std::array<float,2>{0.150041729f, 0.612978458f},
std::array<float,2>{0.882176161f, 0.089730069f},
std::array<float,2>{0.669292629f, 0.956852674f},
std::array<float,2>{0.483547688f, 0.362260491f},
std::array<float,2>{0.355466664f, 0.799108148f},
std::array<float,2>{0.54028815f, 0.441908598f},
std::array<float,2>{0.874371409f, 0.688039958f},
std::array<float,2>{0.0103569571f, 0.249680683f},
std::array<float,2>{0.38484779f, 0.655295789f},
std::array<float,2>{0.737449765f, 0.15474464f},
std::array<float,2>{0.990105569f, 0.835938275f},
std::array<float,2>{0.214584589f, 0.379029632f},
std::array<float,2>{0.0986338705f, 0.935663104f},
std::array<float,2>{0.762327373f, 0.282283634f},
std::array<float,2>{0.607085466f, 0.531881273f},
std::array<float,2>{0.259677917f, 0.0227670576f},
std::array<float,2>{0.220579222f, 0.707262874f},
std::array<float,2>{0.940983534f, 0.219474941f},
std::array<float,2>{0.717745185f, 0.785552084f},
std::array<float,2>{0.435931653f, 0.45769155f},
std::array<float,2>{0.299860656f, 0.946975648f},
std::array<float,2>{0.575265765f, 0.354251355f},
std::array<float,2>{0.803166687f, 0.600111604f},
std::array<float,2>{0.0780367032f, 0.0639604405f},
std::array<float,2>{0.441471487f, 0.560600817f},
std::array<float,2>{0.653258502f, 0.0100716539f},
std::array<float,2>{0.910066247f, 0.912261486f},
std::array<float,2>{0.168270633f, 0.301084995f},
std::array<float,2>{0.0491848923f, 0.819491804f},
std::array<float,2>{0.838522851f, 0.39924401f},
std::array<float,2>{0.530644655f, 0.627382278f},
std::array<float,2>{0.330084294f, 0.136429995f},
std::array<float,2>{0.0960080922f, 0.589651763f},
std::array<float,2>{0.761530042f, 0.116508469f},
std::array<float,2>{0.602913678f, 0.97831893f},
std::array<float,2>{0.264540166f, 0.325820386f},
std::array<float,2>{0.390055656f, 0.77206862f},
std::array<float,2>{0.742162287f, 0.474916637f},
std::array<float,2>{0.988195896f, 0.734981656f},
std::array<float,2>{0.217133626f, 0.199195638f},
std::array<float,2>{0.35607034f, 0.67838347f},
std::array<float,2>{0.544905424f, 0.185650304f},
std::array<float,2>{0.870872617f, 0.873083234f},
std::array<float,2>{0.0139028206f, 0.424878567f},
std::array<float,2>{0.153645739f, 0.881593883f},
std::array<float,2>{0.876482248f, 0.267767251f},
std::array<float,2>{0.665305316f, 0.505066276f},
std::array<float,2>{0.480077416f, 0.0619325005f},
std::array<float,2>{0.0172706023f, 0.642044067f},
std::array<float,2>{0.848596334f, 0.140972301f},
std::array<float,2>{0.554328918f, 0.835809112f},
std::array<float,2>{0.366978496f, 0.384716362f},
std::array<float,2>{0.499693304f, 0.924685538f},
std::array<float,2>{0.679744899f, 0.289722204f},
std::array<float,2>{0.905172884f, 0.544518709f},
std::array<float,2>{0.131772354f, 0.0255864356f},
std::array<float,2>{0.265975505f, 0.620811939f},
std::array<float,2>{0.616738081f, 0.0815604106f},
std::array<float,2>{0.770408034f, 0.964731395f},
std::array<float,2>{0.114191324f, 0.370651245f},
std::array<float,2>{0.189448893f, 0.808486581f},
std::array<float,2>{0.971626103f, 0.450312912f},
std::array<float,2>{0.72979039f, 0.700507224f},
std::array<float,2>{0.405713379f, 0.238423452f},
std::array<float,2>{0.181085229f, 0.525523603f},
std::array<float,2>{0.923417926f, 0.0387467854f},
std::array<float,2>{0.638719499f, 0.894364893f},
std::array<float,2>{0.455217451f, 0.257099986f},
std::array<float,2>{0.324893445f, 0.851525664f},
std::array<float,2>{0.503673613f, 0.409097821f},
std::array<float,2>{0.81951791f, 0.659630358f},
std::array<float,2>{0.046020329f, 0.169903532f},
std::array<float,2>{0.418933183f, 0.72396934f},
std::array<float,2>{0.691922963f, 0.215312943f},
std::array<float,2>{0.964634418f, 0.762296557f},
std::array<float,2>{0.234808356f, 0.499086231f},
std::array<float,2>{0.0888094008f, 0.999821782f},
std::array<float,2>{0.789374411f, 0.338267803f},
std::array<float,2>{0.590807021f, 0.570919216f},
std::array<float,2>{0.288091868f, 0.102731161f},
std::array<float,2>{0.139345154f, 0.66945833f},
std::array<float,2>{0.896824419f, 0.15892911f},
std::array<float,2>{0.672650337f, 0.852408588f},
std::array<float,2>{0.489553869f, 0.414147437f},
std::array<float,2>{0.370020241f, 0.904859185f},
std::array<float,2>{0.556018353f, 0.25993526f},
std::array<float,2>{0.857870996f, 0.518761277f},
std::array<float,2>{0.0234874859f, 0.046560362f},
std::array<float,2>{0.39578265f, 0.562947989f},
std::array<float,2>{0.722074449f, 0.0954173207f},
std::array<float,2>{0.983543396f, 0.988788188f},
std::array<float,2>{0.200417981f, 0.328267813f},
std::array<float,2>{0.124372728f, 0.752370894f},
std::array<float,2>{0.778427005f, 0.485145837f},
std::array<float,2>{0.621172547f, 0.729100585f},
std::array<float,2>{0.276515156f, 0.207094401f},
std::array<float,2>{0.0328630432f, 0.537727177f},
std::array<float,2>{0.826061249f, 0.016259186f},
std::array<float,2>{0.51560843f, 0.931219935f},
std::array<float,2>{0.319624007f, 0.287671715f},
std::array<float,2>{0.462492406f, 0.841656804f},
std::array<float,2>{0.627448499f, 0.375766337f},
std::array<float,2>{0.930392742f, 0.652182996f},
std::array<float,2>{0.177069664f, 0.149923161f},
std::array<float,2>{0.292078942f, 0.693712652f},
std::array<float,2>{0.584023833f, 0.244358361f},
std::array<float,2>{0.785425067f, 0.804060817f},
std::array<float,2>{0.0810872465f, 0.440962046f},
std::array<float,2>{0.24741362f, 0.957971394f},
std::array<float,2>{0.959851205f, 0.364591777f},
std::array<float,2>{0.6972996f, 0.613391042f},
std::array<float,2>{0.409502089f, 0.0914470404f},
std::array<float,2>{0.0690795481f, 0.745261014f},
std::array<float,2>{0.812388122f, 0.192084581f},
std::array<float,2>{0.566388547f, 0.781112313f},
std::array<float,2>{0.309581727f, 0.481508344f},
std::array<float,2>{0.426409304f, 0.974796712f},
std::array<float,2>{0.705041051f, 0.314248413f},
std::array<float,2>{0.947327077f, 0.583871484f},
std::array<float,2>{0.233774245f, 0.119257212f},
std::array<float,2>{0.342962354f, 0.510753214f},
std::array<float,2>{0.521983027f, 0.0503087044f},
std::array<float,2>{0.829510987f, 0.886914432f},
std::array<float,2>{0.061227534f, 0.276946723f},
std::array<float,2>{0.159827739f, 0.866991818f},
std::array<float,2>{0.918943286f, 0.430767238f},
std::array<float,2>{0.645726323f, 0.68381989f},
std::array<float,2>{0.448548526f, 0.175984934f},
std::array<float,2>{0.205166325f, 0.604285419f},
std::array<float,2>{0.996612608f, 0.0720972717f},
std::array<float,2>{0.74597466f, 0.943814814f},
std::array<float,2>{0.378712565f, 0.346770316f},
std::array<float,2>{0.251552463f, 0.794754863f},
std::array<float,2>{0.595769823f, 0.463639706f},
std::array<float,2>{0.757389426f, 0.714079201f},
std::array<float,2>{0.109337687f, 0.230420828f},
std::array<float,2>{0.469901472f, 0.636612475f},
std::array<float,2>{0.663147449f, 0.131867453f},
std::array<float,2>{0.885744452f, 0.825284362f},
std::array<float,2>{0.143100992f, 0.392400533f},
std::array<float,2>{0.00751985842f, 0.917281091f},
std::array<float,2>{0.863760233f, 0.306099713f},
std::array<float,2>{0.537021995f, 0.550742865f},
std::array<float,2>{0.348870248f, 0.0031897882f},
std::array<float,2>{0.165885329f, 0.733150303f},
std::array<float,2>{0.910839736f, 0.205734238f},
std::array<float,2>{0.649186671f, 0.757251441f},
std::array<float,2>{0.440486699f, 0.489130795f},
std::array<float,2>{0.332416207f, 0.984868526f},
std::array<float,2>{0.52670145f, 0.334958583f},
std::array<float,2>{0.842975438f, 0.568029046f},
std::array<float,2>{0.0526117235f, 0.099613294f},
std::array<float,2>{0.433079511f, 0.519734383f},
std::array<float,2>{0.711937249f, 0.0399080589f},
std::array<float,2>{0.94429934f, 0.899836302f},
std::array<float,2>{0.222925112f, 0.264404178f},
std::array<float,2>{0.0737873763f, 0.856447935f},
std::array<float,2>{0.799156547f, 0.418607235f},
std::array<float,2>{0.573914289f, 0.66453135f},
std::array<float,2>{0.302280217f, 0.161287725f},
std::array<float,2>{0.00990392454f, 0.610182464f},
std::array<float,2>{0.874663711f, 0.0872846916f},
std::array<float,2>{0.540617108f, 0.953318655f},
std::array<float,2>{0.354759514f, 0.361014158f},
std::array<float,2>{0.48433128f, 0.798824251f},
std::array<float,2>{0.669515491f, 0.444167107f},
std::array<float,2>{0.882465184f, 0.689714193f},
std::array<float,2>{0.149696827f, 0.246641189f},
std::array<float,2>{0.258951336f, 0.653281331f},
std::array<float,2>{0.606572866f, 0.154077753f},
std::array<float,2>{0.761975288f, 0.839374304f},
std::array<float,2>{0.0995097235f, 0.381580681f},
std::array<float,2>{0.21424669f, 0.935022175f},
std::array<float,2>{0.989307821f, 0.284059584f},
std::array<float,2>{0.737899423f, 0.53327167f},
std::array<float,2>{0.385591745f, 0.0196873434f},
std::array<float,2>{0.109548055f, 0.682715356f},
std::array<float,2>{0.768579662f, 0.172583804f},
std::array<float,2>{0.610727549f, 0.862383842f},
std::array<float,2>{0.273192018f, 0.433847815f},
std::array<float,2>{0.401975632f, 0.886552095f},
std::array<float,2>{0.731397629f, 0.280186862f},
std::array<float,2>{0.976291955f, 0.514570415f},
std::array<float,2>{0.192462906f, 0.0513128117f},
std::array<float,2>{0.359549642f, 0.581528604f},
std::array<float,2>{0.550331414f, 0.121711247f},
std::array<float,2>{0.846508563f, 0.970501661f},
std::array<float,2>{0.0197992492f, 0.319019824f},
std::array<float,2>{0.125039175f, 0.775337458f},
std::array<float,2>{0.90145129f, 0.476897776f},
std::array<float,2>{0.684154749f, 0.746325731f},
std::array<float,2>{0.495956689f, 0.189807788f},
std::array<float,2>{0.240010515f, 0.55350548f},
std::array<float,2>{0.968577147f, 0.00587971509f},
std::array<float,2>{0.690754831f, 0.91904825f},
std::array<float,2>{0.414580524f, 0.31007269f},
std::array<float,2>{0.282056272f, 0.821411908f},
std::array<float,2>{0.587989926f, 0.397877663f},
std::array<float,2>{0.794670701f, 0.639280856f},
std::array<float,2>{0.0917946547f, 0.12839371f},
std::array<float,2>{0.458920568f, 0.718689442f},
std::array<float,2>{0.634891629f, 0.233449295f},
std::array<float,2>{0.926014185f, 0.790827036f},
std::array<float,2>{0.18482478f, 0.468620032f},
std::array<float,2>{0.0405253395f, 0.93777442f},
std::array<float,2>{0.813942254f, 0.350836873f},
std::array<float,2>{0.505528569f, 0.606280148f},
std::array<float,2>{0.321818829f, 0.076742582f},
std::array<float,2>{0.197244063f, 0.632365465f},
std::array<float,2>{0.978583276f, 0.136831805f},
std::array<float,2>{0.724238217f, 0.814207554f},
std::array<float,2>{0.391946256f, 0.403142869f},
std::array<float,2>{0.277424157f, 0.909606814f},
std::array<float,2>{0.617882788f, 0.298634797f},
std::array<float,2>{0.774823546f, 0.556535304f},
std::array<float,2>{0.119388632f, 0.0151423598f},
std::array<float,2>{0.484979898f, 0.596809208f},
std::array<float,2>{0.679590583f, 0.0698701367f},
std::array<float,2>{0.891156733f, 0.952474833f},
std::array<float,2>{0.135655373f, 0.357151896f},
std::array<float,2>{0.0304352473f, 0.784384549f},
std::array<float,2>{0.853495538f, 0.456396967f},
std::array<float,2>{0.561994195f, 0.705315232f},
std::array<float,2>{0.374465764f, 0.225493938f},
std::array<float,2>{0.0834935233f, 0.500252903f},
std::array<float,2>{0.781749249f, 0.0583132356f},
std::array<float,2>{0.578278661f, 0.875100076f},
std::array<float,2>{0.295454651f, 0.271584511f},
std::array<float,2>{0.413699657f, 0.86925137f},
std::array<float,2>{0.702602148f, 0.42903778f},
std::array<float,2>{0.956951618f, 0.67243892f},
std::array<float,2>{0.243710488f, 0.182929844f},
std::array<float,2>{0.314965725f, 0.738465548f},
std::array<float,2>{0.510311604f, 0.202429846f},
std::array<float,2>{0.822926521f, 0.767437994f},
std::array<float,2>{0.038381882f, 0.469863772f},
std::array<float,2>{0.17559512f, 0.984100819f},
std::array<float,2>{0.933646142f, 0.320594013f},
std::array<float,2>{0.629755735f, 0.593690693f},
std::array<float,2>{0.467431664f, 0.110965155f},
std::array<float,2>{0.0550580733f, 0.697856069f},
std::array<float,2>{0.83498162f, 0.237211928f},
std::array<float,2>{0.517966747f, 0.809853256f},
std::array<float,2>{0.337221205f, 0.446517825f},
std::array<float,2>{0.449676663f, 0.965116143f},
std::array<float,2>{0.642009735f, 0.371116072f},
std::array<float,2>{0.916870594f, 0.623126864f},
std::array<float,2>{0.163601726f, 0.0845309421f},
std::array<float,2>{0.305915296f, 0.540190637f},
std::array<float,2>{0.56988138f, 0.0288863089f},
std::array<float,2>{0.808353603f, 0.926002145f},
std::array<float,2>{0.0635433942f, 0.295916051f},
std::array<float,2>{0.229236796f, 0.830727339f},
std::array<float,2>{0.952381551f, 0.388182789f},
std::array<float,2>{0.709140241f, 0.647895992f},
std::array<float,2>{0.423606306f, 0.14651376f},
std::array<float,2>{0.147376493f, 0.574457288f},
std::array<float,2>{0.887453735f, 0.109323055f},
std::array<float,2>{0.659804165f, 0.992342591f},
std::array<float,2>{0.475482404f, 0.340218246f},
std::array<float,2>{0.345720172f, 0.759296775f},
std::array<float,2>{0.534020543f, 0.4936966f},
std::array<float,2>{0.862083137f, 0.721857786f},
std::array<float,2>{0.000904056069f, 0.213851318f},
std::array<float,2>{0.379898965f, 0.660682559f},
std::array<float,2>{0.749573708f, 0.166855022f},
std::array<float,2>{0.992955565f, 0.845772147f},
std::array<float,2>{0.209072426f, 0.411217481f},
std::array<float,2>{0.101750769f, 0.897264659f},
std::array<float,2>{0.75274694f, 0.253384084f},
std::array<float,2>{0.598584056f, 0.529634655f},
std::array<float,2>{0.255748451f, 0.0347415544f},
std::array<float,2>{0.215761185f, 0.737296879f},
std::array<float,2>{0.984866738f, 0.197252393f},
std::array<float,2>{0.739475846f, 0.770822048f},
std::array<float,2>{0.38769564f, 0.47431916f},
std::array<float,2>{0.263534844f, 0.979629397f},
std::array<float,2>{0.603638172f, 0.3271074f},
std::array<float,2>{0.758756578f, 0.586316228f},
std::array<float,2>{0.0943036079f, 0.114902966f},
std::array<float,2>{0.476942509f, 0.507474363f},
std::array<float,2>{0.667553186f, 0.060386084f},
std::array<float,2>{0.878454685f, 0.880078197f},
std::array<float,2>{0.155231103f, 0.265701532f},
std::array<float,2>{0.0121667804f, 0.872393072f},
std::array<float,2>{0.868228137f, 0.422592998f},
std::array<float,2>{0.54525727f, 0.676958382f},
std::array<float,2>{0.35769555f, 0.183777526f},
std::array<float,2>{0.0748607293f, 0.598772228f},
std::array<float,2>{0.80259788f, 0.0654901043f},
std::array<float,2>{0.577728331f, 0.948887169f},
std::array<float,2>{0.297822237f, 0.353348136f},
std::array<float,2>{0.434680611f, 0.787476838f},
std::array<float,2>{0.715680122f, 0.46037519f},
std::array<float,2>{0.939025223f, 0.710128546f},
std::array<float,2>{0.222276196f, 0.221640065f},
std::array<float,2>{0.329970509f, 0.625134826f},
std::array<float,2>{0.528900802f, 0.133380845f},
std::array<float,2>{0.83749938f, 0.817725778f},
std::array<float,2>{0.0481211059f, 0.401774257f},
std::array<float,2>{0.171018466f, 0.910410523f},
std::array<float,2>{0.907317817f, 0.304492325f},
std::array<float,2>{0.655540168f, 0.559478581f},
std::array<float,2>{0.443800598f, 0.00946646929f},
std::array<float,2>{0.0438701883f, 0.657843053f},
std::array<float,2>{0.816990852f, 0.17088154f},
std::array<float,2>{0.500924706f, 0.849532604f},
std::array<float,2>{0.32743004f, 0.408045083f},
std::array<float,2>{0.453691274f, 0.892039776f},
std::array<float,2>{0.637348592f, 0.254975528f},
std::array<float,2>{0.925737679f, 0.523647189f},
std::array<float,2>{0.182202876f, 0.0357211456f},
std::array<float,2>{0.286476225f, 0.573790669f},
std::array<float,2>{0.592837393f, 0.104837961f},
std::array<float,2>{0.791630745f, 0.997847378f},
std::array<float,2>{0.0864820033f, 0.337201923f},
std::array<float,2>{0.238142073f, 0.764502943f},
std::array<float,2>{0.961115062f, 0.498002112f},
std::array<float,2>{0.693575203f, 0.724694848f},
std::array<float,2>{0.420550853f, 0.217577174f},
std::array<float,2>{0.12933135f, 0.545500457f},
std::array<float,2>{0.903649986f, 0.0244403239f},
std::array<float,2>{0.683111846f, 0.922345042f},
std::array<float,2>{0.49698624f, 0.291723132f},
std::array<float,2>{0.363558918f, 0.832647264f},
std::array<float,2>{0.551556587f, 0.386686742f},
std::array<float,2>{0.849805951f, 0.643436491f},
std::array<float,2>{0.0180323999f, 0.143467277f},
std::array<float,2>{0.403955162f, 0.702384472f},
std::array<float,2>{0.728331208f, 0.24137798f},
std::array<float,2>{0.968946517f, 0.805817902f},
std::array<float,2>{0.18996729f, 0.452788651f},
std::array<float,2>{0.116436005f, 0.962592602f},
std::array<float,2>{0.772812784f, 0.367319942f},
std::array<float,2>{0.614581645f, 0.618942559f},
std::array<float,2>{0.269516557f, 0.0789044797f},
std::array<float,2>{0.178871349f, 0.648795903f},
std::array<float,2>{0.933261395f, 0.151767567f},
std::array<float,2>{0.625739336f, 0.841811001f},
std::array<float,2>{0.463270217f, 0.378862798f},
std::array<float,2>{0.318250656f, 0.932757795f},
std::array<float,2>{0.513619423f, 0.285290837f},
std::array<float,2>{0.827920914f, 0.536002517f},
std::array<float,2>{0.0346669108f, 0.0183957573f},
std::array<float,2>{0.407845229f, 0.61709702f},
std::array<float,2>{0.695437133f, 0.093735829f},
std::array<float,2>{0.958423615f, 0.960364759f},
std::array<float,2>{0.249836162f, 0.366490185f},
std::array<float,2>{0.0795654804f, 0.80191499f},
std::array<float,2>{0.787141681f, 0.438447356f},
std::array<float,2>{0.583603799f, 0.693125725f},
std::array<float,2>{0.290272027f, 0.243900433f},
std::array<float,2>{0.0259991363f, 0.516674459f},
std::array<float,2>{0.856292248f, 0.0430014431f},
std::array<float,2>{0.557615697f, 0.903048694f},
std::array<float,2>{0.368947178f, 0.25947392f},
std::array<float,2>{0.490802914f, 0.854980528f},
std::array<float,2>{0.674236357f, 0.41793111f},
std::array<float,2>{0.895932078f, 0.671520293f},
std::array<float,2>{0.137513503f, 0.156927347f},
std::array<float,2>{0.275372803f, 0.726821184f},
std::array<float,2>{0.623949409f, 0.210307747f},
std::array<float,2>{0.780780792f, 0.751107395f},
std::array<float,2>{0.122144416f, 0.486619532f},
std::array<float,2>{0.201469526f, 0.990448475f},
std::array<float,2>{0.981115878f, 0.331824601f},
std::array<float,2>{0.72056073f, 0.565950394f},
std::array<float,2>{0.39792797f, 0.0972924754f},
std::array<float,2>{0.105480492f, 0.711899221f},
std::array<float,2>{0.754583895f, 0.227955148f},
std::array<float,2>{0.595107675f, 0.795680285f},
std::array<float,2>{0.252551407f, 0.462344497f},
std::array<float,2>{0.376534253f, 0.943112016f},
std::array<float,2>{0.743771911f, 0.344979227f},
std::array<float,2>{0.998642385f, 0.602601707f},
std::array<float,2>{0.204231545f, 0.0737321675f},
std::array<float,2>{0.350390434f, 0.54746002f},
std::array<float,2>{0.537682176f, 0.00106566271f},
std::array<float,2>{0.865893841f, 0.914761364f},
std::array<float,2>{0.00441390695f, 0.30692634f},
std::array<float,2>{0.141303867f, 0.826710582f},
std::array<float,2>{0.883069515f, 0.393684536f},
std::array<float,2>{0.661308527f, 0.634512484f},
std::array<float,2>{0.472400993f, 0.128907159f},
std::array<float,2>{0.230558991f, 0.585082412f},
std::array<float,2>{0.946767449f, 0.118303128f},
std::array<float,2>{0.706730127f, 0.973801196f},
std::array<float,2>{0.429059505f, 0.314656943f},
std::array<float,2>{0.312056899f, 0.777878821f},
std::array<float,2>{0.564254284f, 0.483513683f},
std::array<float,2>{0.808976293f, 0.742904305f},
std::array<float,2>{0.0670873299f, 0.195073411f},
std::array<float,2>{0.446989477f, 0.687406063f},
std::array<float,2>{0.647221386f, 0.179290891f},
std::array<float,2>{0.920242608f, 0.864988744f},
std::array<float,2>{0.157560349f, 0.432711124f},
std::array<float,2>{0.0595927536f, 0.889676332f},
std::array<float,2>{0.831724524f, 0.274862647f},
std::array<float,2>{0.521439075f, 0.509700656f},
std::array<float,2>{0.340622872f, 0.0486166067f},
std::array<float,2>{0.151426211f, 0.687924564f},
std::array<float,2>{0.880744517f, 0.24949421f},
std::array<float,2>{0.670632541f, 0.799648225f},
std::array<float,2>{0.481065512f, 0.44189167f},
std::array<float,2>{0.352278113f, 0.956360817f},
std::array<float,2>{0.54144311f, 0.361605197f},
std::array<float,2>{0.871763885f, 0.612361133f},
std::array<float,2>{0.00848639943f, 0.0892132595f},
std::array<float,2>{0.384133995f, 0.531608403f},
std::array<float,2>{0.73588872f, 0.0234228875f},
std::array<float,2>{0.990836442f, 0.936263859f},
std::array<float,2>{0.211815804f, 0.282799602f},
std::array<float,2>{0.101108357f, 0.836620629f},
std::array<float,2>{0.764243603f, 0.37956515f},
std::array<float,2>{0.607533693f, 0.656189024f},
std::array<float,2>{0.260087729f, 0.155270576f},
std::array<float,2>{0.0527875759f, 0.569023609f},
std::array<float,2>{0.84150672f, 0.0988055989f},
std::array<float,2>{0.524271548f, 0.987881422f},
std::array<float,2>{0.334202498f, 0.332900822f},
std::array<float,2>{0.439195871f, 0.75537324f},
std::array<float,2>{0.651792347f, 0.491443634f},
std::array<float,2>{0.913554728f, 0.731616139f},
std::array<float,2>{0.167107418f, 0.204283386f},
std::array<float,2>{0.303735852f, 0.667785466f},
std::array<float,2>{0.571253061f, 0.163899526f},
std::array<float,2>{0.798728943f, 0.857451677f},
std::array<float,2>{0.0708400756f, 0.420767486f},
std::array<float,2>{0.225742847f, 0.901287615f},
std::array<float,2>{0.942074358f, 0.26219362f},
std::array<float,2>{0.713416398f, 0.52259165f},
std::array<float,2>{0.431584477f, 0.0418021232f},
std::array<float,2>{0.0937464312f, 0.636972487f},
std::array<float,2>{0.796037793f, 0.126753017f},
std::array<float,2>{0.586484551f, 0.824052274f},
std::array<float,2>{0.284762859f, 0.396037042f},
std::array<float,2>{0.416179836f, 0.921667278f},
std::array<float,2>{0.689299166f, 0.310651213f},
std::array<float,2>{0.966587305f, 0.551333725f},
std::array<float,2>{0.242032886f, 0.00457293447f},
std::array<float,2>{0.322440594f, 0.608469129f},
std::array<float,2>{0.506578803f, 0.0746225417f},
std::array<float,2>{0.815459847f, 0.939799845f},
std::array<float,2>{0.0412731431f, 0.348132759f},
std::array<float,2>{0.186950207f, 0.791709423f},
std::array<float,2>{0.929566026f, 0.465222687f},
std::array<float,2>{0.634191275f, 0.715829134f},
std::array<float,2>{0.45983991f, 0.231423348f},
std::array<float,2>{0.194136947f, 0.512313843f},
std::array<float,2>{0.972963393f, 0.0528749935f},
std::array<float,2>{0.732731879f, 0.883143365f},
std::array<float,2>{0.399185061f, 0.279083043f},
std::array<float,2>{0.269661516f, 0.861095965f},
std::array<float,2>{0.611863554f, 0.435725898f},
std::array<float,2>{0.767162859f, 0.680914223f},
std::array<float,2>{0.112662248f, 0.174324483f},
std::array<float,2>{0.494069338f, 0.74891752f},
std::array<float,2>{0.686156571f, 0.188989148f},
std::array<float,2>{0.899727464f, 0.775776088f},
std::array<float,2>{0.128476724f, 0.479418218f},
std::array<float,2>{0.0221067443f, 0.970802844f},
std::array<float,2>{0.845198274f, 0.317125052f},
std::array<float,2>{0.548816323f, 0.579349756f},
std::array<float,2>{0.362989187f, 0.124398865f},
std::array<float,2>{0.245031267f, 0.673943818f},
std::array<float,2>{0.953973651f, 0.18008405f},
std::array<float,2>{0.701090753f, 0.86738199f},
std::array<float,2>{0.411433965f, 0.426932275f},
std::array<float,2>{0.293915987f, 0.878090262f},
std::array<float,2>{0.581701398f, 0.26965037f},
std::array<float,2>{0.784522653f, 0.502594352f},
std::array<float,2>{0.0844039395f, 0.0555751212f},
std::array<float,2>{0.466144115f, 0.590608597f},
std::array<float,2>{0.632360876f, 0.111539833f},
std::array<float,2>{0.936322927f, 0.981519818f},
std::array<float,2>{0.172493875f, 0.323403984f},
std::array<float,2>{0.036733821f, 0.768124819f},
std::array<float,2>{0.820991337f, 0.47237134f},
std::array<float,2>{0.509733677f, 0.741922855f},
std::array<float,2>{0.314299464f, 0.199514031f},
std::array<float,2>{0.118590824f, 0.5574525f},
std::array<float,2>{0.775869071f, 0.0126315933f},
std::array<float,2>{0.619313836f, 0.906910181f},
std::array<float,2>{0.280242711f, 0.299417287f},
std::array<float,2>{0.393532991f, 0.814910352f},
std::array<float,2>{0.725749135f, 0.405236006f},
std::array<float,2>{0.977360249f, 0.630846679f},
std::array<float,2>{0.197455615f, 0.138747096f},
std::array<float,2>{0.371883601f, 0.705049336f},
std::array<float,2>{0.559687853f, 0.223088264f},
std::array<float,2>{0.855041087f, 0.781905055f},
std::array<float,2>{0.0289167333f, 0.454675466f},
std::array<float,2>{0.132873148f, 0.949517727f},
std::array<float,2>{0.893293262f, 0.357777804f},
std::array<float,2>{0.676347136f, 0.594599128f},
std::array<float,2>{0.487411678f, 0.0677877963f},
std::array<float,2>{0.00256581954f, 0.72045207f},
std::array<float,2>{0.860966802f, 0.211368427f},
std::array<float,2>{0.531745315f, 0.761472523f},
std::array<float,2>{0.344414979f, 0.495437801f},
std::array<float,2>{0.473625988f, 0.994504631f},
std::array<float,2>{0.657020986f, 0.342408866f},
std::array<float,2>{0.888826072f, 0.5761922f},
std::array<float,2>{0.144692212f, 0.105507992f},
std::array<float,2>{0.257729173f, 0.528417289f},
std::array<float,2>{0.601545572f, 0.0330738276f},
std::array<float,2>{0.75076139f, 0.895328701f},
std::array<float,2>{0.105105683f, 0.250198871f},
std::array<float,2>{0.207568899f, 0.843812883f},
std::array<float,2>{0.995800436f, 0.413434356f},
std::array<float,2>{0.747313559f, 0.663492739f},
std::array<float,2>{0.381066829f, 0.165824413f},
std::array<float,2>{0.161715969f, 0.621950209f},
std::array<float,2>{0.915290534f, 0.0824448913f},
std::array<float,2>{0.643220127f, 0.968618989f},
std::array<float,2>{0.451522857f, 0.373201877f},
std::array<float,2>{0.338279277f, 0.811885655f},
std::array<float,2>{0.516608238f, 0.44879204f},
std::array<float,2>{0.832205892f, 0.69654119f},
std::array<float,2>{0.0567609258f, 0.235025913f},
std::array<float,2>{0.425023526f, 0.644759595f},
std::array<float,2>{0.707432449f, 0.14641583f},
std::array<float,2>{0.950293243f, 0.828633785f},
std::array<float,2>{0.226769656f, 0.389203131f},
std::array<float,2>{0.0652003735f, 0.929335237f},
std::array<float,2>{0.806241512f, 0.294549763f},
std::array<float,2>{0.567700922f, 0.54212743f},
std::array<float,2>{0.307605267f, 0.0304042418f},
std::array<float,2>{0.190580159f, 0.700047672f},
std::array<float,2>{0.970302939f, 0.239751294f},
std::array<float,2>{0.726667285f, 0.807020962f},
std::array<float,2>{0.402798772f, 0.449957639f},
std::array<float,2>{0.268468022f, 0.963622332f},
std::array<float,2>{0.613323987f, 0.369653881f},
std::array<float,2>{0.771911323f, 0.619790196f},
std::array<float,2>{0.116023354f, 0.0801600441f},
std::array<float,2>{0.497214615f, 0.543210506f},
std::array<float,2>{0.681774318f, 0.027047608f},
std::array<float,2>{0.902427852f, 0.925058484f},
std::array<float,2>{0.130201787f, 0.290366799f},
std::array<float,2>{0.0187073387f, 0.834556103f},
std::array<float,2>{0.850822449f, 0.383082658f},
std::array<float,2>{0.552684486f, 0.641582668f},
std::array<float,2>{0.364639908f, 0.142552599f},
std::array<float,2>{0.0875363648f, 0.571289778f},
std::array<float,2>{0.79259938f, 0.10162016f},
std::array<float,2>{0.592154384f, 0.998220682f},
std::array<float,2>{0.285226762f, 0.339703888f},
std::array<float,2>{0.421848446f, 0.763608515f},
std::array<float,2>{0.695039392f, 0.498373836f},
std::array<float,2>{0.962210476f, 0.72342068f},
std::array<float,2>{0.236613035f, 0.216416553f},
std::array<float,2>{0.32712549f, 0.658581853f},
std::array<float,2>{0.501568019f, 0.168346301f},
std::array<float,2>{0.817597508f, 0.850233912f},
std::array<float,2>{0.0448192134f, 0.410060138f},
std::array<float,2>{0.182694301f, 0.892788768f},
std::array<float,2>{0.924168944f, 0.256124705f},
std::array<float,2>{0.637738705f, 0.526940763f},
std::array<float,2>{0.454358757f, 0.0375974514f},
std::array<float,2>{0.0473921783f, 0.628363252f},
std::array<float,2>{0.836614311f, 0.134774625f},
std::array<float,2>{0.527415216f, 0.818621516f},
std::array<float,2>{0.328306854f, 0.400204122f},
std::array<float,2>{0.445170969f, 0.913916707f},
std::array<float,2>{0.654868722f, 0.302314579f},
std::array<float,2>{0.907079399f, 0.561535597f},
std::array<float,2>{0.170734808f, 0.0113632474f},
std::array<float,2>{0.297909439f, 0.600951791f},
std::array<float,2>{0.577086031f, 0.0631809458f},
std::array<float,2>{0.80164212f, 0.946143329f},
std::array<float,2>{0.0755848959f, 0.355080158f},
std::array<float,2>{0.22077395f, 0.786552072f},
std::array<float,2>{0.937862337f, 0.458704025f},
std::array<float,2>{0.716673553f, 0.708823383f},
std::array<float,2>{0.433945388f, 0.220424205f},
std::array<float,2>{0.155884981f, 0.50447917f},
std::array<float,2>{0.877157867f, 0.0610066913f},
std::array<float,2>{0.666050136f, 0.882810771f},
std::array<float,2>{0.477782786f, 0.268903583f},
std::array<float,2>{0.359330773f, 0.874182582f},
std::array<float,2>{0.546490192f, 0.423986197f},
std::array<float,2>{0.868119895f, 0.678846419f},
std::array<float,2>{0.0131312488f, 0.18747595f},
std::array<float,2>{0.387385905f, 0.735540271f},
std::array<float,2>{0.738514006f, 0.19756785f},
std::array<float,2>{0.985769808f, 0.772579551f},
std::array<float,2>{0.216587603f, 0.476437449f},
std::array<float,2>{0.0952084437f, 0.977078855f},
std::array<float,2>{0.759009242f, 0.324407756f},
std::array<float,2>{0.604861557f, 0.5880633f},
std::array<float,2>{0.261990041f, 0.115429133f},
std::array<float,2>{0.156879216f, 0.685519755f},
std::array<float,2>{0.921724558f, 0.177498177f},
std::array<float,2>{0.647703707f, 0.865398705f},
std::array<float,2>{0.44617933f, 0.429983437f},
std::array<float,2>{0.341250449f, 0.888173699f},
std::array<float,2>{0.519650698f, 0.275837332f},
std::array<float,2>{0.831005752f, 0.510337234f},
std::array<float,2>{0.0591836721f, 0.0495621413f},
std::array<float,2>{0.428317457f, 0.582302213f},
std::array<float,2>{0.705679297f, 0.120920487f},
std::array<float,2>{0.94573307f, 0.975698531f},
std::array<float,2>{0.232279316f, 0.312711269f},
std::array<float,2>{0.0675631836f, 0.779469728f},
std::array<float,2>{0.80960685f, 0.481348813f},
std::array<float,2>{0.563416421f, 0.745080709f},
std::array<float,2>{0.311112195f, 0.192943797f},
std::array<float,2>{0.00530493073f, 0.549799383f},
std::array<float,2>{0.866641402f, 0.00266600051f},
std::array<float,2>{0.538250744f, 0.916699767f},
std::array<float,2>{0.350882649f, 0.305568665f},
std::array<float,2>{0.47134465f, 0.824508071f},
std::array<float,2>{0.660182416f, 0.390878946f},
std::array<float,2>{0.884209454f, 0.63539207f},
std::array<float,2>{0.14240104f, 0.131233439f},
std::array<float,2>{0.253724426f, 0.713213086f},
std::array<float,2>{0.594092607f, 0.228971168f},
std::array<float,2>{0.755548358f, 0.793044508f},
std::array<float,2>{0.107282557f, 0.463923395f},
std::array<float,2>{0.203506947f, 0.945158303f},
std::array<float,2>{0.999589443f, 0.346012831f},
std::array<float,2>{0.74289f, 0.604684472f},
std::array<float,2>{0.375338137f, 0.0709837973f},
std::array<float,2>{0.1210967f, 0.730205536f},
std::array<float,2>{0.780010641f, 0.208908349f},
std::array<float,2>{0.624225795f, 0.75327915f},
std::array<float,2>{0.274413288f, 0.486128986f},
std::array<float,2>{0.396959394f, 0.98961848f},
std::array<float,2>{0.71923852f, 0.329996496f},
std::array<float,2>{0.982385755f, 0.563982546f},
std::array<float,2>{0.202892244f, 0.0938229859f},
std::array<float,2>{0.36776036f, 0.51813972f},
std::array<float,2>{0.558047056f, 0.0454246663f},
std::array<float,2>{0.857409894f, 0.906221151f},
std::array<float,2>{0.0267262477f, 0.261325955f},
std::array<float,2>{0.138078332f, 0.852823198f},
std::array<float,2>{0.895478725f, 0.415564448f},
std::array<float,2>{0.675506294f, 0.668425322f},
std::array<float,2>{0.491300225f, 0.159464583f},
std::array<float,2>{0.248557895f, 0.61512053f},
std::array<float,2>{0.957177162f, 0.0900199562f},
std::array<float,2>{0.696854353f, 0.958450258f},
std::array<float,2>{0.406987011f, 0.363855243f},
std::array<float,2>{0.289486408f, 0.802760541f},
std::array<float,2>{0.582586765f, 0.440112561f},
std::array<float,2>{0.788870156f, 0.69435221f},
std::array<float,2>{0.0786080733f, 0.245661572f},
std::array<float,2>{0.464284867f, 0.650516689f},
std::array<float,2>{0.626482189f, 0.148882717f},
std::array<float,2>{0.932442427f, 0.840193748f},
std::array<float,2>{0.178645149f, 0.376836836f},
std::array<float,2>{0.0337538682f, 0.93039906f},
std::array<float,2>{0.826357722f, 0.288152397f},
std::array<float,2>{0.512663364f, 0.539000094f},
std::array<float,2>{0.317096531f, 0.0172174871f},
std::array<float,2>{0.127768964f, 0.747599304f},
std::array<float,2>{0.898749471f, 0.190652117f},
std::array<float,2>{0.687363565f, 0.773694217f},
std::array<float,2>{0.492814541f, 0.477757007f},
std::array<float,2>{0.36183241f, 0.969335318f},
std::array<float,2>{0.547197878f, 0.319851488f},
std::array<float,2>{0.844423771f, 0.580146432f},
std::array<float,2>{0.0225908551f, 0.122664005f},
std::array<float,2>{0.400197238f, 0.515070796f},
std::array<float,2>{0.733493447f, 0.0527051836f},
std::array<float,2>{0.974280834f, 0.885213017f},
std::array<float,2>{0.194791645f, 0.280522764f},
std::array<float,2>{0.112134814f, 0.861664772f},
std::array<float,2>{0.765723646f, 0.435429305f},
std::array<float,2>{0.61258316f, 0.682404459f},
std::array<float,2>{0.271181703f, 0.173663497f},
std::array<float,2>{0.0422810018f, 0.60711062f},
std::array<float,2>{0.814811289f, 0.0773067474f},
std::array<float,2>{0.50773567f, 0.938803315f},
std::array<float,2>{0.323646486f, 0.350439787f},
std::array<float,2>{0.460267901f, 0.78993082f},
std::array<float,2>{0.632922828f, 0.467390835f},
std::array<float,2>{0.927922428f, 0.717092335f},
std::array<float,2>{0.186368495f, 0.232485548f},
std::array<float,2>{0.283616573f, 0.639951766f},
std::array<float,2>{0.587302923f, 0.127491236f},
std::array<float,2>{0.795811892f, 0.821045458f},
std::array<float,2>{0.0927291885f, 0.396532804f},
std::array<float,2>{0.240559518f, 0.918841541f},
std::array<float,2>{0.965384781f, 0.3089706f},
std::array<float,2>{0.688138843f, 0.554288685f},
std::array<float,2>{0.417847544f, 0.00739444839f},
std::array<float,2>{0.0716739744f, 0.665548086f},
std::array<float,2>{0.797374129f, 0.160168603f},
std::array<float,2>{0.572101653f, 0.855547488f},
std::array<float,2>{0.303671688f, 0.419176221f},
std::array<float,2>{0.430137843f, 0.899079561f},
std::array<float,2>{0.714615285f, 0.265286207f},
std::array<float,2>{0.942483783f, 0.521480501f},
std::array<float,2>{0.225076109f, 0.0404130742f},
std::array<float,2>{0.334997326f, 0.566795707f},
std::array<float,2>{0.5247401f, 0.101144411f},
std::array<float,2>{0.840433776f, 0.985522747f},
std::array<float,2>{0.0542593822f, 0.335129619f},
std::array<float,2>{0.166687623f, 0.756471038f},
std::array<float,2>{0.912340581f, 0.489604771f},
std::array<float,2>{0.651253998f, 0.733571529f},
std::array<float,2>{0.437624007f, 0.206306458f},
std::array<float,2>{0.212635696f, 0.534490645f},
std::array<float,2>{0.991393983f, 0.0205918271f},
std::array<float,2>{0.734450102f, 0.933936357f},
std::array<float,2>{0.383269131f, 0.28470844f},
std::array<float,2>{0.261556327f, 0.838310361f},
std::array<float,2>{0.608418226f, 0.381858259f},
std::array<float,2>{0.764666915f, 0.653761506f},
std::array<float,2>{0.0999171957f, 0.153210774f},
std::array<float,2>{0.481950372f, 0.690689027f},
std::array<float,2>{0.671408892f, 0.247159481f},
std::array<float,2>{0.87903595f, 0.797051907f},
std::array<float,2>{0.151353225f, 0.44466418f},
std::array<float,2>{0.0091867689f, 0.954652071f},
std::array<float,2>{0.87231189f, 0.359532595f},
std::array<float,2>{0.542274773f, 0.611065209f},
std::array<float,2>{0.353104651f, 0.0862869322f},
std::array<float,2>{0.227747828f, 0.647309601f},
std::array<float,2>{0.949600577f, 0.14805676f},
std::array<float,2>{0.708525062f, 0.831501245f},
std::array<float,2>{0.424355447f, 0.387521923f},
std::array<float,2>{0.308394402f, 0.927261293f},
std::array<float,2>{0.567192316f, 0.295156956f},
std::array<float,2>{0.804873824f, 0.539267838f},
std::array<float,2>{0.065538533f, 0.028000772f},
std::array<float,2>{0.453123003f, 0.624377728f},
std::array<float,2>{0.644490361f, 0.0856493488f},
std::array<float,2>{0.914557576f, 0.966339529f},
std::array<float,2>{0.16040045f, 0.372975051f},
std::array<float,2>{0.0580480322f, 0.80872792f},
std::array<float,2>{0.83322823f, 0.445700467f},
std::array<float,2>{0.516055584f, 0.698769152f},
std::array<float,2>{0.339167118f, 0.238157436f},
std::array<float,2>{0.104025885f, 0.530345142f},
std::array<float,2>{0.751623333f, 0.0335250348f},
std::array<float,2>{0.600390196f, 0.898035944f},
std::array<float,2>{0.255980164f, 0.252867281f},
std::array<float,2>{0.382626981f, 0.847362936f},
std::array<float,2>{0.746460617f, 0.41087693f},
std::array<float,2>{0.994351447f, 0.66120106f},
std::array<float,2>{0.208562747f, 0.167300969f},
std::array<float,2>{0.344882429f, 0.720855534f},
std::array<float,2>{0.532488644f, 0.214200199f},
std::array<float,2>{0.859905243f, 0.758669734f},
std::array<float,2>{0.00332827936f, 0.492862523f},
std::array<float,2>{0.146007627f, 0.993337154f},
std::array<float,2>{0.889780343f, 0.341458142f},
std::array<float,2>{0.657715321f, 0.575850487f},
std::array<float,2>{0.474109083f, 0.107902601f},
std::array<float,2>{0.0282645673f, 0.706910491f},
std::array<float,2>{0.854019403f, 0.225902304f},
std::array<float,2>{0.558734953f, 0.783300757f},
std::array<float,2>{0.372989863f, 0.455080509f},
std::array<float,2>{0.486537635f, 0.951546252f},
std::array<float,2>{0.677619338f, 0.356291264f},
std::array<float,2>{0.894219339f, 0.596040845f},
std::array<float,2>{0.134073496f, 0.0687133446f},
std::array<float,2>{0.280560404f, 0.554965913f},
std::array<float,2>{0.620823205f, 0.0136893997f},
std::array<float,2>{0.777084589f, 0.909145594f},
std::array<float,2>{0.11744304f, 0.296990037f},
std::array<float,2>{0.198894069f, 0.812987566f},
std::array<float,2>{0.978420317f, 0.403550506f},
std::array<float,2>{0.725544631f, 0.631096661f},
std::array<float,2>{0.394311339f, 0.137843803f},
std::array<float,2>{0.173778892f, 0.591945589f},
std::array<float,2>{0.936736405f, 0.110162817f},
std::array<float,2>{0.631331623f, 0.982838035f},
std::array<float,2>{0.465758592f, 0.32163769f},
std::array<float,2>{0.312956423f, 0.766284704f},
std::array<float,2>{0.507915676f, 0.469652623f},
std::array<float,2>{0.822019935f, 0.739503145f},
std::array<float,2>{0.0354373604f, 0.202146783f},
std::array<float,2>{0.411066234f, 0.672951698f},
std::array<float,2>{0.699332356f, 0.181777731f},
std::array<float,2>{0.954729974f, 0.870900512f},
std::array<float,2>{0.246017441f, 0.428154171f},
std::array<float,2>{0.0858858675f, 0.876808345f},
std::array<float,2>{0.783632576f, 0.273409665f},
std::array<float,2>{0.580958307f, 0.501941442f},
std::array<float,2>{0.294065505f, 0.0570494831f},
std::array<float,2>{0.235895425f, 0.726432025f},
std::array<float,2>{0.962949157f, 0.218057215f},
std::array<float,2>{0.692609727f, 0.764886379f},
std::array<float,2>{0.418981344f, 0.496420503f},
std::array<float,2>{0.287193209f, 0.996341109f},
std::array<float,2>{0.591448009f, 0.336553156f},
std::array<float,2>{0.790542543f, 0.572504163f},
std::array<float,2>{0.0896082297f, 0.1040892f},
std::array<float,2>{0.456248075f, 0.524804235f},
std::array<float,2>{0.639709592f, 0.0364625268f},
std::array<float,2>{0.92202425f, 0.89141798f},
std::array<float,2>{0.180210158f, 0.254278809f},
std::array<float,2>{0.0455685109f, 0.84823823f},
std::array<float,2>{0.8188622f, 0.406403124f},
std::array<float,2>{0.502275646f, 0.656476259f},
std::array<float,2>{0.326122642f, 0.171704322f},
std::array<float,2>{0.114777468f, 0.617827475f},
std::array<float,2>{0.771228731f, 0.0799713433f},
std::array<float,2>{0.615645468f, 0.961018026f},
std::array<float,2>{0.267568111f, 0.368908823f},
std::array<float,2>{0.404444307f, 0.804750383f},
std::array<float,2>{0.729027987f, 0.451658607f},
std::array<float,2>{0.972167492f, 0.701939881f},
std::array<float,2>{0.187968865f, 0.240668029f},
std::array<float,2>{0.365721464f, 0.644026458f},
std::array<float,2>{0.553044379f, 0.144475549f},
std::array<float,2>{0.849215567f, 0.833780825f},
std::array<float,2>{0.0162805319f, 0.385311991f},
std::array<float,2>{0.132252425f, 0.923253119f},
std::array<float,2>{0.905557096f, 0.292247951f},
std::array<float,2>{0.680945516f, 0.546588063f},
std::array<float,2>{0.498066306f, 0.0236819498f},
std::array<float,2>{0.0153587479f, 0.67651546f},
std::array<float,2>{0.86961174f, 0.185308024f},
std::array<float,2>{0.543720961f, 0.87180692f},
std::array<float,2>{0.357337922f, 0.423006117f},
std::array<float,2>{0.478964895f, 0.879811823f},
std::array<float,2>{0.664740384f, 0.266699284f},
std::array<float,2>{0.875247121f, 0.506797612f},
std::array<float,2>{0.152932823f, 0.0592989586f},
std::array<float,2>{0.265553802f, 0.587111413f},
std::array<float,2>{0.602190614f, 0.114178315f},
std::array<float,2>{0.760434866f, 0.978854358f},
std::array<float,2>{0.096989885f, 0.327949315f},
std::array<float,2>{0.217834949f, 0.769730866f},
std::array<float,2>{0.986862361f, 0.47361511f},
std::array<float,2>{0.74053365f, 0.737862945f},
std::array<float,2>{0.388724566f, 0.195546225f},
std::array<float,2>{0.169597253f, 0.559742987f},
std::array<float,2>{0.909130931f, 0.0085621085f},
std::array<float,2>{0.653802395f, 0.912015915f},
std::array<float,2>{0.442783982f, 0.303065121f},
std::array<float,2>{0.331094205f, 0.817362189f},
std::array<float,2>{0.529378593f, 0.400618076f},
std::array<float,2>{0.839108586f, 0.626271725f},
std::array<float,2>{0.0507397763f, 0.134117976f},
std::array<float,2>{0.436939716f, 0.709730983f},
std::array<float,2>{0.717847049f, 0.221848741f},
std::array<float,2>{0.939969361f, 0.78850919f},
std::array<float,2>{0.218794286f, 0.45911029f},
std::array<float,2>{0.0765392482f, 0.947992623f},
std::array<float,2>{0.804677188f, 0.35205552f},
std::array<float,2>{0.57447499f, 0.598065078f},
std::array<float,2>{0.299691975f, 0.0652908906f},
std::array<float,2>{0.143624082f, 0.633475363f},
std::array<float,2>{0.885139227f, 0.129912242f},
std::array<float,2>{0.662998617f, 0.82787168f},
std::array<float,2>{0.468961388f, 0.393000156f},
std::array<float,2>{0.348157853f, 0.915073335f},
std::array<float,2>{0.535706699f, 0.307706922f},
std::array<float,2>{0.864794374f, 0.547950387f},
std::array<float,2>{0.00636618864f, 0.000542969618f},
std::array<float,2>{0.377147973f, 0.602234662f},
std::array<float,2>{0.744260728f, 0.0728886575f},
std::array<float,2>{0.997071624f, 0.942379951f},
std::array<float,2>{0.206577405f, 0.344687402f},
std::array<float,2>{0.107618824f, 0.79617244f},
std::array<float,2>{0.756555498f, 0.461412072f},
std::array<float,2>{0.597110927f, 0.712718189f},
std::array<float,2>{0.250364155f, 0.227164745f},
std::array<float,2>{0.0621676035f, 0.508326054f},
std::array<float,2>{0.828709841f, 0.0473369509f},
std::array<float,2>{0.522504985f, 0.889014363f},
std::array<float,2>{0.342492104f, 0.273781717f},
std::array<float,2>{0.447920501f, 0.864115894f},
std::array<float,2>{0.645055711f, 0.432264656f},
std::array<float,2>{0.919773638f, 0.685743392f},
std::array<float,2>{0.158332333f, 0.177877426f},
std::array<float,2>{0.309144467f, 0.74321115f},
std::array<float,2>{0.565391719f, 0.194147751f},
std::array<float,2>{0.811293721f, 0.778330684f},
std::array<float,2>{0.0700846091f, 0.483308196f},
std::array<float,2>{0.232727483f, 0.972857475f},
std::array<float,2>{0.948416114f, 0.316374511f},
std::array<float,2>{0.703943908f, 0.584831417f},
std::array<float,2>{0.42735666f, 0.117320769f},
std::array<float,2>{0.0804104134f, 0.691972911f},
std::array<float,2>{0.786715746f, 0.242517173f},
std::array<float,2>{0.585524857f, 0.80142349f},
std::array<float,2>{0.291429996f, 0.438549161f},
std::array<float,2>{0.408358693f, 0.959719539f},
std::array<float,2>{0.698306561f, 0.365384132f},
std::array<float,2>{0.960694909f, 0.615549684f},
std::array<float,2>{0.246154577f, 0.0920532942f},
std::array<float,2>{0.318578333f, 0.536319673f},
std::array<float,2>{0.51441431f, 0.0186293628f},
std::array<float,2>{0.824793816f, 0.932454765f},
std::array<float,2>{0.0321181789f, 0.286964417f},
std::array<float,2>{0.176280245f, 0.843315959f},
std::array<float,2>{0.930819452f, 0.377637208f},
std::array<float,2>{0.628591061f, 0.650328159f},
std::array<float,2>{0.461879343f, 0.151113883f},
std::array<float,2>{0.199503303f, 0.564839184f},
std::array<float,2>{0.982756138f, 0.0958808139f},
std::array<float,2>{0.721248984f, 0.99215591f},
std::array<float,2>{0.395132124f, 0.330595523f},
std::array<float,2>{0.275658518f, 0.75025475f},
std::array<float,2>{0.622523069f, 0.488075227f},
std::array<float,2>{0.77745533f, 0.727547586f},
std::array<float,2>{0.123183385f, 0.209178433f},
std::array<float,2>{0.488514394f, 0.670482516f},
std::array<float,2>{0.673528492f, 0.157257408f},
std::array<float,2>{0.897862554f, 0.854021192f},
std::array<float,2>{0.140323848f, 0.416599065f},
std::array<float,2>{0.0248082317f, 0.90380913f},
std::array<float,2>{0.858601749f, 0.258234292f},
std::array<float,2>{0.55552882f, 0.515756071f},
std::array<float,2>{0.370880544f, 0.0439626947f},
std::array<float,2>{0.183852449f, 0.715114713f},
std::array<float,2>{0.927732766f, 0.232059702f},
std::array<float,2>{0.6364097f, 0.792190909f},
std::array<float,2>{0.45777005f, 0.466369301f},
std::array<float,2>{0.320492327f, 0.940836251f},
std::array<float,2>{0.504423261f, 0.34936589f},
std::array<float,2>{0.812635958f, 0.607921362f},
std::array<float,2>{0.0391646065f, 0.0753383785f},
std::array<float,2>{0.415564775f, 0.552671492f},
std::array<float,2>{0.690331519f, 0.00525757298f},
std::array<float,2>{0.967066765f, 0.920687556f},
std::array<float,2>{0.238837034f, 0.311790645f},
std::array<float,2>{0.0906629935f, 0.822623014f},
std::array<float,2>{0.793915868f, 0.395485073f},
std::array<float,2>{0.589045942f, 0.638175428f},
std::array<float,2>{0.282663256f, 0.125824824f},
std::array<float,2>{0.0212958306f, 0.5786466f},
std::array<float,2>{0.846760571f, 0.12364725f},
std::array<float,2>{0.548970699f, 0.97227478f},
std::array<float,2>{0.361190826f, 0.317690551f},
std::array<float,2>{0.494184315f, 0.777118087f},
std::array<float,2>{0.685335696f, 0.480383217f},
std::array<float,2>{0.901145101f, 0.749053955f},
std::array<float,2>{0.126419291f, 0.188249484f},
std::array<float,2>{0.272011608f, 0.680324435f},
std::array<float,2>{0.609718204f, 0.174892321f},
std::array<float,2>{0.768360615f, 0.860146582f},
std::array<float,2>{0.111170933f, 0.436612487f},
std::array<float,2>{0.192102715f, 0.884010077f},
std::array<float,2>{0.974861443f, 0.277406037f},
std::array<float,2>{0.732323766f, 0.51334554f},
std::array<float,2>{0.400509208f, 0.0539913848f},
std::array<float,2>{0.0982577428f, 0.654629529f},
std::array<float,2>{0.763114333f, 0.155822352f},
std::array<float,2>{0.605887055f, 0.837791502f},
std::array<float,2>{0.258424878f, 0.380323887f},
std::array<float,2>{0.386183232f, 0.937046885f},
std::array<float,2>{0.736753702f, 0.281622559f},
std::array<float,2>{0.989160299f, 0.532491207f},
std::array<float,2>{0.213637084f, 0.0221019574f},
std::array<float,2>{0.354475647f, 0.611755133f},
std::array<float,2>{0.539821565f, 0.0881703496f},
std::array<float,2>{0.873944163f, 0.955802381f},
std::array<float,2>{0.011178025f, 0.363211393f},
std::array<float,2>{0.149309903f, 0.800402939f},
std::array<float,2>{0.881785035f, 0.443199128f},
std::array<float,2>{0.668575883f, 0.688761771f},
std::array<float,2>{0.483271569f, 0.24868834f},
std::array<float,2>{0.223951533f, 0.521537662f},
std::array<float,2>{0.944583178f, 0.0424548499f},
std::array<float,2>{0.711243629f, 0.901540458f},
std::array<float,2>{0.431903034f, 0.262870848f},
std::array<float,2>{0.301623642f, 0.859221399f},
std::array<float,2>{0.572369695f, 0.421406031f},
std::array<float,2>{0.800658107f, 0.66638279f},
std::array<float,2>{0.0728123114f, 0.16237016f},
std::array<float,2>{0.439695269f, 0.731388032f},
std::array<float,2>{0.650045216f, 0.203407541f},
std::array<float,2>{0.911925197f, 0.754466236f},
std::array<float,2>{0.164921626f, 0.49032557f},
std::array<float,2>{0.0515851229f, 0.986620128f},
std::array<float,2>{0.842702746f, 0.333559185f},
std::array<float,2>{0.525528729f, 0.569558084f},
std::array<float,2>{0.333930939f, 0.098346509f},
std::array<float,2>{0.210826337f, 0.662368f},
std::array<float,2>{0.994009972f, 0.164973751f},
std::array<float,2>{0.748399973f, 0.845426202f},
std::array<float,2>{0.379443139f, 0.412122101f},
std::array<float,2>{0.254470587f, 0.895508468f},
std::array<float,2>{0.598766804f, 0.251244664f},
std::array<float,2>{0.753823638f, 0.527778924f},
std::array<float,2>{0.103105202f, 0.0319552906f},
std::array<float,2>{0.476388097f, 0.577719688f},
std::array<float,2>{0.658425927f, 0.10654211f},
std::array<float,2>{0.887924314f, 0.99557817f},
std::array<float,2>{0.148049131f, 0.343411386f},
std::array<float,2>{0.00108126318f, 0.759778917f},
std::array<float,2>{0.862937987f, 0.494982064f},
std::array<float,2>{0.535056472f, 0.719449043f},
std::array<float,2>{0.34732011f, 0.212507173f},
std::array<float,2>{0.0631444976f, 0.541559935f},
std::array<float,2>{0.806958258f, 0.0298693553f},
std::array<float,2>{0.56838125f, 0.928128779f},
std::array<float,2>{0.305211484f, 0.293496221f},
std::array<float,2>{0.422557861f, 0.829526126f},
std::array<float,2>{0.710369349f, 0.390538275f},
std::array<float,2>{0.951857746f, 0.645748258f},
std::array<float,2>{0.22993736f, 0.144727409f},
std::array<float,2>{0.33682552f, 0.69572401f},
std::array<float,2>{0.519364774f, 0.235875472f},
std::array<float,2>{0.834692895f, 0.811228454f},
std::array<float,2>{0.0564023443f, 0.447699726f},
std::array<float,2>{0.16303046f, 0.967083454f},
std::array<float,2>{0.917278588f, 0.374085128f},
std::array<float,2>{0.641236663f, 0.6222803f},
std::array<float,2>{0.450673133f, 0.0838599876f},
std::array<float,2>{0.0372025967f, 0.740632772f},
std::array<float,2>{0.82341814f, 0.200492606f},
std::array<float,2>{0.511012375f, 0.769478381f},
std::array<float,2>{0.316302121f, 0.471637994f},
std::array<float,2>{0.468388855f, 0.981286347f},
std::array<float,2>{0.630144536f, 0.322980434f},
std::array<float,2>{0.935265303f, 0.590843081f},
std::array<float,2>{0.174130455f, 0.112427816f},
std::array<float,2>{0.296007752f, 0.503026843f},
std::array<float,2>{0.579289556f, 0.0561322011f},
std::array<float,2>{0.783136964f, 0.877433538f},
std::array<float,2>{0.0823350847f, 0.270662785f},
std::array<float,2>{0.242426813f, 0.868554294f},
std::array<float,2>{0.955911636f, 0.426405281f},
std::array<float,2>{0.702033997f, 0.67547518f},
std::array<float,2>{0.412596196f, 0.180807933f},
std::array<float,2>{0.136285305f, 0.594847083f},
std::array<float,2>{0.891699851f, 0.0668748841f},
std::array<float,2>{0.678162813f, 0.951084971f},
std::array<float,2>{0.485621721f, 0.358685017f},
std::array<float,2>{0.373552948f, 0.782237589f},
std::array<float,2>{0.561390162f, 0.45402348f},
std::array<float,2>{0.852279603f, 0.703890085f},
std::array<float,2>{0.0295184255f, 0.224538162f},
std::array<float,2>{0.391367763f, 0.629855514f},
std::array<float,2>{0.723392546f, 0.140409425f},
std::array<float,2>{0.979751229f, 0.816031277f},
std::array<float,2>{0.195937097f, 0.405934751f},
std::array<float,2>{0.12061315f, 0.90770942f},
std::array<float,2>{0.774127364f, 0.299843609f},
std::array<float,2>{0.618871331f, 0.557968974f},
std::array<float,2>{0.278717041f, 0.0133044496f}} | 49.007813 | 53 | 0.734731 | st-ario |
a6b7cfc432faae582fa25bf2fae88f1bc236ce4f | 1,541 | cpp | C++ | source/ListFileRecursively_For_Compare.cpp | Linux-pt/escan-backup | bfaed321201e512974e70c305beba53892428efc | [
"Unlicense"
] | null | null | null | source/ListFileRecursively_For_Compare.cpp | Linux-pt/escan-backup | bfaed321201e512974e70c305beba53892428efc | [
"Unlicense"
] | null | null | null | source/ListFileRecursively_For_Compare.cpp | Linux-pt/escan-backup | bfaed321201e512974e70c305beba53892428efc | [
"Unlicense"
] | null | null | null | #include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<stdlib.h>
#include<unistd.h>
#include<signal.h>
#include"Compare_File_Present_In_Backup.h"
#include<dirent.h>
#include<sqlite3.h>
#include"CalculateSha1sum.h"
#include"ListFileRecursively_For_Compare.h"
#include"HandleSigint.h"
using namespace std;
/*for every file it will call Compare_File_Present_In_Backup this function*/
/*Compare_File_Present_In_Backup*/
/*CalculateSha1sum*/
extern sqlite3 *db;
extern int flag;
void ListFileRecursively_For_Compare(char *basePath)
{
signal(SIGINT, HandleSigint);
signal(SIGTERM, HandleSigint);
//WriteLogForlibmwshare(2,"ListFileRecursively_For_Compare started" );
char path[1024]="";
struct dirent *dp;
DIR *dir = opendir(basePath);
//char sha1[1024]="";
if (!dir)
{
return;
}
while ((dp = readdir(dir)) != NULL && !flag)
{
if (strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0)
{
strcpy(path, basePath);
strcat(path, "/");
strcat(path, dp->d_name);
printf("%s\n",dp->d_name);
if((dp->d_type==DT_SOCK) || (dp->d_type==DT_BLK) || (dp->d_type==DT_CHR) || (dp->d_type==DT_FIFO) || (dp->d_type==DT_LNK) || (dp->d_type==DT_UNKNOWN))
{
continue;
}
if(dp->d_type==DT_REG)
{
char sha1[1024]="";
strcpy(sha1,CalculateSha1sum(path).c_str());
Compare_File_Present_In_Backup(dp->d_name,path,sha1,basePath);
}
ListFileRecursively_For_Compare(path);
}
}
//WriteLogForlibmwshare(2,"ListFileRecursively_For_Compare ended" );
closedir(dir);
}
| 24.854839 | 153 | 0.693056 | Linux-pt |
a6c22243e61255bbf774e0eb06a0a7f7bb1b5d8c | 4,028 | cpp | C++ | lib/smack/SmackWarnings.cpp | Guoanshisb/smack | 6fee210b1cb272cb9f596ea53e08935c159ec2f2 | [
"MIT"
] | 2 | 2021-10-08T00:50:26.000Z | 2021-12-17T07:18:15.000Z | lib/smack/SmackWarnings.cpp | Guoanshisb/smack | 6fee210b1cb272cb9f596ea53e08935c159ec2f2 | [
"MIT"
] | 1 | 2021-09-29T07:21:20.000Z | 2021-09-29T07:21:20.000Z | lib/smack/SmackWarnings.cpp | Guoanshisb/smack | 6fee210b1cb272cb9f596ea53e08935c159ec2f2 | [
"MIT"
] | 1 | 2021-10-12T09:02:40.000Z | 2021-10-12T09:02:40.000Z | #include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/raw_ostream.h"
#include "smack/SmackOptions.h"
#include "smack/SmackWarnings.h"
#include <algorithm>
#include <set>
namespace smack {
using namespace llvm;
std::string buildDebugInfo(const Instruction *i) {
std::stringstream ss;
if (i && i->getMetadata("dbg")) {
const DebugLoc DL = i->getDebugLoc();
auto *scope = cast<DIScope>(DL.getScope());
ss << scope->getFilename().str() << ":" << DL.getLine() << ":"
<< DL.getCol() << ": ";
}
return ss.str();
}
bool SmackWarnings::isSufficientWarningLevel(WarningLevel level) {
return SmackOptions::WarningLevel >= level;
}
SmackWarnings::UnsetFlagsT
SmackWarnings::getUnsetFlags(RequiredFlagsT requiredFlags) {
UnsetFlagsT ret;
std::copy_if(requiredFlags.begin(), requiredFlags.end(),
std::inserter(ret, ret.begin()),
[](FlagT *flag) { return !*flag; });
return ret;
}
bool SmackWarnings::isSatisfied(RequiredFlagsT requiredFlags,
FlagRelation rel) {
auto unsetFlags = getUnsetFlags(requiredFlags);
return rel == FlagRelation::And ? unsetFlags.empty()
: unsetFlags.size() < requiredFlags.size();
}
std::string SmackWarnings::getFlagStr(UnsetFlagsT flags) {
std::string ret = "{ ";
for (auto f : flags) {
if (f->ArgStr.str() == "bit-precise")
ret += ("--integer-encoding=bit-vector ");
else
ret += ("--" + f->ArgStr.str() + " ");
}
return ret + "}";
}
void SmackWarnings::warnIfUnsound(std::string name,
RequiredFlagsT requiredFlags,
Block *currBlock, const Instruction *i,
bool ignore, FlagRelation rel) {
if (!isSatisfied(requiredFlags, rel))
warnUnsound(name, getUnsetFlags(requiredFlags), currBlock, i, ignore);
}
void SmackWarnings::warnUnsound(std::string unmodeledOpName, Block *currBlock,
const Instruction *i, bool ignore,
FlagRelation rel) {
warnUnsound("unmodeled operation " + unmodeledOpName, UnsetFlagsT(),
currBlock, i, ignore, rel);
}
void SmackWarnings::warnUnsound(std::string name, UnsetFlagsT unsetFlags,
Block *currBlock, const Instruction *i,
bool ignore, FlagRelation rel) {
if (!isSufficientWarningLevel(WarningLevel::Unsound))
return;
std::string beginning = std::string("llvm2bpl: ") + buildDebugInfo(i);
std::string end =
(ignore ? "unsoundly ignoring " : "over-approximating ") + name + ";";
if (currBlock)
currBlock->addStmt(Stmt::comment(beginning + "warning: " + end));
std::string hint = "";
if (!unsetFlags.empty())
hint = (" try adding " + ((rel == FlagRelation::And ? "all the " : "any ") +
("flag(s) in: " + getFlagStr(unsetFlags))));
errs() << beginning;
(SmackOptions::ColoredWarnings ? errs().changeColor(raw_ostream::MAGENTA)
: errs())
<< "warning: ";
(SmackOptions::ColoredWarnings ? errs().resetColor() : errs())
<< end << hint << "\n";
}
void SmackWarnings::warnIfUnsound(std::string name, FlagT &requiredFlag,
Block *currBlock, const Instruction *i,
FlagRelation rel) {
warnIfUnsound(name, {&requiredFlag}, currBlock, i, false, rel);
}
void SmackWarnings::warnIfUnsound(std::string name, FlagT &requiredFlag1,
FlagT &requiredFlag2, Block *currBlock,
const Instruction *i, FlagRelation rel) {
warnIfUnsound(name, {&requiredFlag1, &requiredFlag2}, currBlock, i, false,
rel);
}
void SmackWarnings::warnInfo(std::string info) {
if (!isSufficientWarningLevel(WarningLevel::Info))
return;
errs() << "warning: " << info << "\n";
}
} // namespace smack
| 35.646018 | 80 | 0.59434 | Guoanshisb |
a6c3afb8b0d9b79b258b3b169d1743872bc4af57 | 1,647 | hpp | C++ | Crisp/Animation/Animator.hpp | FallenShard/Crisp | d4cf22c0f9af73a6c4ba2b7d67696f1a188fd423 | [
"MIT"
] | 6 | 2017-09-14T03:26:49.000Z | 2021-09-18T05:40:59.000Z | Crisp/Animation/Animator.hpp | FallenShard/Crisp | d4cf22c0f9af73a6c4ba2b7d67696f1a188fd423 | [
"MIT"
] | null | null | null | Crisp/Animation/Animator.hpp | FallenShard/Crisp | d4cf22c0f9af73a6c4ba2b7d67696f1a188fd423 | [
"MIT"
] | null | null | null | #pragma once
#include "Animation/Animation.hpp"
#include <memory>
#include <vector>
#include <unordered_map>
#include <unordered_set>
namespace crisp
{
class Animator
{
public:
Animator();
~Animator() = default;
Animator(const Animator& animator) = delete;
Animator(Animator&& animator) = default;
Animator& operator=(const Animator& animator) = delete;
Animator& operator=(Animator&& animator) = default;
void update(double dt);
void add(std::shared_ptr<Animation> animation);
void add(std::shared_ptr<Animation> animation, void* targetObject);
void remove(std::shared_ptr<Animation> animation);
void clearAllAnimations();
void clearObjectAnimations(void* targetObject);
private:
// The list of animations that are currently actively updated
std::vector<std::shared_ptr<Animation>> m_activeAnimations;
// The list of animations that will enter the list of active animations
// The list is separate to allow addition of animations inside an animation handler
// This avoids invalidation of the m_activeAnimations container iterator
std::vector<std::shared_ptr<Animation>> m_pendingAnimations;
// The set of animations slated to be removed from active animations list
std::unordered_set<std::shared_ptr<Animation>> m_removedAnimations;
// Ties the lifetime of a group of animations to a particular object pointer
std::unordered_map<void*, std::vector<std::shared_ptr<Animation>>> m_animationLifetimes;
bool m_clearAllAnimations;
};
} | 34.3125 | 96 | 0.690346 | FallenShard |
a6c482f53f26f26847571a3e58cfab955df67f44 | 2,258 | cpp | C++ | libv8/ruby/1.9.1/gems/therubyracer-0.9.4/ext/v8/v8_callbacks.cpp | tcmaker/ConOnRails | 97656120dbc9a5bf773538e021b768d0515ae333 | [
"Apache-2.0"
] | 1 | 2021-02-07T21:33:42.000Z | 2021-02-07T21:33:42.000Z | libv8/ruby/1.9.1/gems/therubyracer-0.9.4/ext/v8/v8_callbacks.cpp | tcmaker/ConOnRails | 97656120dbc9a5bf773538e021b768d0515ae333 | [
"Apache-2.0"
] | null | null | null | libv8/ruby/1.9.1/gems/therubyracer-0.9.4/ext/v8/v8_callbacks.cpp | tcmaker/ConOnRails | 97656120dbc9a5bf773538e021b768d0515ae333 | [
"Apache-2.0"
] | null | null | null | #include "v8_callbacks.h"
#include "rr.h"
using namespace v8;
namespace {
VALUE ArgumentsClass;
VALUE AccessorInfoClass;
VALUE _Data(VALUE self) {
return rb_iv_get(self, "data");
}
namespace Accessor {
AccessorInfo *info(VALUE value) {
AccessorInfo* i = 0;
Data_Get_Struct(value, class AccessorInfo, i);
return i;
}
VALUE This(VALUE self) {
return rr_v82rb(info(self)->This());
}
VALUE Holder(VALUE self) {
return rr_v82rb(info(self)->Holder());
}
}
namespace Args {
Arguments* args(VALUE value) {
Arguments *arguments = 0;
Data_Get_Struct(value, class Arguments, arguments);
return arguments;
}
VALUE This(VALUE self) {
return rr_v82rb(args(self)->This());
}
VALUE Holder(VALUE self) {
return rr_v82rb(args(self)->Holder());
}
VALUE Length(VALUE self) {
return rr_v82rb(args(self)->Length());
}
VALUE Get(VALUE self, VALUE index) {
int i = NUM2INT(index);
return rr_v82rb((*args(self))[i]);
}
VALUE Callee(VALUE self) {
return rr_v82rb(args(self)->Callee());
}
VALUE IsConstructCall(VALUE self) {
return rr_v82rb(args(self)->IsConstructCall());
}
}
}
void rr_init_v8_callbacks() {
AccessorInfoClass = rr_define_class("AccessorInfo");
rr_define_method(AccessorInfoClass, "This", Accessor::This, 0);
rr_define_method(AccessorInfoClass, "Holder", Accessor::Holder, 0);
rr_define_method(AccessorInfoClass, "Data", _Data, 0);
ArgumentsClass = rr_define_class("Arguments");
rr_define_method(ArgumentsClass, "This", Args::This, 0);
rr_define_method(ArgumentsClass, "Holder", Args::Holder, 0);
rr_define_method(ArgumentsClass, "Data", _Data, 0);
rr_define_method(ArgumentsClass, "Length", Args::Length, 0);
rr_define_method(ArgumentsClass, "Callee", Args::Callee, 0);
rr_define_method(ArgumentsClass, "IsConstructCall", Args::IsConstructCall, 0);
rr_define_method(ArgumentsClass, "[]", Args::Get, 1);
}
VALUE rr_v82rb(const AccessorInfo& info) {
return Data_Wrap_Struct(AccessorInfoClass, 0, 0, (void*)&info);
}
VALUE rr_v82rb(const Arguments& arguments) {
return Data_Wrap_Struct(ArgumentsClass, 0, 0, (void*)&arguments);
}
| 27.536585 | 80 | 0.670948 | tcmaker |
a6c4da6eb438be1445b8c3a428b6148ec1d4d42e | 3,405 | cpp | C++ | External/xlLib/Projects/UnitTest/Common/Containers/xlSetTest.cpp | Streamlet/RCVersion | f34d01d84bdb58c6a989c88e3cb1d75d04aefd21 | [
"MIT"
] | 5 | 2015-10-13T15:04:09.000Z | 2021-12-30T00:07:05.000Z | External/xlLib/Projects/UnitTest/Common/Containers/xlSetTest.cpp | Streamlet/RCVersion | f34d01d84bdb58c6a989c88e3cb1d75d04aefd21 | [
"MIT"
] | null | null | null | External/xlLib/Projects/UnitTest/Common/Containers/xlSetTest.cpp | Streamlet/RCVersion | f34d01d84bdb58c6a989c88e3cb1d75d04aefd21 | [
"MIT"
] | 1 | 2016-06-22T12:32:51.000Z | 2016-06-22T12:32:51.000Z | //------------------------------------------------------------------------------
//
// Copyright (C) Streamlet. All rights reserved.
//
// File Name: xlSetTest.cpp
// Author: Streamlet
// Create Time: 2011-04-30
// Description:
//
//------------------------------------------------------------------------------
#include "../../../../Include/xl/Common/Containers/xlSet.h"
#include "../../../../Include/xl/AppHelper/xlUnitTest.h"
namespace
{
using namespace xl;
XL_TEST_CASE()
{
Set<int> a;
XL_TEST_ASSERT(a.Size() == 0);
}
XL_TEST_CASE()
{
Set<int> a;
XL_TEST_ASSERT(a.Size() == 0);
Set<int> b(a);
XL_TEST_ASSERT(b.Size() == 0);
a.Insert(1);
a.Insert(2);
Set<int> c(a);
XL_TEST_ASSERT(c.Size() == 2);
XL_TEST_ASSERT(*c.Begin() == 1);
XL_TEST_ASSERT(*c.ReverseBegin() == 2);
}
XL_TEST_CASE()
{
Set<int> a;
XL_TEST_ASSERT(a.Size() == 0);
Set<int> b;
b = a;
XL_TEST_ASSERT(b.Size() == 0);
a.Insert(1);
a.Insert(2);
Set<int> c;
c = a;
XL_TEST_ASSERT(c.Size() == 2);
XL_TEST_ASSERT(*a.Begin() == 1);
XL_TEST_ASSERT(*++a.Begin() == 2);
}
XL_TEST_CASE()
{
Set<int> a;
XL_TEST_ASSERT(a.Size() == 0);
Set<int> b;
b = a;
XL_TEST_ASSERT(b == a);
XL_TEST_ASSERT(!(b != a));
a.Insert(1);
a.Insert(2);
XL_TEST_ASSERT(b != a);
XL_TEST_ASSERT(!(b == a));
Set<int> c(a);
XL_TEST_ASSERT(c == a);
XL_TEST_ASSERT(!(c != a));
b.Insert(1);
b.Insert(2);
XL_TEST_ASSERT(b == a);
XL_TEST_ASSERT(!(b != a));
XL_TEST_ASSERT(b == c);
XL_TEST_ASSERT(!(b != c));
}
XL_TEST_CASE()
{
Set<int> a;
XL_TEST_ASSERT(a.Size() == 0);
XL_TEST_ASSERT(a.Empty() == true);
a.Insert(10);
XL_TEST_ASSERT(a.Size() == 1);
XL_TEST_ASSERT(a.Empty() == false);
a.Insert(20);
a.Insert(30);
a.Insert(40);
a.Insert(50);
XL_TEST_ASSERT(a.Size() == 5);
XL_TEST_ASSERT(a.Empty() == false);
}
XL_TEST_CASE()
{
Set<int> a;
a.Insert(2);
a.Insert(6);
a.Insert(4);
a.Insert(3);
a.Insert(5);
a.Insert(1);
Set<int>::Iterator it = a.Begin();
XL_TEST_ASSERT(*it == 1);
++it;
XL_TEST_ASSERT(*it == 2);
++it;
XL_TEST_ASSERT(*it == 3);
++it;
XL_TEST_ASSERT(*it == 4);
++it;
XL_TEST_ASSERT(*it == 5);
++it;
XL_TEST_ASSERT(*it == 6);
++it;
XL_TEST_ASSERT(it == a.End());
}
XL_TEST_CASE()
{
Set<int> a;
a.Insert(2);
a.Insert(6);
a.Insert(4);
a.Insert(3);
a.Insert(5);
a.Insert(1);
Set<int>::Iterator it = a.Find(5);
XL_TEST_ASSERT(*it == 5);
Set<int>::Iterator it2 = it;
++it2;
XL_TEST_ASSERT(*it2 == 6);
++it2;
XL_TEST_ASSERT(it2 == a.End());
}
}
| 20.889571 | 81 | 0.408811 | Streamlet |
a6c5f99c3e9c524b163d245bd93e4ddfd6778a2c | 1,352 | cpp | C++ | libs/renderer/src/renderer/state/ffp/misc/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 2 | 2016-01-27T13:18:14.000Z | 2018-05-11T01:11:32.000Z | libs/renderer/src/renderer/state/ffp/misc/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | null | null | null | libs/renderer/src/renderer/state/ffp/misc/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 3 | 2018-05-11T01:11:34.000Z | 2021-04-24T19:47:45.000Z | // Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <sge/renderer/state/ffp/misc/enable_point_sprites.hpp>
#include <sge/renderer/state/ffp/misc/local_viewer.hpp>
#include <sge/renderer/state/ffp/misc/normalize_normals.hpp>
#include <sge/renderer/state/ffp/misc/parameters.hpp>
sge::renderer::state::ffp::misc::parameters::parameters(
sge::renderer::state::ffp::misc::enable_point_sprites const _enable_point_sprites,
sge::renderer::state::ffp::misc::local_viewer const _local_viewer,
sge::renderer::state::ffp::misc::normalize_normals const _normalize_normals)
: enable_point_sprites_(_enable_point_sprites),
local_viewer_(_local_viewer),
normalize_normals_(_normalize_normals)
{
}
sge::renderer::state::ffp::misc::enable_point_sprites
sge::renderer::state::ffp::misc::parameters::enable_point_sprites() const
{
return enable_point_sprites_;
}
sge::renderer::state::ffp::misc::local_viewer
sge::renderer::state::ffp::misc::parameters::local_viewer() const
{
return local_viewer_;
}
sge::renderer::state::ffp::misc::normalize_normals
sge::renderer::state::ffp::misc::parameters::normalize_normals() const
{
return normalize_normals_;
}
| 35.578947 | 86 | 0.756657 | cpreh |
a6cb8a676ed34194a0da709b53eb3f3b558c463e | 4,562 | cpp | C++ | DPMI.cpp | fringpfe/BBSETUP | eb9d96e7223797e5c4170301f0120baace25424c | [
"MIT"
] | null | null | null | DPMI.cpp | fringpfe/BBSETUP | eb9d96e7223797e5c4170301f0120baace25424c | [
"MIT"
] | null | null | null | DPMI.cpp | fringpfe/BBSETUP | eb9d96e7223797e5c4170301f0120baace25424c | [
"MIT"
] | null | null | null | /**
*
* Copyright (C) 2021 Fabian Ringpfeil
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/*****************************************************************************************************************
* Functions handling the DOS Protected Mode Interface (DPMI) - in particular the VESA BIOS Extension (VBE).
*****************************************************************************************************************/
#include "DPMI.h"
#include "GUI.h"
#include <i86.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define DPMI_real_segment(P) ((((unsigned int) (P)) >> 4) & 0xFFFF)
#define DPMI_real_offset(P) (((unsigned int) (P)) & 0xF)
VbeInfoBlock *DPMI_VbeInfo;
ModeInfoBlock *ModeInfo;
RMREGS rmregs;
void* DPMI_Alloc(int size)
{
union REGS inregs;
/* Allocate DOS Memory Block: Allocates a block of memory from the DOS memory pool, i.e. memory below the 1 MB boundary that is controlled by DOS. */
inregs.w.ax = 0x100;
inregs.w.bx = size;
int386(0x31, &inregs, &inregs);
if (inregs.w.cflag)
{
GUI_ErrorHandler(1049);
}
return (void*)(inregs.w.ax << 4);
}
bool DPMI_CompareVideoModeNumber(short video_mode, short* vbe_info)
{
short *i;
for ( i = vbe_info; ; ++i )
{
if ( *i == video_mode )
{
return 1;
}
if (*i == -1)
{
break;
}
}
return 0;
}
bool DPMI_IsVesaAvailable(void)
{
union REGS inregs;
struct SREGS segregs;
if(!DPMI_VbeInfo)
{
DPMI_VbeInfo = (VbeInfoBlock *)DPMI_Alloc(sizeof(VbeInfoBlock));
}
printf("DPMI_IsVesaAvailable: Check if VESA is available.\n");
/* VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION:
* Determine whether VESA BIOS extensions are present and the capabilities supported by the display adapter.
*/
memset(&rmregs, 0, 50u);
memset(&segregs, 0, sizeof(SREGS)); /* Workaround to prevent segment violation. */
rmregs.eax = 0x4f00;
rmregs.es = DPMI_real_segment(DPMI_VbeInfo);
rmregs.edi = DPMI_real_offset(DPMI_VbeInfo);
inregs.w.ax = 0x300;
inregs.w.bx = 0x10;
inregs.w.cx = 0;
segregs.es = FP_SEG(&rmregs);
inregs.x.edi = FP_OFF(&rmregs);
int386x(0x31,&inregs,&inregs,&segregs);
if(rmregs.eax != 0x4f)
{
return 0;
}
return (memcmp(DPMI_VbeInfo, "VESA", 4u) == 0);
}
bool DPMI_IsVideoModeSupported(short video_mode, short* vbe_info)
{
union REGS inregs;
struct SREGS sregs;
if ( !DPMI_CompareVideoModeNumber(video_mode, (short *)vbe_info) )
{
return 0;
}
if ( !ModeInfo )
{
ModeInfo = (ModeInfoBlock *)DPMI_Alloc(sizeof(ModeInfoBlock));
}
/* VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION: Determine the attributes of the specified video mode. */
memset(&rmregs, 0, sizeof(rmregs));
memset(&sregs, 0, sizeof(sregs));
rmregs.eax = 0x4f01;
rmregs.ecx = video_mode;
rmregs.es = DPMI_real_segment(ModeInfo);
rmregs.edi = DPMI_real_offset(ModeInfo);
inregs.w.ax = 0x300;
inregs.w.bx = 0x10;
inregs.w.cx = 0;
sregs.es = FP_SEG(&rmregs);
inregs.x.edi = FP_OFF(&rmregs);
int386x(0x31,&inregs,&inregs,&sregs);
if(rmregs.eax != 0x4f)
{
return 0;
}
return (ModeInfo->ModeAttributes & 3) != 2;
} | 29.816993 | 154 | 0.603463 | fringpfe |
a6d2ca41a9848773de508407966b96f6846fd538 | 1,145 | cpp | C++ | src/common.cpp | baldinialberto/awiGame | 88937014bcbacdac6766fad8696384fa84f91582 | [
"Unlicense"
] | null | null | null | src/common.cpp | baldinialberto/awiGame | 88937014bcbacdac6766fad8696384fa84f91582 | [
"Unlicense"
] | null | null | null | src/common.cpp | baldinialberto/awiGame | 88937014bcbacdac6766fad8696384fa84f91582 | [
"Unlicense"
] | null | null | null | #include "../include/common.hpp"
me::fIt::fIt(const char *path, const char *flags)
: _file{path, flags[0] == 'r' ? std::ios_base::in : std::ios_base::out}
{
}
me::fIt::~fIt()
{
if (_file.is_open())
_file.close();
}
bool me::fIt::opened() const { return _file.is_open(); }
const me::fIt &me::fIt::load(const char *path, const char *flags)
{
_file.open(path, flags[0] == 'r' ? std::ios_base::in : std::ios_base::out);
return *this;
}
int me::fIt::write(const char *data, size_t size)
{
if (data == nullptr || size == 0)
return 1;
_file.write(data, size);
return _file.eof() | _file.fail() | _file.bad();
}
int me::fIt::read(char *dest, size_t size)
{
if (dest == nullptr || size == 0)
return 1;
_file.read(dest, size);
return _file.eof() | _file.fail() | _file.bad();
}
string me::filePath(const char *pFilename, fm::pokekit_type pType)
{
//string currFilePath{std::__fs::filesystem::current_path()};
string currFilePath{"/Users/albertobaldini/source/repos/awigame/"};
currFilePath.append(fm::pokekit_relPaths[pType]).append(pFilename);
return currFilePath;
}
| 25.444444 | 79 | 0.625328 | baldinialberto |
a6dee0dbf1fac1d4e4a8c8bd64759b178250ccbb | 1,824 | cpp | C++ | source/tests.cpp | MarianFriedrich/3_programmiersprachen-blatt | 0bd4087b29fa628a7e9ff0a0f489402b08685bd1 | [
"MIT"
] | null | null | null | source/tests.cpp | MarianFriedrich/3_programmiersprachen-blatt | 0bd4087b29fa628a7e9ff0a0f489402b08685bd1 | [
"MIT"
] | null | null | null | source/tests.cpp | MarianFriedrich/3_programmiersprachen-blatt | 0bd4087b29fa628a7e9ff0a0f489402b08685bd1 | [
"MIT"
] | null | null | null | #define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <list>
#include <cstdlib>
#include "circle.hpp"
// Circle Operatoren
TEST_CASE("describe_circle_operator_same","[circle_operator_same]")
{
Circle test1{{0,0},5,{0.0,0.0,0.0}};
Circle test2{{0,0},5,{0.0,0.0,0.0}};
REQUIRE(test1 == test2);
}
TEST_CASE("describe_circle_operator_smaller","[circle_operator_smaller]")
{
Circle test1{{0,0},5,{0.0,0.0,0.0}};
Circle test2{{0,0},10,{0.0,0.0,0.0}};
REQUIRE(test1 < test2);
}
TEST_CASE("describe_circle_operator_bigger","[circle_operator_bigger]")
{
Circle test1{{0,0},10,{0.0,0.0,0.0}};
Circle test2{{0,0},5,{0.0,0.0,0.0}};
REQUIRE(test1 > test2);
}
// Circle sortieren in Liste
TEST_CASE("describe_circle_sort","[circle_sort]")
{
std::list <Circle> liste;
for(unsigned int i = 0; i < 100; ++i){
liste.push_back(Circle{{0.0,0.0},(std::rand() % 100 + 1.0f),{0.0,0.0,0.0}});
}
liste.sort();
REQUIRE(std::is_sorted(liste.begin(), liste.end()));
}
// Sort with lamda
TEST_CASE("describe_lamda_sort","[lambda_sort]")
{
std::vector <Circle> vec;
for(unsigned int i = 0; i < 100; ++i){
vec.push_back(Circle{{0.0,0.0},(std::rand() % 100 + 1.0f),{0.0,0.0,0.0}});
}
auto comp = [](const Circle& c1,const Circle& c2) -> bool{return c1 < c2;};
std::sort(vec.begin(),vec.end(),comp);
REQUIRE(std::is_sorted(vec.begin(), vec.end()));
}
// Elementweises aufaddieren
TEST_CASE("describe_addieren","[addieren]")
{
std::vector<int> v1{1,2,3,4,5,6,7,8,9};
std::vector<int> v2{9,8,7,6,5,4,3,2,1};
std::vector<int> v3(9);
//cpp-reference(td::plus)
std::transform (v1.begin(), v1.end(), v2.begin(), v3.begin(), std::plus<int>());
//cpp-reference(std::all_of)
REQUIRE(std::all_of(v3.begin(), v3.end(), [](int i){return i==10;}));
}
int main(int argc, char *argv[])
{
return Catch::Session().run(argc, argv);
}
| 28.061538 | 81 | 0.64693 | MarianFriedrich |
a6e2a2806d8ee5c1a94caab136a98daab2f282e4 | 883 | cpp | C++ | src/tests/test-datetime.cpp | cshnick/liteSql_custom_generator | 31f81ab13b689616672ab45805c3ffdfab3a1057 | [
"BSD-3-Clause"
] | 11 | 2017-04-19T03:01:13.000Z | 2020-08-03T05:21:31.000Z | src/tests/test-datetime.cpp | cshnick/liteSql_custom_generator | 31f81ab13b689616672ab45805c3ffdfab3a1057 | [
"BSD-3-Clause"
] | 14 | 2016-05-24T00:20:42.000Z | 2019-02-11T18:36:36.000Z | src/tests/test-datetime.cpp | cshnick/liteSql_custom_generator | 31f81ab13b689616672ab45805c3ffdfab3a1057 | [
"BSD-3-Clause"
] | 4 | 2017-04-03T08:03:11.000Z | 2019-08-20T04:48:50.000Z | /* LiteSQL - test-datetime
*
* The list of contributors at http://litesql.sf.net/
*
* See LICENSE for copyright information. */
#include <assert.h>
#include "litesql/datetime.hpp"
/*
Datetime unit tester
TC1: test for equality on load/ save (see ticket #13)
*/
using namespace litesql;
int main(int argc, char *argv[]) {
// TC1 for DateTime
DateTime dt;
std::string dtstring = dt.asString();
DateTime dt2 = convert<const string&, DateTime>(dtstring);
assert(dt.timeStamp() == dt2.timeStamp());
// TC1 for Date
Date d;
std::string dstring = d.asString();
Date d2 = convert<const string&, Date>(dstring);
assert(d.timeStamp() == d2.timeStamp());
// TC1 for Time
Time t;
std::string tstring = t.asString();
Time t2 = convert<const string&, Time>(tstring);
assert(t.secs() == t2.secs());
return 0;
}
| 19.195652 | 61 | 0.629672 | cshnick |
a6e422508141ebac8748f387c343b07046835c8b | 18 | cpp | C++ | Gear/src/grpch.cpp | GearEngine/GearEngine | fa5ed49ca6289a215799a7b84ece1241eb33bd36 | [
"Apache-2.0"
] | 3 | 2020-03-05T06:56:51.000Z | 2020-03-12T09:36:20.000Z | Gear/src/grpch.cpp | GearEngine/GearEngine | fa5ed49ca6289a215799a7b84ece1241eb33bd36 | [
"Apache-2.0"
] | 2 | 2020-03-05T15:40:28.000Z | 2020-03-11T16:04:44.000Z | Gear/src/grpch.cpp | GearEngine/GearEngine | fa5ed49ca6289a215799a7b84ece1241eb33bd36 | [
"Apache-2.0"
] | null | null | null | #include "grpch.h" | 18 | 18 | 0.722222 | GearEngine |
a6ec95078cdd6a6eb6ffdf181bf90086478bbe17 | 1,146 | cpp | C++ | src/searchparameters.cpp | nemishkor/harbour-otpusk | 225fa040426a654249ba45e33efe3f169911fc14 | [
"MIT"
] | null | null | null | src/searchparameters.cpp | nemishkor/harbour-otpusk | 225fa040426a654249ba45e33efe3f169911fc14 | [
"MIT"
] | null | null | null | src/searchparameters.cpp | nemishkor/harbour-otpusk | 225fa040426a654249ba45e33efe3f169911fc14 | [
"MIT"
] | null | null | null | #include "searchparameters.h"
SearchParameters::SearchParameters(QObject *parent) : QObject(parent)
{
}
int SearchParameters::getLocationId() const
{
return locationId;
}
int SearchParameters::getFromCityId() const
{
return fromCityId;
}
QString SearchParameters::getStartDate() const
{
return startDate;
}
QString SearchParameters::getEndDate() const
{
return endDate;
}
int SearchParameters::getLength() const
{
return length;
}
int SearchParameters::getAdults() const
{
return adults;
}
QStringList SearchParameters::getChildren() const
{
return children;
}
void SearchParameters::setLocationId(int value)
{
locationId = value;
}
void SearchParameters::setFromCityId(int value)
{
fromCityId = value;
}
void SearchParameters::setStartDate(const QString &value)
{
startDate = value;
}
void SearchParameters::setEndDate(const QString &value)
{
endDate = value;
}
void SearchParameters::setLength(int value)
{
length = value;
}
void SearchParameters::setAdults(int value)
{
adults = value;
}
void SearchParameters::setChildren(const QStringList &value)
{
children = value;
}
| 14.883117 | 69 | 0.729494 | nemishkor |
a6f04893187e9082b96f40c22f27ab7029a6b0e5 | 5,081 | hpp | C++ | sampml/sampml/random_forest.hpp | YashasSamaga/sampml | dc84110b53b120caeeb4c0234fcfd6ab16793c59 | [
"MIT"
] | 12 | 2018-12-01T18:30:32.000Z | 2021-12-08T21:53:36.000Z | sampml/sampml/random_forest.hpp | YashasSamaga/sampml | dc84110b53b120caeeb4c0234fcfd6ab16793c59 | [
"MIT"
] | 2 | 2019-08-21T17:52:59.000Z | 2022-01-17T03:28:11.000Z | sampml/sampml/random_forest.hpp | YashasSamaga/sampml | dc84110b53b120caeeb4c0234fcfd6ab16793c59 | [
"MIT"
] | 3 | 2020-09-04T14:53:46.000Z | 2022-03-18T17:53:33.000Z | #include <cassert>
#include <dlib/random_forest.h>
#include <dlib/global_optimization.h>
#include "common.hpp"
#include "data.hpp"
namespace SAMPML_NAMESPACE {
namespace trainer {
template <class sample_type>
class random_forest {
public:
random_forest() { }
template <class SamplesContainer, class LabelsContainer>
void set_samples(const SamplesContainer& _samples, const LabelsContainer& _labels) {
samples.clear();
samples.insert(samples.end(), _samples.cbegin(), _samples.cend());
labels.clear();
labels.insert(labels.end(), _labels.end(), _labels.size());
}
template <class SamplesContainer>
void set_samples(const SamplesContainer& positives, const SamplesContainer& negatives) {
static_assert(std::is_same<typename SamplesContainer::value_type, sample_type>());
samples.clear();
samples.insert(samples.end(), positives.cbegin(), positives.cend());
samples.insert(samples.end(), negatives.cbegin(), negatives.cend());
labels.clear();
labels.insert(labels.end(), positives.size(), 1.0);
labels.insert(labels.end(), negatives.size(), 0.0);
}
void cross_validate(double min_trees = 10, double max_trees = 1000,
double min_frac = 0.9, double max_frac = 1.0,
double min_min_per_leaf = 5, double max_min_per_leaf = 50,
int folds = 10,
int max_function_calls = 50) {
if(samples.size() == 0) {
throw bad_input("Bad Input: no samples were provided for training");
}
assert(labels.size() == samples.size());
dlib::vector_normalizer<sample_type> normalizer;
normalizer.train(samples);
for(auto& vector : samples)
vector = normalizer(vector);
dlib::randomize_samples(samples, labels);
auto cross_validation_score =
[this, folds](int trees, double subsample_frac, int min_sampels_per_leaf) {
dlib::random_forest_regression_trainer<dlib::dense_feature_extractor> trainer;
trainer.set_num_trees(trees);
trainer.set_feature_subsampling_fraction(subsample_frac);
trainer.set_min_samples_per_leaf(min_sampels_per_leaf);
dlib::matrix<double> result = dlib::cross_validate_regression_trainer(trainer, this->samples, this->labels, folds);
std::cout << "trees: " << trees << ", cross validation accuracy: " << result << '\n';
return result(0);
};
auto result = dlib::find_min_global(dlib::default_thread_pool(),
cross_validation_score,
{min_trees, min_frac, min_min_per_leaf},
{max_trees, max_frac, max_min_per_leaf},
dlib::max_function_calls(max_function_calls));
best_num_trees = result.x(0);
best_subsample_fraction = result.x(1);
best_min_samples_per_leaf = result.x(2);
std::cout << result.x << '\n';
}
void train () {
dlib::random_forest_regression_trainer<feature_extractor_type> trainer;
trainer.set_num_trees(best_num_trees);
trainer.set_feature_subsampling_fraction(best_subsample_fraction);
trainer.set_min_samples_per_leaf(best_min_samples_per_leaf);
classifier = trainer.train(samples, labels, oobs);
}
void serialize(std::string classifier) {
dlib::serialize(classifier) << this->classifier;
}
void deserialize(std::string classifier) {
dlib::deserialize(classifier) >> this->classifier;
}
double test(const sample_type& sample) {
return classifier(sample);
}
protected:
std::vector<dlib::matrix<double, 0, 1>> samples;
std::vector<double> labels;
std::vector<double> oobs;
using feature_extractor_type = dlib::dense_feature_extractor;
using decision_funct_type = dlib::random_forest_regression_function<feature_extractor_type>;
//using normalized_decision_funct_type = dlib::normalized_function<decision_funct_type>;
decision_funct_type classifier;
double best_num_trees = 100;
double best_subsample_fraction = 0.25;
double best_min_samples_per_leaf = 5;
};
}
} | 44.570175 | 135 | 0.550679 | YashasSamaga |
a6fd4b0c75385f0cde9941adcae2168cdf874e04 | 1,225 | cpp | C++ | source/tools/editor/dropzonebrush.cpp | mechasource/mechcommander2 | b2c7cecf001cec1f535aa8d29c31bdc30d9aa983 | [
"BSD-2-Clause"
] | 38 | 2015-04-10T13:31:03.000Z | 2021-09-03T22:34:05.000Z | source/tools/editor/dropzonebrush.cpp | mechasource/mechcommander2 | b2c7cecf001cec1f535aa8d29c31bdc30d9aa983 | [
"BSD-2-Clause"
] | 1 | 2020-07-09T09:48:44.000Z | 2020-07-12T12:41:43.000Z | source/tools/editor/dropzonebrush.cpp | mechasource/mechcommander2 | b2c7cecf001cec1f535aa8d29c31bdc30d9aa983 | [
"BSD-2-Clause"
] | 12 | 2015-06-29T08:06:57.000Z | 2021-10-13T13:11:41.000Z | /*************************************************************************************************\
dropZoneBrush.cpp : Implementation of the dropZoneBrush component.
//---------------------------------------------------------------------------//
// Copyright (C) Microsoft Corporation. All rights reserved. //
//===========================================================================//
\*************************************************************************************************/
// #define DROPZONEBRUSH_CPP
#include "stdinc.h"
//#include "editorobjectmgr.h"
#include "dropZoneBrush.h"
DropZoneBrush::DropZoneBrush(int32_t align, bool bVtol)
{
alignment = align;
bVTol = bVtol;
}
bool
DropZoneBrush::paint(Stuff::Vector3D& worldPos, int32_t screenX, int32_t screenY)
{
EditorObject* pInfo = EditorObjectMgr::instance()->addDropZone(worldPos, alignment, bVTol);
if (pInfo && pAction)
{
pAction->addBuildingInfo(*pInfo);
return true;
}
return false;
}
bool
DropZoneBrush::canPaint(
Stuff::Vector3D& worldPos, int32_t screenX, int32_t screenY, int32_t flags)
{
return EditorObjectMgr::instance()->canAddDropZone(worldPos, alignment, bVTol);
}
// end of file ( dropZoneBrush.cpp )
| 31.410256 | 99 | 0.520816 | mechasource |
470d54522a5ff339dddad5538a5beacd850ebd07 | 1,552 | cpp | C++ | graphDataStructuresAndAlgorithms/wordLatterII.cpp | archit-1997/InterviewB | 6f5655ce0c9c8dd1b2433588f47da5aa7f5860d7 | [
"MIT"
] | 1 | 2021-01-27T16:37:38.000Z | 2021-01-27T16:37:38.000Z | graphDataStructuresAndAlgorithms/wordLatterII.cpp | archit-1997/InterviewBit | 6f5655ce0c9c8dd1b2433588f47da5aa7f5860d7 | [
"MIT"
] | null | null | null | graphDataStructuresAndAlgorithms/wordLatterII.cpp | archit-1997/InterviewBit | 6f5655ce0c9c8dd1b2433588f47da5aa7f5860d7 | [
"MIT"
] | null | null | null | vector<vector<string>> res;
int nd, minL;
string en;
bool isAdj(string a, string b) {
int n = a.length();
int cnt = 0;
for (int i = 0; i < n; i++) {
if (a[i] != b[i])
cnt++;
if (cnt > 1)
return false;
}
return cnt == 1 ? true : false;
}
void dfs(vector<string> &dict, vector<string> &temp, bool vis[], int len) {
if (len > minL)
return;
if (temp[len - 1] == en) {
if (minL > len) {
minL = len;
res.clear();
}
res.push_back(temp);
return;
}
string s = temp[len - 1];
for (int i = 0; i < nd; i++) {
if (vis[i] == false && isAdj(s, dict[i])) {
vis[i] = true;
temp.push_back(dict[i]);
dfs(dict, temp, vis, len + 1);
temp.pop_back();
vis[i] = false;
}
}
}
vector<vector<string>> Solution::findLadders(string start, string end,
vector<string> &dict) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for
// more details
res.clear();
dict.push_back(end);
unordered_set<string> st;
for (auto x : dict)
st.insert(x);
dict.assign(st.begin(), st.end());
sort(dict.begin(), dict.end());
nd = dict.size();
minL = INT_MAX;
en = end;
vector<string> temp;
bool vis[nd];
memset(vis, false, sizeof(vis));
temp.push_back(start);
dfs(dict, temp, vis, 1);
return res;
}
| 20.155844 | 78 | 0.556057 | archit-1997 |
470d83ac1637399f02fd02afdf04312d546e0273 | 12,015 | cc | C++ | src/jtocconversion.cc | yamii/node-bacnet | bfe63ff626d7bb02bebfefd301307952fcbd4ee0 | [
"MIT"
] | null | null | null | src/jtocconversion.cc | yamii/node-bacnet | bfe63ff626d7bb02bebfefd301307952fcbd4ee0 | [
"MIT"
] | null | null | null | src/jtocconversion.cc | yamii/node-bacnet | bfe63ff626d7bb02bebfefd301307952fcbd4ee0 | [
"MIT"
] | null | null | null | #include <iostream>
#include <v8.h>
#include <node.h>
#include <nan.h>
#include "address.h"
#include "datalink.h"
#include "bacapp.h"
#include "bactext.h"
using v8::Local;
using v8::Value;
using v8::Object;
using v8::Int32;
using v8::Uint32;
using v8::String;
using Nan::MaybeLocal;
using Nan::New;
uint32_t getUint32Default(Local<Object> target, std::string key, uint32_t defalt) {
Local<String> lkey = New(key).ToLocalChecked();
Local<Value> ldefault = New(defalt);
Local<Value> lvalue = Nan::Get(target, lkey).FromMaybe(ldefault);
return lvalue->ToUint32()->Value();
}
std::string extractString(Local<String> jsString) {
Nan::Utf8String lstring(jsString);
return *lstring;
}
std::string getStringOrEmpty(Local<Object> target, std::string key) {
Local<String> lkey = New(key).ToLocalChecked();
MaybeLocal<Value> mvalue = Nan::Get(target, lkey);
if (mvalue.IsEmpty() || mvalue.ToLocalChecked()->IsUndefined()) {
return "";
} else {
return extractString(mvalue.ToLocalChecked()->ToString());
}
}
// Currently converts an address string ie '123.123.123.123:456' to a bacnet address
// Non-strings create the broadcast address
// TODO : accept objects which specify the additional address properties - for which partial logic exists below
BACNET_ADDRESS bacnetAddressToC(Local<Value> addressValue) {
BACNET_ADDRESS dest = {};
if (addressValue->IsString()) { // address object parameter
BACNET_MAC_ADDRESS mac = {};
BACNET_MAC_ADDRESS adr = {};
long dnet = -1;
Nan::Utf8String address(addressValue.As<v8::String>());
address_mac_from_ascii(&mac, *address);
// if (strcmp(argv[argi], "--dnet") == 0) {
// if (++argi < argc) {
// dnet = strtol(argv[argi], NULL, 0);
// if ((dnet >= 0) && (dnet <= BACNET_BROADCAST_NETWORK)) {
// global_broadcast = false;
// }
// }
// }
// if (strcmp(argv[argi], "--dadr") == 0) {
// if (++argi < argc) {
// if (address_mac_from_ascii(&adr, argv[argi])) {
// global_broadcast = false;
// }
// }
// }
if (adr.len && mac.len) {
memcpy(&dest.mac[0], &mac.adr[0], mac.len);
dest.mac_len = mac.len;
memcpy(&dest.adr[0], &adr.adr[0], adr.len);
dest.len = adr.len;
if ((dnet >= 0) && (dnet <= BACNET_BROADCAST_NETWORK)) {
dest.net = dnet;
} else {
dest.net = BACNET_BROADCAST_NETWORK;
}
} else if (mac.len) {
memcpy(&dest.mac[0], &mac.adr[0], mac.len);
dest.mac_len = mac.len;
dest.len = 0;
if ((dnet >= 0) && (dnet <= BACNET_BROADCAST_NETWORK)) {
dest.net = dnet;
} else {
dest.net = 0;
}
} else {
if ((dnet >= 0) && (dnet <= BACNET_BROADCAST_NETWORK)) {
dest.net = dnet;
} else {
dest.net = BACNET_BROADCAST_NETWORK;
}
dest.mac_len = 0;
dest.len = 0;
}
} else {
datalink_get_broadcast_address(&dest);
}
return dest;
}
// For enums we'll need to know the context - ie properties and stuff
// This shouldn't be called for arrays as we dont know whether the return value is an array
uint8_t inferBacnetType(Local<Value> jvalue) {
if (jvalue->IsNull()) {
return BACNET_APPLICATION_TAG_NULL;
} else if (jvalue->IsBoolean()) {
return BACNET_APPLICATION_TAG_BOOLEAN;
} else if (jvalue->IsString()) {
return BACNET_APPLICATION_TAG_CHARACTER_STRING;
} else if (node::Buffer::HasInstance(jvalue)) {
return BACNET_APPLICATION_TAG_OCTET_STRING;
} else if (jvalue->IsUint32()) { // the 4 number domains have overlap, for this inference we're using unsigned int, signed int, double as the precedence
return BACNET_APPLICATION_TAG_UNSIGNED_INT;
} else if (jvalue->IsInt32()) {
return BACNET_APPLICATION_TAG_SIGNED_INT;
} else if (jvalue->IsNumber()) {
return BACNET_APPLICATION_TAG_REAL; // With my test device a double was an invalid type - it seems that real is more common
} else if (jvalue->IsObject()) {
Local<Object> jobject = jvalue->ToObject();
if (Nan::Has(jobject, Nan::New("year").ToLocalChecked()).FromMaybe(false)) {
return BACNET_APPLICATION_TAG_DATE;
} else if (Nan::Has(jobject, Nan::New("hour").ToLocalChecked()).FromMaybe(false)) {
return BACNET_APPLICATION_TAG_TIME;
} else if (Nan::Has(jobject, Nan::New("instance").ToLocalChecked()).FromMaybe(false)) {
return BACNET_APPLICATION_TAG_OBJECT_ID;
} else {
return 255; // Error : unsupported object type (array, object, ...)
}
} else {
return 255; // Error : unsupported primitive (symbol, ...)
}
}
int bacnetOctetStringToC(BACNET_OCTET_STRING * cvalue, Local<Value> jvalue) {
Local<Object> bjvalue = Nan::To<Object>(jvalue).ToLocalChecked();
size_t bufferLength = node::Buffer::Length(bjvalue);
if (bufferLength < MAX_OCTET_STRING_BYTES) {
cvalue->length = bufferLength;
memcpy(node::Buffer::Data(bjvalue), cvalue->value, bufferLength);
return 0;
} else {
return 2; // Error: Too large
}
}
int bacnetCharacterStringToC(BACNET_CHARACTER_STRING * cvalue, Local<Value> jvalue) {
Local<String> sjvalue = Nan::To<String>(jvalue).ToLocalChecked();
if (sjvalue->Utf8Length() < MAX_CHARACTER_STRING_BYTES) {
cvalue->length = sjvalue->Utf8Length();
cvalue->encoding = CHARACTER_UTF8;
sjvalue->WriteUtf8(cvalue->value);
return 0;
} else {
return 2; // Error: Too large
}
}
int bacnetBitStringToC(BACNET_BIT_STRING * cvalue, Local<Value> jvalue) {
Local<Object> bjvalue = Nan::To<Object>(jvalue).ToLocalChecked();
size_t bufferLength = node::Buffer::Length(bjvalue);
if (bufferLength < MAX_BITSTRING_BYTES) {
cvalue->bits_used = bufferLength * 8;
memcpy(node::Buffer::Data(bjvalue), cvalue->value, bufferLength);
return 0;
} else {
return 2; // Error: Too large
}
}
int bacnetDateToC(BACNET_DATE * cvalue, Local<Value> jvalue) {
Local<Object> jobject = Nan::To<Object>(jvalue).ToLocalChecked();
cvalue->year = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("year").ToLocalChecked()).ToLocalChecked()).FromJust();
cvalue->month = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("month").ToLocalChecked()).ToLocalChecked()).FromJust();
cvalue->day = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("day").ToLocalChecked()).ToLocalChecked()).FromJust();
std::string weekdaystring = getStringOrEmpty(jobject, "weekday");
unsigned int wday;
if (bactext_days_of_week_index(weekdaystring.c_str(), &wday)) {
cvalue->wday = wday + 1; // BACnet has 2 different enumeration schemes for weekdays, oe starting Monday=1 - that's the one we use
return 0;
} else {
return 3;
}
}
int bacnetTimeToC(BACNET_TIME * cvalue, Local<Value> jvalue) {
Local<Object> jobject = Nan::To<Object>(jvalue).ToLocalChecked();
cvalue->hour = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("hour").ToLocalChecked()).ToLocalChecked()).FromJust();
cvalue->min = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("min").ToLocalChecked()).ToLocalChecked()).FromJust();
cvalue->sec = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("sec").ToLocalChecked()).ToLocalChecked()).FromJust();
cvalue->hundredths = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("hundredths").ToLocalChecked()).ToLocalChecked()).FromJust();
return 0;
}
int bacnetObjectHandleToC(BACNET_OBJECT_ID * cvalue, Local<Value> jvalue) {
Local<Object> jobject = Nan::To<Object>(jvalue).ToLocalChecked();
std::string objectTypeName = getStringOrEmpty(jobject, "type");
unsigned objectTypeIndex;
if (bactext_object_type_index(objectTypeName.c_str(), &objectTypeIndex)) {
cvalue->type = objectTypeIndex;
cvalue->instance = Nan::To<uint32_t>(Nan::Get(jobject, Nan::New("instance").ToLocalChecked()).ToLocalChecked()).FromJust();
return 0;
} else {
return 3;
}
}
// For enums we'll need to know the context - ie properties and stuff
// This shouldn't be called for arrays as we dont know whether the return value is an array
// TODO check types etc
int bacnetAppValueToC(BACNET_APPLICATION_DATA_VALUE * cvalue, Local<Value> jvalue, BACNET_APPLICATION_TAG tag) {
cvalue->context_specific = false;
cvalue->context_tag = 0;
cvalue->next = 0;
cvalue->tag = tag;
switch (tag) {
case BACNET_APPLICATION_TAG_NULL:
return 0;
case BACNET_APPLICATION_TAG_BOOLEAN:
cvalue->type.Boolean = Nan::To<bool>(jvalue).FromJust();
return 0;
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
cvalue->type.Unsigned_Int = Nan::To<uint32_t>(jvalue).FromJust();
return 0;
case BACNET_APPLICATION_TAG_SIGNED_INT:
cvalue->type.Signed_Int = Nan::To<int32_t>(jvalue).FromJust();
return 0;
case BACNET_APPLICATION_TAG_REAL:
cvalue->type.Real = Nan::To<double>(jvalue).FromJust();
return 0;
case BACNET_APPLICATION_TAG_DOUBLE:
cvalue->type.Double = Nan::To<double>(jvalue).FromJust();
return 0;
case BACNET_APPLICATION_TAG_OCTET_STRING:
return bacnetOctetStringToC(&cvalue->type.Octet_String, jvalue);
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
return bacnetCharacterStringToC(&cvalue->type.Character_String, jvalue);
case BACNET_APPLICATION_TAG_BIT_STRING:
return bacnetBitStringToC(&cvalue->type.Bit_String, jvalue);
case BACNET_APPLICATION_TAG_ENUMERATED:
cvalue->type.Enumerated = Nan::To<uint32_t>(jvalue).FromJust(); // without the context of the property id the enumeration value is just a number
return 0;
case BACNET_APPLICATION_TAG_DATE:
return bacnetDateToC(&cvalue->type.Date, jvalue);
case BACNET_APPLICATION_TAG_TIME:
return bacnetTimeToC(&cvalue->type.Time, jvalue);
case BACNET_APPLICATION_TAG_OBJECT_ID:
return bacnetObjectHandleToC(&cvalue->type.Object_Id, jvalue);
default:
std::cout << "ERROR: value tag (" << +cvalue->tag << ") not converted to js '" << bactext_application_tag_name(cvalue->tag) << "'" << std::endl;
return 1;
}
}
// converts a value representing a bacnet object type to its enum value
const char * objectTypeToC(Local<Value> type, unsigned * index) {
if (type->IsString()) {
if (bactext_object_type_index(extractString(type.As<v8::String>()).c_str(), index)) {
return 0;
} else {
return "Object type string not valid";
}
} else if (type->IsUint32()) {
const char * name = bactext_object_type_name(type->ToUint32()->Value());
bactext_object_type_index(name, index);
return 0;
} else {
return "Object type must be either a string or unsigned int";
}
}
// TODO : provide enums
// converts a value representing a bacnet value application tag to its enum value
// returns zero on success or an error string
const char * applicationTagToC(Local<Value> type, unsigned * index) {
if (type->IsString()) {
if (bactext_application_tag_index(extractString(type.As<v8::String>()).c_str(), index)) {
return 0;
} else {
return "Application tag string not valid";
}
} else if (type->IsUint32()) {
const char * name = bactext_application_tag_name(type->ToUint32()->Value());
bactext_application_tag_index(name, index);
return 0;
} else {
return "Application tag must be either a string or unsigned int";
}
}
| 41.006826 | 163 | 0.635456 | yamii |
470ecca09a38e5e9808703253e7803ea0723bee0 | 2,424 | cpp | C++ | picam/libs/client/src/picam_client.cpp | avribacki/neato-pi | dd415f0f6ab82492468fedcafc85f18277fc7c06 | [
"MIT"
] | null | null | null | picam/libs/client/src/picam_client.cpp | avribacki/neato-pi | dd415f0f6ab82492468fedcafc85f18277fc7c06 | [
"MIT"
] | null | null | null | picam/libs/client/src/picam_client.cpp | avribacki/neato-pi | dd415f0f6ab82492468fedcafc85f18277fc7c06 | [
"MIT"
] | null | null | null | #include "picam_api.h"
#include "jaw_client.hpp"
#include "picam_protocol.hpp"
using namespace Jaw;
using namespace PiCam;
/*************************************************************************************************/
using PiCamClient = Client<Command>;
/*************************************************************************************************/
// Maybe we want different times for each operation?
static std::chrono::seconds kTimeout = std::chrono::seconds(3);
/*************************************************************************************************/
int picam_create(picam_camera_t* camera, const picam_config_t* config, const char* address)
{
if (!config) {
return static_cast<int>(std::errc::invalid_argument);
}
return PiCamClient::create(camera, Command::CREATE, kTimeout, address, std::forward_as_tuple(*config));
}
/*************************************************************************************************/
int picam_destroy(picam_camera_t camera)
{
return PiCamClient::destroy(camera, Command::DESTROY, kTimeout);
}
/*************************************************************************************************/
int picam_callback_set(picam_camera_t camera, void *user_data, picam_callback_t callback)
{
return PiCamClient::set_callback(camera, Command::CALLBACK_SET, kTimeout,
[user_data, callback](InputBuffer message) {
picam_image_t image;
read(message, image);
callback(user_data, &image);
});
}
/*************************************************************************************************/
int picam_params_get(picam_camera_t camera, picam_params_t *params)
{
if (!params) {
return static_cast<int>(std::errc::invalid_argument);
}
return PiCamClient::request(camera, Command::PARAMETERS_GET, kTimeout, *params);
}
/*************************************************************************************************/
int picam_params_set(picam_camera_t camera, picam_params_t* params)
{
if (!params) {
return static_cast<int>(std::errc::invalid_argument);
}
return PiCamClient::request(camera, Command::PARAMETERS_SET, kTimeout, std::forward_as_tuple(*params));
}
/*************************************************************************************************/
| 35.130435 | 108 | 0.458333 | avribacki |
4711bc5b49380ac67c4d616b955618c7147dc312 | 14,992 | cpp | C++ | devtools/lit/lib/ProgressBar.cpp | PHP-OPEN-HUB/polarphp | 70ff4046e280fd99d718d4761686168fa8012aa5 | [
"PHP-3.01"
] | null | null | null | devtools/lit/lib/ProgressBar.cpp | PHP-OPEN-HUB/polarphp | 70ff4046e280fd99d718d4761686168fa8012aa5 | [
"PHP-3.01"
] | null | null | null | devtools/lit/lib/ProgressBar.cpp | PHP-OPEN-HUB/polarphp | 70ff4046e280fd99d718d4761686168fa8012aa5 | [
"PHP-3.01"
] | null | null | null | // This source file is part of the polarphp.org open source project
//
// Copyright (c) 2017 - 2019 polarphp software foundation
// Copyright (c) 2017 - 2019 zzu_softboy <[email protected]>
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://polarphp.org/LICENSE.txt for license information
// See https://polarphp.org/CONTRIBUTORS.txt for the list of polarphp project authors
//
// Created by polarboy on 2018/09/17.
#include "ProgressBar.h"
#include "LitGlobal.h"
#include "Utils.h"
#include "CLI/CLI.hpp"
#include "polarphp/basic/adt/StringRef.h"
#include <assert.h>
#include <boost/regex.hpp>
#include <ncurses.h>
namespace polar {
namespace lit {
const std::string TerminalController::BOL{"BOL"};
const std::string TerminalController::UP{"UP"};
const std::string TerminalController::DOWN{"DOWN"};
const std::string TerminalController::LEFT{"LEFT"};
const std::string TerminalController::RIGHT{"RIGHT"};
const std::string TerminalController::CLEAR_SCREEN{"CLEAR_SCREEN"};
const std::string TerminalController::CLEAR_EOL{"CLEAR_EOL"};
const std::string TerminalController::CLEAR_BOL{"CLEAR_BOL"};
const std::string TerminalController::CLEAR_EOS{"CLEAR_EOS"};
const std::string TerminalController::BOLD{"BOLD"};
const std::string TerminalController::BLINK{"BLINK"};
const std::string TerminalController::DIM{"DIM"};
const std::string TerminalController::REVERSE{"REVERSE"};
const std::string TerminalController::NORMAL{"NORMAL"};
const std::string TerminalController::HIDE_CURSOR{"HIDE_CURSOR"};
const std::string TerminalController::SHOW_CURSOR{"SHOW_CURSOR"};
int TerminalController::COLUMNS = -1;
int TerminalController::LINE_COUNT = -1;
bool TerminalController::XN = false;
std::list<std::string> TerminalController::STRING_CAPABILITIES {
"BOL=cr",
"UP=cuu1",
"DOWN=cud1",
"LEFT=cub1",
"RIGHT=cuf1",
"CLEAR_SCREEN=clear",
"CLEAR_EOL=el",
"CLEAR_BOL=el1",
"CLEAR_EOS=ed",
"BOLD=bold",
"BLINK=blink",
"DIM=dim",
"REVERSE=rev",
"UNDERLINE=smul",
"NORMAL=sgr0",
"HIDE_CURSOR=cinvis",
"SHOW_CURSOR=cnorm"
};
std::list<std::string> TerminalController::COLOR_TYPES {
"BLACK",
"BLUE",
"GREEN",
"CYAN",
"RED",
"MAGENTA",
"YELLOW",
"WHITE"
};
std::list<std::string> TerminalController::ANSICOLORS {
"BLACK",
"RED",
"GREEN",
"YELLOW",
"BLUE",
"MAGENTA",
"CYAN",
"WHITE"
};
namespace {
class CursesWinUnlocker
{
public:
CursesWinUnlocker(bool needUnlock)
: m_needUnlock(needUnlock)
{
}
~CursesWinUnlocker()
{
if (m_needUnlock) {
::endwin();
}
}
protected:
bool m_needUnlock;
};
}
/// Create a `TerminalController` and initialize its attributes
/// with appropriate values for the current terminal.
/// `term_stream` is the stream that will be used for terminal
/// output; if this stream is not a tty, then the terminal is
/// assumed to be a dumb terminal (i.e., have no capabilities).
///
TerminalController::TerminalController(std::ostream &)
: m_initialized(false)
{
// If the stream isn't a tty, then assume it has no capabilities.
if (!stdcout_isatty()) {
throw std::runtime_error("stdcout is not a tty device");
}
initTermScreen();
CursesWinUnlocker winLocker(true);
// Check the terminal type. If we fail, then assume that the
// terminal has no capabilities.
// Look up numeric capabilities.
COLUMNS = ::tigetnum(const_cast<char *>("cols"));
LINE_COUNT = ::tigetnum(const_cast<char *>("lines"));
XN = ::tigetflag(const_cast<char *>("xenl"));
// Look up string capabilities.
for (std::string capability : STRING_CAPABILITIES) {
std::list<std::string> parts = split_string(capability, '=');
assert(parts.size() == 2);
std::list<std::string>::iterator iter = parts.begin();
std::string attribute = *iter++;
std::string capName = *iter++;
m_properties[attribute] = tigetStr(capName);
}
// init Colors
std::string setFg = tigetStr("setf");
if (!setFg.empty()) {
auto iter = COLOR_TYPES.begin();
int index = 0;
for (; iter != COLOR_TYPES.end(); ++iter, ++index) {
m_properties[*iter] = tparm(setFg, index);
}
}
std::string setAnsiFg = tigetStr("setaf");
if (!setAnsiFg.empty()) {
auto iter = ANSICOLORS.begin();
int index = 0;
for (; iter != ANSICOLORS.end(); ++iter, ++index) {
m_properties[*iter] = tparm(setAnsiFg, index);
}
}
std::string setBg = tigetStr("setb");
if (!setBg.empty()) {
auto iter = COLOR_TYPES.begin();
int index = 0;
for (; iter != COLOR_TYPES.end(); ++iter, ++index) {
m_properties[*iter] = tparm(setFg, index);
}
}
std::string setAnsiBg = tigetStr("setab");
if (!setAnsiBg.empty()) {
auto iter = ANSICOLORS.begin();
int index = 0;
for (; iter != ANSICOLORS.end(); ++iter, ++index) {
m_properties[*iter] = tparm(setAnsiFg, index);
}
}
}
TerminalController::~TerminalController()
{
}
std::string TerminalController::tigetStr(const std::string &capName)
{
// String capabilities can include "delays" of the form "$<2>".
// For any modern terminal, we should be able to just ignore
// these, so strip them out.
char *str = ::tigetstr(const_cast<char *>(capName.c_str()));
std::string cap;
if (str != nullptr && str != reinterpret_cast<char *>(-1)) {
cap = str;
}
if (!cap.empty()) {
boost::regex regex("$<\\d+>[/*]?");
cap = boost::regex_replace(cap, regex, "");
}
return cap;
}
std::string TerminalController::tparm(const std::string &arg, int index)
{
char *str = ::tparm(const_cast<char *>(arg.c_str()), index);
if (str == nullptr || str == reinterpret_cast<char *>(-1)) {
return std::string{};
}
return str;
}
void TerminalController::initTermScreen()
{
std::lock_guard locker(m_mutex);
NCURSES_CONST char *name;
if ((name = getenv("TERM")) == nullptr
|| *name == '\0')
name = const_cast<char *>("unknown");
#ifdef __CYGWIN__
/*
* 2002/9/21
* Work around a bug in Cygwin. Full-screen subprocesses run from
* bash, in turn spawned from another full-screen process, will dump
* core when attempting to write to stdout. Opening /dev/tty
* explicitly seems to fix the problem.
*/
if (isatty(fileno(stdout))) {
FILE *fp = fopen("/dev/tty", "w");
if (fp != 0 && isatty(fileno(fp))) {
fclose(stdout);
dup2(fileno(fp), STDOUT_FILENO);
stdout = fdopen(STDOUT_FILENO, "w");
}
}
#endif
if (newterm(name, stdout, stdin) == nullptr) {
throw std::runtime_error(format_string("Error opening terminal: %s.\n", name));
}
/* def_shell_mode - done in newterm/_nc_setupscreen */
def_prog_mode();
}
///
/// Replace each $-substitutions in the given template string with
/// the corresponding terminal control string (if it's defined) or
/// '' (if it's not).
///
std::string TerminalController::render(std::string tpl) const
{
boost::regex regex(R"(\$\{(\w+)\})");
boost::smatch varMatch;
while(boost::regex_search(tpl, varMatch, regex)) {
std::string varname = varMatch[1];
if (m_properties.find(varname) != m_properties.end()) {
tpl.replace(varMatch[0].first, varMatch[0].second, m_properties.at(varname));
}
}
return tpl;
}
const std::string &TerminalController::getProperty(const std::string &key) const
{
return m_properties.at(key);
}
SimpleProgressBar::SimpleProgressBar(const std::string &header)
: m_header(header),
m_atIndex(-1)
{
}
void SimpleProgressBar::update(float percent, std::string message)
{
if (m_atIndex == -1) {
std::printf("%s\n", m_header.c_str());
m_atIndex = 0;
}
int next = static_cast<int>(percent * 50);
if (next == m_atIndex) {
return;
}
for (int i = m_atIndex; i < next; ++i) {
int idx = i % 5;
if (0 == idx) {
std::printf("%-2d", i * 2);
} else if (1 == idx) {
// skip
} else if (idx < 4) {
std::printf(".");
} else {
std::printf(" ");
}
}
std::fflush(stdout);
m_atIndex = next;
}
void SimpleProgressBar::clear()
{
if (m_atIndex != -1) {
std::cout << std::endl;
std::cout.flush();
m_atIndex = -1;
}
}
const std::string ProgressBar::BAR ="%s${GREEN}[${BOLD}%s%s${NORMAL}${GREEN}]${NORMAL}%s";
const std::string ProgressBar::HEADER = "${BOLD}${CYAN}%s${NORMAL}\n\n";
ProgressBar::ProgressBar(const TerminalController &term, const std::string &header,
bool useETA)
: BOL(term.getProperty(TerminalController::BOL)),
XNL("\n"),
m_term(term),
m_header(header),
m_cleared(true),
m_useETA(useETA)
{
if (m_term.getProperty(TerminalController::CLEAR_EOL).empty() ||
m_term.getProperty(TerminalController::UP).empty() ||
m_term.getProperty(TerminalController::BOL).empty()) {
throw ValueError("Terminal isn't capable enough -- you "
"should use a simpler progress dispaly.");
}
if (m_term.COLUMNS != -1) {
m_width = static_cast<size_t>(m_term.COLUMNS);
if (!m_term.XN) {
BOL = m_term.getProperty(TerminalController::UP) + m_term.getProperty(TerminalController::BOL);
XNL = ""; // Cursor must be fed to the next line
}
} else {
m_width = 75;
}
m_bar = m_term.render(BAR);
if (m_useETA) {
m_startTime = std::chrono::system_clock::now();
}
}
void ProgressBar::update(float percent, std::string message)
{
if (m_cleared) {
std::printf("%s\n", m_header.c_str());
m_cleared = false;
}
std::string prefix = format_string("%3d%%", static_cast<int>(percent * 100));
std::string suffix = "";
if (m_useETA) {
auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - m_startTime).count();
if (percent > 0.0001f && elapsed > 1) {
int total = static_cast<int>(elapsed / percent);
int eta = int(total - elapsed);
int h = eta / 3600;
int m = (eta / 60) % 60;
int s = eta % 60;
suffix = format_string(" ETA: %02d:%02d:%02d", h, m, s);
}
}
size_t barWidth = m_width - prefix.size() - suffix.size() - 2;
size_t n = static_cast<size_t>(barWidth * percent);
if (message.size() < m_width) {
message = message + std::string(m_width - message.size(), ' ');
} else {
message = "... " + message.substr(-(m_width - 4));
}
std::string output = BOL +
m_term.getProperty(TerminalController::CLEAR_EOL);
output += format_string(m_bar, prefix.c_str(), std::string(n, '=').c_str(),
std::string(barWidth - n, '-').c_str(), suffix.c_str());
output += XNL;
output += m_term.getProperty(TerminalController::CLEAR_EOL);
output += message;
std::printf("%s\n", output.c_str());
std::fflush(stdout);
}
void ProgressBar::clear()
{
if (!m_cleared) {
std::printf("%s", (BOL + m_term.getProperty(TerminalController::CLEAR_EOL) +
m_term.getProperty(TerminalController::UP) +
m_term.getProperty(TerminalController::CLEAR_EOL)).c_str());
std::fflush(stdout);
m_cleared = true;
}
}
TestingProgressDisplay::TestingProgressDisplay(const CLI::App &opts, size_t numTests,
std::shared_ptr<AbstractProgressBar> progressBar)
: m_opts(opts),
m_numTests(numTests),
m_progressBar(progressBar),
m_completed(0)
{
m_showAllOutput = m_opts.get_option("--show-all")->count() > 0 ? true : false;
m_incremental = m_opts.get_option("--incremental")->count() > 0 ? true : false;
m_quiet = m_opts.get_option("--quiet")->count() > 0 ? true : false;
m_succinct = m_opts.get_option("--succinct")->count() > 0 ? true : false;
m_showOutput = m_opts.get_option("--verbose")->count() > 0 ? true : false;
}
void TestingProgressDisplay::finish()
{
if (m_progressBar) {
m_progressBar->clear();
} else if (m_quiet) {
// TODO
} else if (m_succinct) {
std::printf("\n");
}
}
void update_incremental_cache(TestPointer test)
{
if (!test->getResult()->getCode()->isFailure()) {
return;
}
polar::lit::modify_file_utime_and_atime(test->getFilePath());
}
void TestingProgressDisplay::update(TestPointer test)
{
m_completed += 1;
if (m_incremental) {
update_incremental_cache(test);
}
if (m_progressBar) {
m_progressBar->update(m_completed / static_cast<float>(m_numTests), test->getFullName());
}
assert(test->getResult()->getCode() && "test result code is not set");
bool shouldShow = test->getResult()->getCode()->isFailure() ||
m_showAllOutput ||
(!m_quiet && !m_succinct);
if (!shouldShow) {
return;
}
if (m_progressBar) {
m_progressBar->clear();
}
// Show the test result line.
std::string testName = test->getFullName();
ResultPointer testResult = test->getResult();
const ResultCode *resultCode = testResult->getCode();
std::printf("%s: %s (%lu of %lu)\n", resultCode->getName().c_str(),
testName.c_str(), m_completed, m_numTests);
// Show the test failure output, if requested.
if ((resultCode->isFailure() && m_showOutput) ||
m_showAllOutput) {
if (resultCode->isFailure()) {
std::printf("%s TEST '%s' FAILED %s\n", std::string(20, '*').c_str(),
test->getFullName().c_str(), std::string(20, '*').c_str());
}
std::cout << testResult->getOutput() << std::endl;
std::cout << std::string(20, '*') << std::endl;
}
// Report test metrics, if present.
if (!testResult->getMetrics().empty()) {
// @TODO sort the metrics
std::printf("%s TEST '%s' RESULTS %s\n", std::string(10, '*').c_str(),
test->getFullName().c_str(),
std::string(10, '*').c_str());
for (auto &item : testResult->getMetrics()) {
std::printf("%s: %s \n", item.first.c_str(), item.second->format().c_str());
}
std::cout << std::string(10, '*') << std::endl;
}
// Report micro-tests, if present
if (!testResult->getMicroResults().empty()) {
// @TODO sort the MicroResults
for (auto &item : testResult->getMicroResults()) {
std::printf("%s MICRO-TEST: %s\n", std::string(3, '*').c_str(), item.first.c_str());
ResultPointer microTest = item.second;
if (!microTest->getMetrics().empty()) {
// @TODO sort the metrics
for (auto µItem : microTest->getMetrics()) {
std::printf(" %s: %s \n", microItem.first.c_str(), microItem.second->format().c_str());
}
}
}
}
// Ensure the output is flushed.
std::fflush(stdout);
}
} // lit
} // polar
| 30.975207 | 126 | 0.614128 | PHP-OPEN-HUB |
471296fa4ba4364588b96efd2791ca2403d838dc | 5,179 | cpp | C++ | src/types/spatial.cpp | vi3itor/Blunted2 | 318af452e51174a3a4634f3fe19b314385838992 | [
"Unlicense"
] | 56 | 2020-07-22T22:11:06.000Z | 2022-03-09T08:11:43.000Z | GameplayFootball/src/types/spatial.cpp | ElsevierSoftwareX/SOFTX-D-20-00016 | 48c28adb72aa167a251636bc92111b3c43c0be67 | [
"MIT"
] | 9 | 2021-04-22T07:06:25.000Z | 2022-01-22T12:54:52.000Z | GameplayFootball/src/types/spatial.cpp | ElsevierSoftwareX/SOFTX-D-20-00016 | 48c28adb72aa167a251636bc92111b3c43c0be67 | [
"MIT"
] | 20 | 2017-11-07T16:52:32.000Z | 2022-01-25T02:42:48.000Z | // written by bastiaan konings schuiling 2008 - 2014
// this work is public domain. the code is undocumented, scruffy, untested, and should generally not be used for anything important.
// i do not offer support, so don't ask. to be used for inspiration :)
#include "spatial.hpp"
namespace blunted {
Spatial::Spatial(const std::string &name) : name(name), parent(0), localMode(e_LocalMode_Relative) {
scale.Set(1, 1, 1);
Vector axis(0, 0, -1);
rotation.SetAngleAxis(0, axis);
position.Set(0, 0, 0);
aabb.data.aabb.Reset();
aabb.data.dirty = false;
InvalidateSpatialData();
}
Spatial::~Spatial() {
parent = 0;
}
Spatial::Spatial(const Spatial &src) {
name = src.GetName();
position = src.position;
rotation = src.rotation;
scale = src.scale;
localMode = src.localMode;
aabb.data.aabb = src.GetAABB();
aabb.data.dirty = false;
parent = 0;
InvalidateSpatialData();
}
void Spatial::SetLocalMode(e_LocalMode localMode) {
this->localMode = localMode;
InvalidateBoundingVolume();
}
bool Spatial::GetLocalMode() {
return localMode;
}
void Spatial::SetName(const std::string &name) {
spatialMutex.lock();
this->name = name;
spatialMutex.unlock();
}
const std::string Spatial::GetName() const {
boost::mutex::scoped_lock blah(spatialMutex);
return name.c_str();
}
void Spatial::SetParent(Spatial *parent) {
this->parent = parent;
InvalidateBoundingVolume();
}
Spatial *Spatial::GetParent() const {
return parent;
}
void Spatial::SetPosition(const Vector3 &newPosition, bool updateSpatialData) {
spatialMutex.lock();
position = newPosition;
spatialMutex.unlock();
if (updateSpatialData) RecursiveUpdateSpatialData(e_SpatialDataType_Position);
}
Vector3 Spatial::GetPosition() const {
spatialMutex.lock();
Vector3 pos = position;
spatialMutex.unlock();
return pos;
}
void Spatial::SetRotation(const Quaternion &newRotation, bool updateSpatialData) {
spatialMutex.lock();
rotation = newRotation;
spatialMutex.unlock();
if (updateSpatialData) RecursiveUpdateSpatialData(e_SpatialDataType_Both);
}
Quaternion Spatial::GetRotation() const {
spatialMutex.lock();
Quaternion rot = rotation;
spatialMutex.unlock();
return rot;
}
void Spatial::SetScale(const Vector3 &newScale) {
spatialMutex.lock();
this->scale = newScale;
spatialMutex.unlock();
RecursiveUpdateSpatialData(e_SpatialDataType_Rotation);
}
Vector3 Spatial::GetScale() const {
spatialMutex.lock();
Vector3 retScale = scale;
spatialMutex.unlock();
return retScale;
}
Vector3 Spatial::GetDerivedPosition() const {
boost::mutex::scoped_lock cachelock(cacheMutex);
if (_dirty_DerivedPosition) {
if (localMode == e_LocalMode_Relative) {
if (parent) {
const Quaternion parentDerivedRotation = parent->GetDerivedRotation();
const Vector3 parentDerivedScale = parent->GetDerivedScale();
const Vector3 parentDerivedPosition = parent->GetDerivedPosition();
_cache_DerivedPosition.Set(parentDerivedRotation * (parentDerivedScale * GetPosition()));
_cache_DerivedPosition += parentDerivedPosition;
} else {
_cache_DerivedPosition = GetPosition();
}
} else {
_cache_DerivedPosition = GetPosition();
}
_dirty_DerivedPosition = false;
}
return _cache_DerivedPosition;
}
Quaternion Spatial::GetDerivedRotation() const {
boost::mutex::scoped_lock cachelock(cacheMutex);
if (_dirty_DerivedRotation) {
if (localMode == e_LocalMode_Relative) {
if (parent) {
_cache_DerivedRotation = (parent->GetDerivedRotation() * GetRotation()).GetNormalized();
} else {
_cache_DerivedRotation = GetRotation();
}
} else {
_cache_DerivedRotation = GetRotation();
}
_dirty_DerivedRotation = false;
}
return _cache_DerivedRotation;
}
Vector3 Spatial::GetDerivedScale() const {
boost::mutex::scoped_lock cachelock(cacheMutex);
if (_dirty_DerivedScale) {
if (localMode == e_LocalMode_Relative) {
if (parent) {
_cache_DerivedScale = parent->GetDerivedScale() * GetScale();
} else {
_cache_DerivedScale = GetScale();
}
} else {
_cache_DerivedScale = GetScale();
}
_dirty_DerivedScale = false;
}
return _cache_DerivedScale;
}
void Spatial::InvalidateBoundingVolume() {
bool changed = false;
aabb.Lock();
if (aabb.data.dirty == false) {
aabb.data.dirty = true;
aabb.data.aabb.Reset();
changed = true;
}
aabb.Unlock();
if (changed) if (parent) parent->InvalidateBoundingVolume();
}
void Spatial::InvalidateSpatialData() {
cacheMutex.lock();
_dirty_DerivedPosition = true;
_dirty_DerivedRotation = true;
_dirty_DerivedScale = true;
cacheMutex.unlock();
}
AABB Spatial::GetAABB() const {
AABB tmp;
aabb.Lock();
tmp = aabb.data.aabb;
aabb.Unlock();
return tmp;
}
}
| 26.834197 | 132 | 0.659973 | vi3itor |
471992f04f7855bfd1d789d6a73137485c4bfa3e | 6,805 | cpp | C++ | src/docks/quadockwidgetperms.cpp | juangburgos/QUaAccessControl | 6a1af53e30fb4e75111312b9bce46b983567049e | [
"MIT"
] | null | null | null | src/docks/quadockwidgetperms.cpp | juangburgos/QUaAccessControl | 6a1af53e30fb4e75111312b9bce46b983567049e | [
"MIT"
] | null | null | null | src/docks/quadockwidgetperms.cpp | juangburgos/QUaAccessControl | 6a1af53e30fb4e75111312b9bce46b983567049e | [
"MIT"
] | 1 | 2021-11-04T21:16:21.000Z | 2021-11-04T21:16:21.000Z | #include "quadockwidgetperms.h"
#include "ui_quadockwidgetperms.h"
#include <QUaAccessControl>
#include <QUaUser>
#include <QUaRole>
#include <QUaPermissions>
#include <QUaPermissionsList>
int QUaDockWidgetPerms::PointerRole = Qt::UserRole + 1;
QUaDockWidgetPerms::QUaDockWidgetPerms(QWidget *parent) :
QWidget(parent),
ui(new Ui::QUaDockWidgetPerms)
{
ui->setupUi(this);
m_deleting = false;
// hide stuff
ui->widgetPermsView->setActionsVisible(false);
ui->widgetPermsView->setIdVisible(false);
ui->widgetPermsView->setAccessReadOnly(true);
// events
QObject::connect(ui->pushButtonShowPerms, &QPushButton::clicked, this, &QUaDockWidgetPerms::showPermsClicked);
QObject::connect(ui->comboBoxPermissions, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QUaDockWidgetPerms::on_currentIndexChanged);
}
QUaDockWidgetPerms::~QUaDockWidgetPerms()
{
// disable old connections
while (m_connections.count() > 0)
{
QObject::disconnect(m_connections.takeFirst());
}
m_deleting = true;
delete ui;
}
void QUaDockWidgetPerms::setComboModel(QSortFilterProxyModel * proxy)
{
Q_CHECK_PTR(proxy);
// setup combo
ui->comboBoxPermissions->setModel(proxy);
ui->comboBoxPermissions->setEditable(true);
// setup completer
QCompleter *completer = new QCompleter(ui->comboBoxPermissions);
completer->setModel(proxy);
completer->setFilterMode(Qt::MatchContains);
ui->comboBoxPermissions->setCompleter(completer);
ui->comboBoxPermissions->setInsertPolicy(QComboBox::NoInsert);
}
QSortFilterProxyModel * QUaDockWidgetPerms::comboModel() const
{
return qobject_cast<QSortFilterProxyModel*>(ui->comboBoxPermissions->model());
}
QUaPermissions * QUaDockWidgetPerms::permissions() const
{
return ui->comboBoxPermissions->currentData(QUaDockWidgetPerms::PointerRole).value<QUaPermissions*>();
}
void QUaDockWidgetPerms::setPermissions(const QUaPermissions * permissions)
{
QString strId = "";
if (permissions)
{
strId = permissions->getId();
}
auto index = ui->comboBoxPermissions->findText(strId);
Q_ASSERT(index >= 0);
// NOTE : setCurrentText does not work, it does not hold the pointer (userData)
ui->comboBoxPermissions->setCurrentIndex(index);
Q_ASSERT(ui->comboBoxPermissions->currentData(QUaDockWidgetPerms::PointerRole).value<QUaPermissions*>() == permissions);
// populate ui->widgetPermsView
this->bindWidgetPermissionsEdit(permissions);
}
void QUaDockWidgetPerms::on_currentIndexChanged(int index)
{
Q_UNUSED(index);
this->bindWidgetPermissionsEdit(this->permissions());
}
void QUaDockWidgetPerms::clearWidgetPermissionsEdit()
{
ui->widgetPermsView->setId("");
ui->widgetPermsView->setRoleAccessMap(QUaRoleAccessMap());
ui->widgetPermsView->setUserAccessMap(QUaUserAccessMap());
ui->widgetPermsView->setEnabled(false);
}
void QUaDockWidgetPerms::bindWidgetPermissionsEdit(const QUaPermissions * perms)
{
if (!perms)
{
return;
}
// get access control
auto ac = perms->list()->accessControl();
Q_CHECK_PTR(ac);
// disable old connections
while (m_connections.count() > 0)
{
QObject::disconnect(m_connections.takeFirst());
}
// bind common
m_connections <<
QObject::connect(perms, &QObject::destroyed, this,
[this]() {
if (m_deleting)
{
return;
}
// clear widget
this->clearWidgetPermissionsEdit();
});
// roles (all)
QUaRoleAccessMap mapRoles;
auto roles = ac->roles()->roles();
for (auto role : roles)
{
mapRoles[role->getName()] = {
perms->canRoleRead(role),
perms->canRoleWrite(role)
};
}
ui->widgetPermsView->setRoleAccessMap(mapRoles);
// users (all)
QUaUserAccessMap mapUsers;
auto users = ac->users()->users();
for (auto user : users)
{
mapUsers[user->getName()] = {
perms->canUserReadDirectly(user),
perms->canUserWriteDirectly(user),
perms->canRoleRead(user->role()),
perms->canRoleWrite(user->role())
};
}
ui->widgetPermsView->setUserAccessMap(mapUsers);
// role updates
auto updateRole = [this, perms](QUaRole * role) {
// role table
ui->widgetPermsView->updateRoleAccess(
role->getName(),
{ perms->canRoleRead(role), perms->canRoleWrite(role) }
);
// user table
auto users = role->users();
for (auto user : users)
{
ui->widgetPermsView->updateUserAccess(
user->getName(),
{
perms->canUserReadDirectly(user),
perms->canUserWriteDirectly(user),
perms->canRoleRead(user->role()),
perms->canRoleWrite(user->role())
}
);
}
};
m_connections << QObject::connect(perms, &QUaPermissions::canReadRoleAdded , this, updateRole, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canReadRoleRemoved , this, updateRole, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canWriteRoleAdded , this, updateRole, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canWriteRoleRemoved, this, updateRole, Qt::QueuedConnection);
// user updates
auto updateUser = [this, perms](QUaUser * user) {
ui->widgetPermsView->updateUserAccess(
user->getName(),
{
perms->canUserReadDirectly (user),
perms->canUserWriteDirectly(user),
perms->canRoleRead (user->role()),
perms->canRoleWrite(user->role())
}
);
};
m_connections << QObject::connect(perms, &QUaPermissions::canReadUserAdded , this, updateUser, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canReadUserRemoved , this, updateUser, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canWriteUserAdded , this, updateUser, Qt::QueuedConnection);
m_connections << QObject::connect(perms, &QUaPermissions::canWriteUserRemoved, this, updateUser, Qt::QueuedConnection);
// user changes role
for (auto user : users)
{
m_connections << QObject::connect(user, &QUaUser::roleChanged, this,
[updateUser, user]() {
updateUser(user);
}, Qt::QueuedConnection);
}
// on user or role added/removed
auto resetPermsWidget = [this, perms]() {
this->bindWidgetPermissionsEdit(perms);
};
// NOTE : queued to wait until user/role has name or has actually been deleted
m_connections << QObject::connect(ac->roles(), &QUaRoleList::roleAdded , perms, resetPermsWidget, Qt::QueuedConnection);
m_connections << QObject::connect(ac->roles(), &QUaRoleList::roleRemoved, perms, resetPermsWidget, Qt::QueuedConnection);
m_connections << QObject::connect(ac->users(), &QUaUserList::userAdded , perms, resetPermsWidget, Qt::QueuedConnection);
m_connections << QObject::connect(ac->users(), &QUaUserList::userRemoved, perms, resetPermsWidget, Qt::QueuedConnection);
}
| 32.716346 | 148 | 0.714622 | juangburgos |
471d40609c336608934ef13cc447ef7eac67c3e5 | 987 | cpp | C++ | programs/decisions and loops/04_Quadratic_equation.cpp | MKrishan21/learn-cpp | 55f6fbccf97fc73e5d6081372a5ebda75f2a98d7 | [
"Apache-2.0"
] | null | null | null | programs/decisions and loops/04_Quadratic_equation.cpp | MKrishan21/learn-cpp | 55f6fbccf97fc73e5d6081372a5ebda75f2a98d7 | [
"Apache-2.0"
] | 1 | 2022-03-20T17:08:50.000Z | 2022-03-30T17:54:30.000Z | programs/decisions and loops/04_Quadratic_equation.cpp | MKrishan21/learn-cpp | 55f6fbccf97fc73e5d6081372a5ebda75f2a98d7 | [
"Apache-2.0"
] | null | null | null | // C++ Program to Find Quotient and Remainder
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float a, b, c, x1, x2, discriminant, x3, x4;
cout << "enter the coefficients a b & c ";
cin >> a >> b >> c;
discriminant = b * b - 4 * a * c;
if (discriminant > 0)
{
x1 = (-b + sqrt(discriminant)) / (2 * a);
x2 = (-b - sqrt(discriminant)) / (2 * a);
cout << "Roots are real and different. " << endl;
cout << "x1 = " << x1 << endl;
cout << "x2 = " << x2 << endl;
}
else if (discriminant == 0)
{
cout << "Roots are real & same. ";
x1 = -b / (2 * a);
cout << "x1 = x2 i.e " << x1 << endl;
}
else
{
x3 = -b / (2 * a);
x4 = sqrt(-discriminant) / (2 * a);
cout << "Roots are complex & different. ";
cout << "x1 = " << x3 << "+" << x4 << "i" << endl;
cout << "x2 = " << x3 << "-" << x4 << "i" << endl;
}
return 0;
} | 27.416667 | 58 | 0.435664 | MKrishan21 |
471ed406bdae8204c546e0c8b0f1151b07d33bb1 | 1,942 | hpp | C++ | libs/parse/include/fcppt/parse/make_convert_if.hpp | pmiddend/fcppt | 9f437acbb10258e6df6982a550213a05815eb2be | [
"BSL-1.0"
] | null | null | null | libs/parse/include/fcppt/parse/make_convert_if.hpp | pmiddend/fcppt | 9f437acbb10258e6df6982a550213a05815eb2be | [
"BSL-1.0"
] | null | null | null | libs/parse/include/fcppt/parse/make_convert_if.hpp | pmiddend/fcppt | 9f437acbb10258e6df6982a550213a05815eb2be | [
"BSL-1.0"
] | null | null | null | // Copyright Carl Philipp Reh 2009 - 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef FCPPT_PARSE_MAKE_CONVERT_IF_HPP_INCLUDED
#define FCPPT_PARSE_MAKE_CONVERT_IF_HPP_INCLUDED
#include <fcppt/function_impl.hpp>
#include <fcppt/either/failure_type.hpp>
#include <fcppt/either/success_type.hpp>
#include <fcppt/parse/convert_if_impl.hpp>
#include <fcppt/parse/result_of.hpp>
#include <fcppt/type_traits/remove_cv_ref_t.hpp>
#include <fcppt/type_traits/value_type.hpp>
#include <fcppt/config/external_begin.hpp>
#include <type_traits>
#include <utility>
#include <fcppt/config/external_end.hpp>
namespace fcppt
{
namespace parse
{
template<
typename Parser,
typename Convert
>
fcppt::parse::convert_if<
fcppt::type_traits::value_type<
fcppt::type_traits::value_type<
fcppt::either::failure_type<
std::result_of_t<
Convert(
fcppt::parse::result_of<
Parser
> &&
)
>
>
>
>,
fcppt::type_traits::remove_cv_ref_t<
Parser
>,
fcppt::either::success_type<
std::result_of_t<
Convert(
fcppt::parse::result_of<
Parser
> &&
)
>
>
>
make_convert_if(
Parser &&_parser,
Convert &&_convert
)
{
typedef
std::result_of_t<
Convert(
fcppt::parse::result_of<
Parser
> &&
)
>
result_type;
return
fcppt::parse::convert_if<
fcppt::type_traits::value_type<
fcppt::type_traits::value_type<
fcppt::either::failure_type<
result_type
>
>
>,
fcppt::type_traits::remove_cv_ref_t<
Parser
>,
fcppt::either::success_type<
result_type
>
>{
std::forward<
Parser
>(
_parser
),
fcppt::function<
result_type(
fcppt::parse::result_of<
Parser
> &&
)
>{
std::forward<
Convert
>(
_convert
)
}
};
}
}
}
#endif
| 16.886957 | 61 | 0.659114 | pmiddend |
47231b8910539119531cb2f3c6b5034866a68708 | 638 | cpp | C++ | src/executor/Executor.cpp | Charlieglider/machinery1 | 1d085634ecbb1cd69d920a92f71dd0fece659e1a | [
"Unlicense"
] | 1 | 2018-06-12T21:48:53.000Z | 2018-06-12T21:48:53.000Z | src/executor/Executor.cpp | chpap/machinery | 63130ccbe91339cadbdb0c3df3b6eea4da575403 | [
"Unlicense"
] | null | null | null | src/executor/Executor.cpp | chpap/machinery | 63130ccbe91339cadbdb0c3df3b6eea4da575403 | [
"Unlicense"
] | null | null | null | #include "Executor.h"
namespace kerberos
{
SequenceInterval::SequenceInterval(IntegerTypeArray & integers)
{
m_count = 0;
m_times = integers[0].first;
m_boundery = integers[1].first;
m_increase = m_boundery / m_times;
}
bool SequenceInterval::operator()()
{
m_count = (m_count+1) % m_boundery;
if (m_count % m_increase == 0)
{
return true;
}
return false;
}
TimeInterval::TimeInterval(IntegerTypeArray & integers)
{
}
bool TimeInterval::operator()()
{
return true;
}
} | 19.333333 | 67 | 0.540752 | Charlieglider |
472860cd6fcb7a90a6937d5c2e920d41e1edc0d6 | 719 | cpp | C++ | lucas/uri/1171.cpp | medeiroslucas/lo-and-behold-pp | d2be16f9b108b501fd9fccf173e741c93350cee4 | [
"MIT"
] | 2 | 2019-09-09T00:34:40.000Z | 2019-09-09T17:35:19.000Z | lucas/uri/1171.cpp | medeiroslucas/lo-and-behold-pp | d2be16f9b108b501fd9fccf173e741c93350cee4 | [
"MIT"
] | null | null | null | lucas/uri/1171.cpp | medeiroslucas/lo-and-behold-pp | d2be16f9b108b501fd9fccf173e741c93350cee4 | [
"MIT"
] | null | null | null | #include<bits/stdc++.h>
using namespace std;
int main(){
int N, i, min=2001, numanterior=0, cont=0;
int *numeros;
cin >> N;
numeros = (int *) malloc(N*sizeof(int));
for(i = 0; i<N; i++){
cin >> *(numeros+i);
}
while(1){
cont = 0;
for(i=0; i<N; i++){
if(*(numeros+i) < min && *(numeros+i) > numanterior){
min = *(numeros+i);
cont = 1;
}
else if(*(numeros+i) == min){
cont++;
}
}
if(min == 2001)return 0;
cout << min << " aparece " << cont << " vez(es)" << endl;
numanterior = min;
min = 2001;
}
return 0;
} | 15.630435 | 65 | 0.399166 | medeiroslucas |
472bf849153eac1a2753ad985cc015407da3743d | 8,613 | cpp | C++ | cegui/src/RenderTarget.cpp | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | null | null | null | cegui/src/RenderTarget.cpp | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | null | null | null | cegui/src/RenderTarget.cpp | cbeck88/cegui-mirror | 50d3a670b22fd957eba06549a9a7e04796d0b92f | [
"MIT"
] | 1 | 2020-07-21T00:03:01.000Z | 2020-07-21T00:03:01.000Z | /***********************************************************************
created: Sat Feb 18 2012
author: Paul D Turner <[email protected]>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#include "CEGUI/RenderTarget.h"
#include "CEGUI/Renderer.h"
#include "CEGUI/GeometryBuffer.h"
#include "CEGUI/RenderQueue.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/glm.hpp>
#if (GLM_VERSION_MAJOR == 0 && GLM_VERSION_MINOR <= 9 && GLM_VERSION_PATCH <= 3)
#include <glm/gtx/constants.hpp>
#else
#include <glm/gtc/constants.hpp>
#endif
#include <glm/gtc/type_ptr.hpp>
namespace CEGUI
{
//----------------------------------------------------------------------------//
const String RenderTarget::EventNamespace("RenderTarget");
const String RenderTarget::EventAreaChanged("AreaChanged");
//----------------------------------------------------------------------------//
RenderTarget::RenderTarget():
d_activationCounter(0),
d_area(0, 0, 0, 0),
d_matrixValid(false),
d_matrix(1.0f),
d_viewDistance(0),
d_fovY(glm::radians(30.0f))
{
// Call the setter function to ensure that the half-angle tangens value is set correctly
setFovY(d_fovY);
}
//----------------------------------------------------------------------------//
RenderTarget::~RenderTarget()
{}
//----------------------------------------------------------------------------//
void RenderTarget::activate()
{
Renderer& owner = getOwner();
owner.setActiveRenderTarget(this);
++d_activationCounter;
if(d_activationCounter == 0)
owner.invalidateGeomBufferMatrices(this);
}
//----------------------------------------------------------------------------//
void RenderTarget::deactivate()
{
}
//----------------------------------------------------------------------------//
void RenderTarget::draw(const GeometryBuffer& buffer)
{
buffer.draw();
}
//----------------------------------------------------------------------------//
void RenderTarget::draw(const RenderQueue& queue)
{
queue.draw();
}
//----------------------------------------------------------------------------//
unsigned int RenderTarget::getActivationCounter() const
{
return d_activationCounter;
}
//----------------------------------------------------------------------------//
void RenderTarget::setArea(const Rectf& area)
{
d_area = area;
d_matrixValid = false;
RenderTargetEventArgs args(this);
fireEvent(RenderTarget::EventAreaChanged, args);
}
//----------------------------------------------------------------------------//
const Rectf& RenderTarget::getArea() const
{
return d_area;
}
//----------------------------------------------------------------------------//
glm::mat4 RenderTarget::createViewProjMatrixForOpenGL() const
{
const float w = d_area.getWidth();
const float h = d_area.getHeight();
// We need to check if width or height are zero and act accordingly to prevent running into issues
// with divisions by zero which would lead to undefined values, as well as faulty clipping planes
// This is mostly important for avoiding asserts
const bool widthAndHeightNotZero = ( w != 0.0f ) && ( h != 0.0f);
const float aspect = widthAndHeightNotZero ? w / h : 1.0f;
const float midx = widthAndHeightNotZero ? w * 0.5f : 0.5f;
const float midy = widthAndHeightNotZero ? h * 0.5f : 0.5f;
RenderTarget::d_viewDistance = midx / (aspect * RenderTarget::d_fovY_halftan);
glm::vec3 eye = glm::vec3(midx, midy, -RenderTarget::d_viewDistance);
glm::vec3 center = glm::vec3(midx, midy, 1);
glm::vec3 up = glm::vec3(0, -1, 0);
// Creating the perspective projection matrix based on an assumed vertical FOV angle
// Older glm versions use degrees (Unless radians are forced via GLM_FORCE_RADIANS). Newer versions of glm exlusively use radians.
// We need to convert the angle for older versions
#if (GLM_VERSION_MAJOR == 0 && GLM_VERSION_MINOR <= 9 && GLM_VERSION_PATCH < 6) && (!defined(GLM_FORCE_RADIANS))
glm::mat4 projectionMatrix = glm::perspective(glm::degrees(d_fovY), aspect, float(d_viewDistance * 0.5), float(d_viewDistance * 2.0));
#else
glm::mat4 projectionMatrix = glm::perspective(d_fovY, aspect, float(d_viewDistance * 0.5), float(d_viewDistance * 2.0));
#endif
// Creating the view matrix based on the eye, center and up vectors targeting the middle of the screen
glm::mat4 viewMatrix = glm::lookAt(eye, center, up);
return projectionMatrix * viewMatrix;
}
//----------------------------------------------------------------------------//
glm::mat4 RenderTarget::createViewProjMatrixForDirect3D() const
{
const float w = d_area.getWidth();
const float h = d_area.getHeight();
// We need to check if width or height are zero and act accordingly to prevent running into issues
// with divisions by zero which would lead to undefined values, as well as faulty clipping planes
// This is mostly important for avoiding asserts
const bool widthAndHeightNotZero = ( w != 0.0f ) && ( h != 0.0f);
const float aspect = widthAndHeightNotZero ? w / h : 1.0f;
const float midx = widthAndHeightNotZero ? w * 0.5f : 0.5f;
const float midy = widthAndHeightNotZero ? h * 0.5f : 0.5f;
RenderTarget::d_viewDistance = midx / (aspect * RenderTarget::d_fovY_halftan);
glm::vec3 eye = glm::vec3(midx, midy, -d_viewDistance);
glm::vec3 center = glm::vec3(midx, midy, 1);
glm::vec3 up = glm::vec3(0, -1, 0);
// We need to have a projection matrix with its depth in clip space ranging from 0 to 1 for nearclip to farclip.
// The regular OpenGL projection matrix would work too, but we would lose 1 bit of depth precision, which the following
// manually filled matrix should fix:
const float fovy = 30.f;
const float zNear = RenderTarget::d_viewDistance * 0.5f;
const float zFar = RenderTarget::d_viewDistance * 2.0f;
const float f = 1.0f / std::tan(fovy * glm::pi<float>() * 0.5f / 180.0f);
const float Q = zFar / (zNear - zFar);
float projectionMatrixFloat[16] =
{
f/aspect, 0.0f, 0.0f, 0.0f,
0.0f, f, 0.0f, 0.0f,
0.0f, 0.0f, Q, -1.0f,
0.0f, 0.0f, Q * zNear, 0.0f
};
glm::mat4 projectionMatrix = glm::make_mat4(projectionMatrixFloat);
// Projection matrix abuse!
glm::mat4 viewMatrix = glm::lookAt(eye, center, up);
return projectionMatrix * viewMatrix;
}
//----------------------------------------------------------------------------//
void RenderTarget::updateMatrix(const glm::mat4& matrix) const
{
d_matrix = matrix;
d_matrixValid = true;
//! This will trigger the RenderTarget to notify all of its GeometryBuffers to regenerate their matrices
d_activationCounter = -1;
}
//----------------------------------------------------------------------------//
float RenderTarget::getFovY() const
{
return d_fovY;
}
//----------------------------------------------------------------------------//
void RenderTarget::setFovY(const float fovY)
{
d_fovY = fovY;
d_fovY_halftan = std::tan(fovY * 0.5f);
}
}
| 38.450893 | 138 | 0.564728 | cbeck88 |
472ec7e2931ae78bb65dabb8973dfac45545236e | 2,242 | cpp | C++ | src/vpg/memory/pool.cpp | RiscadoA/voxel-platformer | 4e7aadad978c333a59f452a8ee9f4612ee128614 | [
"MIT"
] | 3 | 2021-03-01T16:00:04.000Z | 2022-01-07T03:45:32.000Z | src/vpg/memory/pool.cpp | RiscadoA/voxel-platformer | 4e7aadad978c333a59f452a8ee9f4612ee128614 | [
"MIT"
] | null | null | null | src/vpg/memory/pool.cpp | RiscadoA/voxel-platformer | 4e7aadad978c333a59f452a8ee9f4612ee128614 | [
"MIT"
] | 2 | 2021-03-27T03:54:24.000Z | 2021-06-22T13:53:07.000Z | #include <vpg/memory/pool.hpp>
#include <cstring>
#include <cstdlib>
using namespace vpg::memory;
Pool<void>::Pool(size_t initial_count, size_t element_sz, std::align_val_t alignment) {
this->used = 0;
this->total = initial_count;
this->element_sz = element_sz;
this->alignment = alignment;
if ((size_t)this->alignment > this->element_sz) {
this->element_sz = (size_t)this->alignment;
}
else if (this->element_sz % (size_t)this->alignment != 0) {
this->element_sz = (this->element_sz / (size_t)this->alignment + 1) * (size_t)this->alignment;
}
this->data = operator new(this->total * this->element_sz + this->total, this->alignment);
this->state = (char*)this->data + this->total * this->element_sz;
memset(this->state, 0, this->total);
}
Pool<void>::Pool(Pool&& rhs) {
this->used = rhs.used;
this->total = rhs.total;
this->element_sz = rhs.element_sz;
this->alignment = rhs.alignment;
this->data = rhs.data;
rhs.data = nullptr;
}
Pool<void>::~Pool() {
if (this->data != nullptr) {
operator delete(this->data, this->alignment);
}
}
size_t Pool<void>::alloc() {
if (this->used < this->total) {
this->used += 1;
for (size_t i = 0; i < this->total; ++i) {
if (this->state[i] == 0) {
this->state[i] = 1;
return i;
}
}
abort(); // Unreachable
}
else {
this->used += 1;
// Expand pool
auto old_total = this->total;
this->total *= 2;
void* new_data = operator new(this->total * this->element_sz + this->total, this->alignment);
this->state = (char*)this->data + this->total * this->element_sz;
memset(this->state, 1, old_total + 1);
memset(this->state + old_total + 1, 0, total - old_total - 1);
memcpy(new_data, this->data, this->total * this->element_sz);
operator delete(this->data, this->alignment);
this->data = new_data;
return old_total;
}
}
void Pool<void>::free(size_t index) {
this->state[index] = 0;
}
bool vpg::memory::Pool<void>::has_element(size_t index) {
return index < this->total && this->state[index] != 0;
}
| 28.74359 | 102 | 0.582516 | RiscadoA |
47309395d715106960a581d984116c4e00f25402 | 3,485 | hpp | C++ | source/AsioExpress/EventHandling/ResourceCachePrivate/AddResourceItemsProcessor.hpp | suhao/asioexpress | 2f3453465934afdcdf4a575a2d933d86929b23c7 | [
"BSL-1.0"
] | null | null | null | source/AsioExpress/EventHandling/ResourceCachePrivate/AddResourceItemsProcessor.hpp | suhao/asioexpress | 2f3453465934afdcdf4a575a2d933d86929b23c7 | [
"BSL-1.0"
] | null | null | null | source/AsioExpress/EventHandling/ResourceCachePrivate/AddResourceItemsProcessor.hpp | suhao/asioexpress | 2f3453465934afdcdf4a575a2d933d86929b23c7 | [
"BSL-1.0"
] | null | null | null | // Copyright Ross MacGregor 2013
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <map>
#include <algorithm>
#include <boost/shared_ptr.hpp>
#include "AsioExpressError/CatchMacros.hpp"
#include "AsioExpress/UniqueId.hpp"
#include "AsioExpress/DebugTimer/DebugTimerMacros.hpp"
#include "AsioExpress/CompletionHandler.hpp"
#include "AsioExpress/Coroutine.hpp"
#include "AsioExpress/Yield.hpp"
namespace AsioExpress {
namespace ResourceCachePrivate {
template<typename ResourceItem, typename Key>
class AddResourceItemsProcessor : private AsioExpress::Coroutine
{
public:
typedef boost::shared_ptr<ResourceItem> ResourceItemPointer;
typedef boost::function<void (Key key, ResourceItemPointer item, CompletionHandler completionHandler)> AsyncRemoveFunction;
typedef ResourceCachePrivate::CacheRequest<ResourceItem, Key> Request;
typedef boost::shared_ptr<Request> RequestPointer;
typedef std::vector<Request> Requests;
typedef boost::shared_ptr<Requests> RequestsPointer;
typedef std::map<Key,int> ItemCount;
typedef boost::shared_ptr<ItemCount> ItemCountPointer;
AddResourceItemsProcessor(
Key key,
RequestsPointer requests,
ItemCountPointer itemCount,
AsyncRemoveFunction removeFunction,
CompletionHandler errorHandler) :
m_processorId("AddResourceItemsProcessor"),
m_key(key),
m_request(new Request),
m_requests(requests),
m_itemCount(itemCount),
m_removeFunction(removeFunction),
m_errorHandler(errorHandler)
{
}
void operator()(
AsioExpress::Error error = AsioExpress::Error())
{
try
{
STATEMENT_DEBUG_TIMER(m_processorId, __FILE__, this->GetCurrentLine());
REENTER(this)
{
while ((*m_itemCount)[m_key] > 0)
{
// remove request from queue if available
{
typename Requests::iterator r = std::find(
m_requests->begin(),
m_requests->end(),
m_key);
if (r == m_requests->end())
{
// no requests waiting.
break;
}
*m_request = *r;
m_requests->erase(r);
}
YIELD
{
--(*m_itemCount)[m_key];
m_removeFunction(m_key, m_request->item, *this);
}
// call completion handler
m_request->completionHandler(error);
m_request->completionHandler = 0;
}
OnExit(error);
}//REENTER
}
ASIOEXPRESS_CATCH_ERROR_AND_DO(OnExit(error))
}
private:
void OnExit(AsioExpress::Error const & error)
{
REMOVE_STATEMENT_DEBUG_TIMER(m_processorId, __FILE__, __LINE__);
if (error)
m_errorHandler(error);
}
AsioExpress::UniqueId m_processorId;
Key m_key;
RequestPointer m_request;
RequestsPointer m_requests;
ItemCountPointer m_itemCount;
AsyncRemoveFunction m_removeFunction;
CompletionHandler m_errorHandler;
};
} // namespace ResourceCachePrivate
} // namespace AsioExpress
| 30.304348 | 128 | 0.613199 | suhao |
473ddd7ed441686f935bd2f047b8e26dd205f682 | 10,542 | hpp | C++ | src/mods/FileEditor.hpp | youwereeatenbyalid/dx11_mod_base | c9c31426261c793e34a5b7ff1a15598777691ba5 | [
"MIT"
] | 2 | 2021-03-25T20:27:49.000Z | 2022-03-29T13:00:31.000Z | src/mods/FileEditor.hpp | youwereeatenbyalid/dx11_mod_base | c9c31426261c793e34a5b7ff1a15598777691ba5 | [
"MIT"
] | null | null | null | src/mods/FileEditor.hpp | youwereeatenbyalid/dx11_mod_base | c9c31426261c793e34a5b7ff1a15598777691ba5 | [
"MIT"
] | 2 | 2021-02-20T13:42:25.000Z | 2022-03-26T16:05:47.000Z | #pragma once
#include <map>
#include <filesystem>
#include <fstream>
#include <sstream>
#include "Mod.hpp"
#include "sdk/ReClass.hpp"
#include "mods/LDK.hpp"
#include "mods/SpardaWorkshop.hpp"
#include "mods/BpStageJump.hpp"
// clang-format off
namespace fs = std::filesystem;
class HotSwapCFG {
public:
HotSwapCFG(fs::path cfg_path);
HotSwapCFG(HotSwapCFG& other) = delete;
HotSwapCFG(HotSwapCFG&& other) = delete;
~HotSwapCFG() = default;
std::string get_name() const { return m_mod_name; }
std::string get_main_name() const { return m_main_name; }
std::optional<std::string> get_description() const { return m_description; }
std::optional<std::string> get_version() const { return m_version; }
std::optional<std::string> get_author() const { return m_author; }
std::optional<int> get_character() const {return m_character;}
private:
static enum class StringValue : const uint8_t {
ev_null,
ev_mod_name,
ev_description,
ev_version,
ev_author,
ev_character
};
static enum class CharacterValue : const uint8_t {
ev_null,
ev_nero,
ev_dante,
ev_v,
ev_vergil
};
std::map<std::string, StringValue> m_variable_map;
std::map<std::string, CharacterValue> m_char_name_map;
private:
void process_line(std::string variable, std::string value);
std::string str_to_lower(std::string s) {
::std::transform(s.begin(), s.end(), s.begin(), ::tolower);
return s;
}
private:
fs::path m_cfg_path;
std::string m_mod_name;
std::string m_main_name;
std::optional<std::string> m_description;
std::optional<std::string> m_version;
std::optional<std::string> m_author;
std::optional<uint8_t> m_character;
friend class FileEditor;
};
class FileEditor : public Mod {
public:
FileEditor();
~FileEditor() = default;
// mod name string for config
std::string_view get_name() const override { return "AssetSwapper"; }
std::string get_checkbox_name() override { return m_check_box_name; };
std::string get_hotkey_name() override { return m_hot_key_name; };
static bool m_is_active;
// called by m_mods->init() you'd want to override this
std::optional<std::string> on_initialize() override;
// Override this things if you want to store values in the config file
void on_config_load(const utility::Config& cfg) override;
void on_config_save(utility::Config& cfg) override;
// on_frame() is called every frame regardless whether the gui shows up.
void on_frame() override;
// on_draw_ui() is called only when the gui shows up
// you are in the imgui window here.
void on_draw_ui() override;
// on_draw_debug_ui() is called when debug window shows up
void on_draw_debug_ui() override;
private:
// Forward declration because I like to keep my structs at the end of the class
struct Costume_List_t;
struct Char_Default_Costume_Info;
// function hook instance for our detour, convinient wrapper
// around minhook
void init_check_box_info() override;
std::vector<char> m_costume_list_container;
static uint64_t m_original_costume_count;
static uint32_t get_costume_list_size(uint32_t character, uint64_t original_size);
static uintptr_t m_costume_list_size_addr;
static uintptr_t m_scroll_list_jmp_ret;
static uintptr_t m_costume_list_jmp_ret;
static uintptr_t m_costume_list_jnl_ret;
//static uintptr_t costume_select_jmp_ret;
static Costume_List_t* m_new_costume_list_p;
static std::optional<Char_Default_Costume_Info> m_selected_char_costume_info;
static uint32_t m_nero_costume_count;
static uint32_t m_nero_last_og_costume_count;
static bool m_nero_csize;
static uint32_t m_dante_costume_count;
static uint32_t m_dante_last_og_costume_count;
static bool m_dante_csize;
static uint32_t m_gilver_costume_count;
static uint32_t m_gilver_last_og_costume_count;
static bool m_gilver_csize;
static uint32_t m_vergil_costume_count;
static uint32_t m_vergil_last_og_costume_count;
static bool m_vergil_csize;
static uint32_t m_selected_character;
static bool m_is_in_select_menu;
// Showing the checkbox for the Super/EX costumes
bool m_show_costume_options;
static bool m_load_super;
static bool m_load_ex;
static naked void scroll_list_detour();
static naked void costume_list_detour();
// Saving a copy of the config data so we can use it for our own stuff after the first time the load function was called
std::optional<utility::Config> m_config;
// Actual hooks
std::unique_ptr<FunctionHook> m_file_loader_hook{};
std::unique_ptr<FunctionHook> m_costume_list_maker_hook{};
std::unique_ptr<FunctionHook> m_selected_costume_processor_hook{};
std::unique_ptr<FunctionHook> m_ui_costume_name_hook{};
// asm detours
std::unique_ptr<FunctionHook> m_scroll_list_hook{};
std::unique_ptr<FunctionHook> m_costume_list_hook{};
//Real men's hooks
static void* __fastcall file_loader_internal(uintptr_t this_p, uintptr_t RDX, const wchar_t* file_path);
void* __fastcall file_loader(uintptr_t this_p, uintptr_t RDX, const wchar_t* file_path);
static void __fastcall costume_list_maker_internal(uintptr_t RCX, uintptr_t ui2120GUI);
void __fastcall costume_list_maker(uintptr_t RCX, uintptr_t ui2120GUI);
static void __fastcall selected_costume_processor_internal(uintptr_t RCX, uintptr_t ui2120GUI);
void __fastcall selected_costume_processor(uintptr_t RCX, uintptr_t ui2120GUI);
static UI_String_t* __fastcall ui_costume_name_internal(uintptr_t RCX, uintptr_t RDX, uint32_t costume_id);
UI_String_t* __fastcall ui_costume_name(uintptr_t RCX, uintptr_t RDX, uint32_t costume_id);
void load_mods();
void load_sys_mods();
void bind_sys_mod(std::string modname, bool* on_value);
inline bool asset_check(const wchar_t* game_path, const wchar_t* mod_path) const;
private: // structs
struct Asset_Path{
/*const wchar_t* org_path;
const wchar_t* new_path;*/
std::wstring org_path;
std::wstring new_path;
};
struct Asset_Hotswap{
bool is_on;
uint64_t priority;
std::optional<uint32_t> character;
std::optional<uint32_t> slot_in_select_menu;
std::string name;
std::wstring w_name;
std::string main_name;
std::string label;
std::optional<std::string> description;
std::optional<std::string> version;
std::optional<std::string> author;
std::vector<Asset_Path> redirection_list;
std::optional<UI_String_t> costume_name;
uint32_t costume_id;
bool* on_ptr = nullptr;
};
struct Info_Back{
bool is_on;
unsigned int priority;
};
struct Costume_List_t{
// Only meant to be called when allocating memory properly
Costume_List_t(uint32_t init_size)
:ukn1{ nullptr }, ukn2{ NULL }, ukn3{ NULL },
ukn4{ nullptr }, ukn5{ NULL }, size{ init_size }
{
}
// Needs proper memory allocation
Costume_List_t(const Costume_List_t& other)
:ukn1{ other.ukn1 }, ukn2{ other.ukn2 }, ukn3{ other.ukn3 },
ukn4{ other.ukn4 }, ukn5{ other.ukn5 }, size{ other.size }
{
memcpy_s(&costumes, size*sizeof(uint32_t), &other.costumes, other.size*sizeof(uint32_t));
}
// Needs proper memory allocation
Costume_List_t(const Costume_List_t& other, uint32_t init_size)
:ukn1{ other.ukn1 }, ukn2{ other.ukn2 }, ukn3{ other.ukn3 },
ukn4{ other.ukn4 }, ukn5{ other.ukn5 }, size{ init_size }
{
memcpy_s(&costumes, size*sizeof(uint32_t), &other.costumes, other.size*sizeof(uint32_t));
}
// Needs proper memory allocation
Costume_List_t(const Costume_List_t& other, uint32_t org_size, std::vector<uint32_t> extra)
:ukn1{ other.ukn1 }, ukn2{ other.ukn2 }, ukn3{ other.ukn3 },
ukn4{ other.ukn4 }, ukn5{ other.ukn5 }, size{ org_size + extra.size() }
{
// Transfering original costume list to the new list
for (UINT i = 0; i < org_size; i++) {
costumes[i] = other.costumes[i];
}
// Putting the extra costumes into slots after the original costumes
for (UINT i = 0; i < extra.size(); i++) {
costumes[i + org_size] = extra[i];
}
}
void* ukn1;
uint32_t ukn2;
uint32_t ukn3;
void* ukn4;
uint32_t ukn5;
uint32_t size;
uint32_t costumes[];
uint32_t& operator[](uint64_t index) {
return this->costumes[index];
}
const uint32_t& operator[](uint64_t index) const {
return this->costumes[index];
}
void operator=(const Costume_List_t& other) {
ukn1 = other.ukn1;
ukn2 = other.ukn2;
ukn3 = other.ukn3;
ukn4 = other.ukn4;
ukn5 = other.ukn5;
size = other.size;
memcpy_s(costumes, size*sizeof(uint32_t), other.costumes, other.size*sizeof(uint32_t));
}
};
struct Char_Default_Costume_Info {
uint8_t org_super;
uint8_t org;
uint8_t ex;
uint8_t ex_super;
};
private:
std::optional<std::vector<fs::path>> m_mod_roots{};
std::optional<std::vector<fs::path>> m_sys_mod_roots{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_hot_swaps{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_sys_hot_swaps{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_nero_swaps{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_dante_swaps{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_gilver_swaps{};
std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>> m_vergil_swaps{};
std::vector<uint32_t> m_nero_extra_costumes;
std::vector<uint32_t> m_dante_extra_costumes;
std::vector<uint32_t> m_gilver_extra_costumes;
std::vector<uint32_t> m_vergil_extra_costumes;
void asset_swap_ui(std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>>& hot_swaps);
void costume_swap_ui(std::optional<std::vector<std::shared_ptr<Asset_Hotswap>>>& costume_swaps);
};
| 34.907285 | 124 | 0.677006 | youwereeatenbyalid |
473ebb403849cafbd4d58a78c43a7d4159e2cbc3 | 1,154 | cpp | C++ | Chapter04/mmap_write.cpp | trantrongquy/C-System-Programming-Cookbook | 2df8795d8f88de10e38297606ac2fa9993d6dab4 | [
"MIT"
] | 36 | 2020-03-23T21:10:14.000Z | 2022-01-22T20:22:30.000Z | Chapter04/mmap_write.cpp | trantrongquy/C-System-Programming-Cookbook | 2df8795d8f88de10e38297606ac2fa9993d6dab4 | [
"MIT"
] | 2 | 2020-02-28T13:14:44.000Z | 2021-06-17T07:55:34.000Z | Chapter04/mmap_write.cpp | trantrongquy/C-System-Programming-Cookbook | 2df8795d8f88de10e38297606ac2fa9993d6dab4 | [
"MIT"
] | 22 | 2020-02-21T08:00:06.000Z | 2022-02-09T11:05:13.000Z | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <iostream>
#define FILEPATH "mmapped.txt"
#define NUM_OF_ITEMS_IN_FILE (1000)
#define FILESIZE (NUM_OF_ITEMS_IN_FILE * sizeof(int))
int main(int argc, char *argv[])
{
int fd = open(FILEPATH, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600);
if (fd == -1)
{
std::cout << "Error opening file " << FILEPATH << std::endl;
return 1;
}
int result = lseek(fd, FILESIZE-1, SEEK_SET);
if (result == -1)
{
close(fd);
std::cout << "Error calling lseek " << std::endl;
return 2;
}
result = write(fd, "", 1);
if (result != 1)
{
close(fd);
std::cout << "Error writing into the file " << std::endl;
return 3;
}
int* map = (int*) mmap(0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (map == MAP_FAILED)
{
close(fd);
std::cout << "Error mapping the file " << std::endl;
return 4;
}
for (int i = 1; i <=NUM_OF_ITEMS_IN_FILE; ++i)
map[i] = 2 * i;
if (munmap(map, FILESIZE) == -1)
std::cout << "Error un-mapping" << std::endl;
close(fd);
return 0;
}
| 20.981818 | 83 | 0.584922 | trantrongquy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.