blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
34483e5efaae0f464e494d6d232b289c88a1d550
ef057bfab67839f83a95608f94877c630953093a
/Animations.cpp
c13547f1ca3b335940053106363f2e7026313fce
[]
no_license
henry-dv/Animations
d617e4ae16668958a3aa8fc7f4c91c2ddc8e17d8
723b7547e9bc48c943ddfc3f6d951ccc7bed9a5c
refs/heads/master
2023-02-11T01:34:23.186419
2021-01-02T19:22:42
2021-01-02T19:22:42
326,255,025
0
0
null
null
null
null
UTF-8
C++
false
false
2,005
cpp
/* Animations.cpp - Fancy animations for an Adafruit_NeoPixel strip. Created by Henry Lehmann, December 30, 2020. Released into the public domain. */ #include "Arduino.h" #include "Colors.h" #include "Animations.h" Animations::Animations(Adafruit_NeoPixel* strip) { this->strip = strip; e_MyAnimation = e_breathe; myAnimation = breathe; myColor = colors.RED; } void Animations::nextFrame(unsigned long ticks) { myAnimation(ticks); } void Animations::cycleAnimation() { setAnimation((E_Animations)((this->e_MyAnimation + 1) % ANIMATION_COUNT)); } E_Animations Animations::getAnimation() { return this->e_MyAnimation; } void Animations::setAnimation(E_Animations newAnimation) { this->e_MyAnimation = newAnimation; switch (this->e_MyAnimation) { case e_breathe: myAnimation = breathe; break; case e_christmasTime: myAnimation = christmasTime; break; case e_plainColor: myAnimation = plainColor; break; case e_strobo: myAnimation = strobo; break; default: break; } } uint32_t Animations::getColor() { return this->myColor; } void Animations::setColor(uint32_t newColor) { this->myColor = newColor; } //-------Actual Animations------- void Animations::breathe(unsigned long ticks) { unsigned int myticks = ticks >> 4; if ((myticks / 256) % 2 == 0) strip.fill(colors.hsbToRgb(195, 255, myticks % 256)); else strip.fill(colors.hsbToRgb(195, 255, 255 - (myticks % 256))); } void Animations::christmasTime(unsigned long ticks) { unsigned short myticks = ticks >> 10; for (int i = 0; i < LED_COUNT; i++) { if ((i + myticks) % 2 == 0) { strip.setPixelColor(i, colors.RED); } else { strip.setPixelColor(i, colors.GREEN); } } } void Animations::plainColor(unsigned long ticks) { strip.fill(myColor); } void Animations::strobo(unsigned long ticks) { unsigned short myticks = ticks >> 6; if (myticks % 2 == 0) strip.fill(colors.WHITE); else strip.clear(); }
[ "34438247+henry-dv@users.noreply.github.com" ]
34438247+henry-dv@users.noreply.github.com
3f4694f690c492589c35e8eefa55aa300c672c7a
99e578a2e5b42ba1540683ce1e0497537267858b
/src/base/track.cc
6570ba63c3c8f18158fe532a07badb684d1bbd8c
[ "BSD-3-Clause" ]
permissive
ThakurSarveshGit/privacy_preserving_sfm
ffa551e086c30620b6b66a20e50b0d65aab1cf93
c2f1e8a58251eae5af7eba7ede3f15534f944f1a
refs/heads/master
2023-06-03T20:45:45.294563
2021-06-09T07:33:25
2021-06-09T07:33:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,513
cc
// Copyright (c) 2020, ETH Zurich and UNC Chapel Hill. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of ETH Zurich and UNC Chapel Hill nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Authors: Johannes L. Schoenberger (jsch-at-demuc-dot-de) // Viktor Larsson (viktor.larsson@inf.ethz.ch) // Marcel Geppert (marcel.geppert@inf.ethz.ch) #include "base/track.h" namespace colmap { Track::Track() {} TrackElement::TrackElement() : image_id(kInvalidImageId), line_idx(kInvalidLineIdx) {} TrackElement::TrackElement(const image_t image_id, const point2D_t line_idx) : image_id(image_id), line_idx(line_idx) {} void Track::DeleteElement(const image_t image_id, const point2D_t line_idx) { elements_.erase( std::remove_if(elements_.begin(), elements_.end(), [image_id, line_idx](const TrackElement& element) { return element.image_id == image_id && element.line_idx == line_idx; }), elements_.end()); } } // namespace colmap
[ "marcel.geppert@inf.ethz.ch" ]
marcel.geppert@inf.ethz.ch
6f8b08e7802cd14b3056be1217c407ea6982f40e
87ef03375ec4a32b7defdbdb1fbd1ed8dbb4dcbd
/Hcv/LocHist/ImgDataGradMgr_LocHist.h
b02047271d2f2de976a04d71909736edbba90537
[]
no_license
Haytham-Magdi/CppLib
192fb2008907c3d0ae2bb34bb8c066c1d86a4c6f
c8a1ba6bca656574196ba19a75c1cbdc4b829b7c
refs/heads/master
2020-09-20T10:54:57.022052
2017-01-23T05:27:52
2017-01-23T05:27:52
66,259,819
0
0
null
null
null
null
UTF-8
C++
false
false
2,721
h
#pragma once #include <Lib\Cpp\Common\commonLib.h> #include <Lib\Cpp\Math\mathLib.h> #include <Lib\Hcv\CvIncludes.h> #include <Lib\Hcv\Types.h> #include <Lib\Hcv\error.h> #include <vector> #include <Lib\Hcv\Channel.h> #include <Lib\Hcv\Image.h> #include <Lib\Hcv\IImgDataGradMgr.h> #include <Lib\Hcv\LocHist\ImgDataMgr_2_LocHist.h> namespace Hcv { //using namespace Hcpl::Math; class ImgDataGradMgr_LocHist_Factory : public IImgDataGradMgr_Factory { public: virtual IImgDataGradMgr * CreateImgDataGradMgr( IImgDataMgr_2Ref a_imgData, ImageNbrMgrRef a_nbrMgr ); }; typedef Hcpl::ObjRef< ImgDataGradMgr_LocHist_Factory > ImgDataGradMgr_LocHist_FactoryRef; class ImgDataGradMgr_LocHist : public IImgDataGradMgr { public: ImgDataGradMgr_LocHist( IImgDataMgr_2Ref a_imgData, ImageNbrMgrRef a_nbrMgr ); virtual IImgDataMgr_2Ref GetSrcImgDataMgr() { return m_imgDataMgr; } virtual F32ImageRef GetGradImg_H() { return m_gradImg_H; } virtual F32ImageRef GetGradImg_V() { return m_gradImg_V; } virtual F32ImageRef GetConflictImg_H() { ThrowHcvException(); return NULL; } virtual F32ImageRef GetConflictImg_V() { ThrowHcvException(); return NULL; } virtual ImageNbrMgrRef GetNbrMgr() { return m_nbrMgr; } virtual int GetAprSiz() { return m_nAprSiz; } virtual F32ImageRef GetGradImg_ByNormIdx( int a_nNormIdx ); virtual F32ImageRef GetConfImg_ByNormIdx( int a_nNormIdx ); virtual float GetMaxDif() { return S_GetMaxDif(); } static float S_GetMaxDif() { return 550; } protected: void PrepareData(); void PrepareSharpStuff(); float CalcDif( int a_nIdx_1, int a_nIdx_2 ); F32ImageRef GenGradImg( FixedVector< ImageNbrMgr::PixIndexNbr > & a_rNbrArr ); float CalcConf( int a_nIdx_E, int a_nIdx_1, int a_nIdx_2 ); F32ImageRef GenConfImg( FixedVector< ImageNbrMgr::PixIndexNbr > & a_rNbrArr ); protected: IImgDataMgr_2Ref m_imgDataMgr; F32ImageRef m_srcMeanImg; F32ColorVal * m_srcMean_Buf; F32ImageRef m_srcStanDevImg; float * m_srcStanDev_Buf; F32ImageRef m_srcAvgSqrMagImg; float * m_srcAvgMagSqr_Buf; ImgDataMgr_2_LocHist * m_pDataMgr_LH; Hcpl::CommonArrCollBuff< ImgDataSrc_LocHist::ClustShare > * m_pPixShareArrColl_Tot; ImgDataSrc_LocHist::ClustHisto * m_pClustHisto; F32ImageRef m_gradImg_H; F32ImageRef m_gradImg_V; float * m_conf_Sharp_Buf; F32ImageRef m_confImg_H; F32ImageRef m_confImg_V; ImageNbrMgrRef m_nbrMgr; int m_nAprSiz; bool m_bSrcExDataDone; IImgDataMgr_2Ref m_sharp_IDM; IImgDataGradMgrRef m_sharp_GM; }; typedef Hcpl::ObjRef< ImgDataGradMgr_LocHist > ImgDataGradMgr_LocHistRef; }
[ "haytham.magdi@hotmail.com" ]
haytham.magdi@hotmail.com
eade68ffa3eddf2dcf48c12abe6cf4dd64c611eb
5e9c396ea5d81dce62ef4e6f260db21385608922
/src/tests/unit_tests/core/utest_CH_linalg.cpp
e61bfa12240205e6e30df6bca1f83afc5a25391a
[ "BSD-3-Clause" ]
permissive
gvvynplaine/chrono
357b30f896eb6c1dcabcebd0d88f10fab3faff20
a3c0c8735eb069d5c845a7b508a048b58e022ce0
refs/heads/develop
2023-01-05T08:43:13.115419
2020-07-09T08:24:34
2020-07-09T08:24:34
278,308,549
0
0
BSD-3-Clause
2020-10-30T12:17:47
2020-07-09T08:33:24
null
UTF-8
C++
false
false
8,105
cpp
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // Tests for miscellaneous linear algebra support. // // ============================================================================= #include "chrono/core/ChMatrix.h" #include "chrono/core/ChMatrixMBD.h" #include "chrono/core/ChTransform.h" #include "gtest/gtest.h" using std::cout; using std::endl; using namespace chrono; const double ABS_ERR = 1e-10; TEST(LinearAlgebraTest, create_assign) { ChMatrixDynamic<> Md1(5, 7); ChMatrixDynamic<> Md2(4, 4); ChMatrixNM<double, 4, 4> Ms; ChMatrix33<> A33(Q_from_AngY(0.4)); Ms.setConstant(0.1); // Fill a matrix with an element ASSERT_DOUBLE_EQ(Ms.maxCoeff(), 0.1); ASSERT_DOUBLE_EQ(Ms.minCoeff(), 0.1); Md1.setRandom(); // initialize with random numbers double e32 = Md1(3, 2); Md1.transposeInPlace(); // transpose the matrix in place ASSERT_DOUBLE_EQ(Md1(2, 3), e32); Md1.resize(2, 2); // resize Md1.setZero(); // set all elements to zero ASSERT_DOUBLE_EQ(Md1.maxCoeff(), 0.0); ASSERT_DOUBLE_EQ(Md1.minCoeff(), 0.0); Md2.setIdentity(); // Create a diagonal matrix Md2 *= 3; ASSERT_DOUBLE_EQ(Md2.trace(), 4 * 3.0); ChMatrixDynamic<> M1(Md2); // Copy constructor ChMatrixDynamic<> M2(-M1); // The - unary operator returns a negated matrix ChMatrixDynamic<> M3(8, 4); // 8x4 uninitialized matrix M3 = M1; // Copy (resize as needed) M3 = M1.transpose(); // transposed copy. ASSERT_TRUE((M3 + M2.transpose()).isZero()); ChMatrix33<> B33(1.0); cout << "3x3 identity matrix\n" << B33 << endl; ASSERT_DOUBLE_EQ(B33.trace(), 3.0); } TEST(LinearAlgebraTest, operations) { ChMatrixNM<double, 2, 3> A; ChMatrixDynamic<double> B(2, 3); A.setRandom(); B.setRandom(); ChMatrixDynamic<> sum1(A + B); ChMatrixDynamic<> sum2 = A + B; ChMatrixDynamic<> sum3 = A; sum3 += B; ASSERT_TRUE(sum2 == sum1); ASSERT_TRUE(sum3 == sum1); // Different ways to do subtraction.. ChMatrixDynamic<> diff1 = A - B; ChMatrixDynamic<> diff2 = A; diff2 -= B; ASSERT_TRUE(diff1 == diff2); // Multiplication with scalar ChMatrixDynamic<> ms1 = A * 10; ChMatrixNM<double, 2, 3> ms2 = 10 * A; ChMatrixDynamic<> ms3 = A; ms3 *= 10; ASSERT_TRUE(ms2 == ms1); ASSERT_TRUE(ms3 == ms1); // Matrix multiplications ChMatrixDynamic<> C(3, 2); ChMatrixDynamic<> D(2, 3); C << 1, 2, 3, 4, 5, 6; D << 1, 2, 3, 4, 5, 6; ChMatrix33<> R(Q_from_AngX(CH_C_PI_2)); ChMatrixDynamic<double> CD = C * D; ChMatrixDynamic<double> CD_t = D.transpose() * C.transpose(); ChMatrixDynamic<> RC = R * C; ChMatrixDynamic<> DR = D * R; cout << R << "\n"; cout << "rot * matrix\n" << R * C << endl; cout << "matrix * rot\n" << D * R << endl; ASSERT_TRUE(CD.transpose() == CD_t); ASSERT_DOUBLE_EQ(RC(1, 0), -C(2, 0)); ASSERT_DOUBLE_EQ(DR(1, 2), -D(1, 1)); // Component-wise matrix multiplication and division ChMatrixDynamic<> C_times_D = C.array() * D.transpose().array(); ChMatrixDynamic<> C_div_D = C.array() / D.transpose().array(); cout << "C\n" << C << endl; cout << "D'\n" << D.transpose() << endl; cout << "C_times_D' (component-wise)\n" << C_times_D << endl; cout << "C_div_D' (component-wise)\n" << C_div_D << endl; // Assigning matrix rows ChMatrix33<> J; J << 10, 20, 30, 40, 50, 60, 70, 80, 90; cout << "3x3 matrix J\n" << J << endl; ChVectorN<double, 10> V; V.setZero(); V.segment(3, 3) = J.row(0); cout << "Place row0 in V starting at index 3\n" << V.transpose() << endl; V.segment(7, 3) = J.row(1); cout << "Place row1 in V starting at index 7\n" << V.transpose() << endl; } TEST(LinearAlgebraTest, vector_rotation) { ChQuaternion<> q(1, 2, 3, 4); ChMatrix33<> A(q.GetNormalized()); ChVector<> v1(1, 2, 3); ChVector<> v2 = A * v1; ChVector<> v3 = A.transpose() * v2; cout << A << endl; cout << v1 << endl; cout << v2 << endl; cout << v3 << endl; ASSERT_TRUE(v3.Equals(v1, 1e-8)); } TEST(LinearAlgebraTest, extensions) { ChMatrixNM<double, 2, 3> A; A.setRandom(); cout << "random 2x3 matrix A:\n" << A << endl; A.fillDiagonal(10.1); cout << "fill diagonal with 10.1:\n" << A << endl; A.fill(2.1); cout << "fill entire matrix with 2.1:\n" << A << endl; ChMatrixNM<double, 2, 3> B(A); B(1, 2) += 0.01; cout << "matrix B = A with B(1,2) incremented by 0.01\n" << B << endl; cout << "|A-B| < 0.1? " << A.equals(B, 0.1) << endl; cout << "|A-B| < 0.001? " << A.equals(B, 0.001) << endl; ASSERT_TRUE(A.equals(B, 0.1)); ASSERT_FALSE(A.equals(B, 0.001)); ChVectorDynamic<> v(3); v << 2, 3, 4; ChVectorDynamic<> w(3); w << 0.1, 0.2, 0.3; double wrms_ref = std::sqrt((0.2 * 0.2 + 0.6 * 0.6 + 1.2 * 1.2) / 3); cout << "||v||_wrms, w = " << v.wrmsNorm(w) << endl; cout << "||v + v||_wrms, w = " << (v + v).wrmsNorm(w) << endl; ASSERT_NEAR(v.wrmsNorm(w), wrms_ref, ABS_ERR); ASSERT_NEAR((v + v).wrmsNorm(w), 2 * wrms_ref, ABS_ERR); cout << "v + v + 1: " << (v + v) + 1 << endl; cout << "1 + v: " << 1 + v << endl; } TEST(LinearAlgebraTest, pasting) { ChMatrixDynamic<> A(4, 6); A.setRandom(); cout << A << "\n\n"; ChMatrixNM<double, 2, 3> B; B << 1, 2, 3, 4, 5, 6; cout << B << "\n\n"; ChMatrixNM<double, 5, 7> C; C.setZero(); C.block<2, 3>(1, 1) << 10, 20, 30, 40, 50, 60; cout << C << "\n\n"; ChMatrixDynamic<> X = A; X.block<2, 3>(1, 2) = B; cout << X << "\n\n"; ASSERT_DOUBLE_EQ(X(1, 2), B(0, 0)); ASSERT_DOUBLE_EQ(X(1, 3), B(0, 1)); ASSERT_DOUBLE_EQ(X(1, 4), B(0, 2)); X.block<2, 3>(1, 2) += C.block<2, 3>(1, 1); cout << X << "\n\n"; ASSERT_DOUBLE_EQ(X(1, 2), B(0, 0) + C(1, 1)); ASSERT_DOUBLE_EQ(X(1, 3), B(0, 1) + C(1, 2)); ASSERT_DOUBLE_EQ(X(1, 4), B(0, 2) + C(1, 3)); } TEST(LinearAlgebraTest, custom_matrices) { ChMatrix34<> G = Eigen::Matrix<double, 3, 4>::Ones(3, 4); ChQuaternion<> q(1, 2, 3, 4); ChVector<> v = G * q; cout << v << endl; ChMatrix43<> Gt2 = 2 * G.transpose(); cout << Gt2 << endl; q = Gt2 * v; cout << q << endl; q = G.transpose() * v; cout << q << endl; ChMatrix33<> rot(Q_from_AngX(CH_C_PI / 6)); cout << rot << endl; cout << rot.transpose() << endl; ChMatrix34<> res1 = rot * G; ChMatrix34<> res2 = rot * Gt2.transpose(); ChMatrix43<> res3 = Gt2 * rot; ChMatrix43<> res4 = G.transpose() * rot; ASSERT_TRUE(2 * res1 == res2); ASSERT_TRUE(res3 == 2 * res4); ChMatrix44<> A44; A44.setRandom(); ChQuaternion<> q2 = A44 * q; ChStarMatrix44<> X(ChQuaternion<>(1, 2, 3, 4)); cout << "4x4 star matrix X:\n" << X << endl; ASSERT_TRUE(X(1, 2) == -4); X.semiTranspose(); cout << "Semi-transpose X:\n" << X << endl; ASSERT_TRUE(X(1, 2) == 4); X.semiNegate(); cout << "Semi-negate X:\n" << X << endl; ASSERT_TRUE(X(1, 2) == -4); } TEST(LinearAlgebraTest, solve) { ChMatrixNM<double, 3, 3> A; Eigen::Vector3d b; A << 1, 2, 3, 4, 5, 6, 7, 8, 10; b << 3, 3, 4; cout << "matrix A:\n" << A << endl; cout << "vector b:\n" << b << endl; Eigen::Vector3d x = A.colPivHouseholderQr().solve(b); cout << "solution:\n" << x << endl; cout << "Ax-b:\n" << A * x - b << endl; ASSERT_NEAR((A * x - b).norm(), 0.0, ABS_ERR); }
[ "serban@wisc.edu" ]
serban@wisc.edu
b1f99e3664070b0b1904a62226a09dbf5f226dfd
ffa427f7667d7fc05c4e872966cbb272242d3c19
/arc/000/030/arc033/b/main.cpp
cbda9a52f0002a9a31b0cfe79adee3bc47a73bf3
[]
no_license
kubonits/atcoder
10fb6c9477c9b5ff7f963224a2c851aaf10b4b65
5aa001aab4aaabdac2de8c1abd624e3d1c08d3e3
refs/heads/master
2022-10-02T06:42:32.535800
2022-08-29T15:44:55
2022-08-29T15:44:55
160,827,483
0
0
null
null
null
null
UTF-8
C++
false
false
720
cpp
#include <algorithm> #include <iomanip> #include <iostream> using namespace std; int main() { int n, m, a[100000], b[100000]; double cnt1 = 0.0, cnt2 = 0.0; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) { cin >> b[i]; } sort(a, a + n); sort(b, b + m); int ap = 0, bp = 0; while (ap < n || bp < m) { if (ap == n) { bp++; cnt1++; } else if (bp == m) { ap++; cnt1++; } else if (a[ap] > b[bp]) { bp++; cnt1++; } else if (a[ap] < b[bp]) { ap++; cnt1++; } else { ap++; bp++; cnt1++; cnt2++; } } cout << fixed << setprecision(7) << cnt2 / cnt1 << endl; }
[ "kouhei.08.10.09.s@gmail.com" ]
kouhei.08.10.09.s@gmail.com
0d7a825b2da17835934b1528662bfc1fc771c9eb
85049d73764926d9d8cbf068504d3cec0abfc85d
/course/cs106b/1176/midterm/p2/student_70.cpp
0349929084bd25ee5f8771796310d0a632437f07
[]
no_license
tofergregg/CodeReview
a13f3ff30e586d11d63f2c02246bb6ca1206a4fa
5fc04c818b017b30466ac53e5b1be1d8ef9336a3
refs/heads/master
2021-01-21T07:00:42.726665
2018-06-10T00:43:50
2018-06-10T00:43:50
91,594,286
0
0
null
2017-07-24T05:04:33
2017-05-17T15:52:14
C++
UTF-8
C++
false
false
1,504
cpp
string decode(string seq) { int min = 1; while(seq.size()!=0) { if(seq[0]='I') { Queue<int> solution; solution.enqueue(min); } else { Stack<int> solution; solution.push(min); } } } I give up. This problem is retardedly hard. there is some obvious thing I am not seeing i know 100% how stacks and queues work but I still cant figure this out I feel like a double-ended queue would help but we don't have that example: IIIIIIID should be 234567891 how am I supposed to know, when at the first I, that I need to begin with a 2 instead of a 1. Maybe I use a queue, and I pile up 1-8 for all the Is, then when I see the D take the 1 from the front of the queue and use it. But then consider the example DDDDDDDI which should be 876543219. THe only way to maintain this is with a stack. i.e. I start with 1 and for every D keep adding to the top until I get to 8 and then use the remaining 9 for the I. It makes no sense to me I can either use a stack OR a queue but not both. I thought about this problem for 45 minutes and have no work to show except these thoughts. Maybe if I encounter an I I use a queue and if I encounter a D I use a stack and mantain each respective container until I run out of Is or Ds and switch to the other. But then I don't understand how to retroactively fix previously generated numbers in O(n) time. I think you have to use a stack or a queue depending on the first character, but I am literally out of time at this point and cannot implement a solution.
[ "tofergregg@gmail.com" ]
tofergregg@gmail.com
e79b4f30995cfb7dff0ef66853b9e22413dd5890
7917fec06701ba93b7f3253507e3d1307fb8157d
/Landing Prediction UE4 Tensorflow/Source/TFGameBase/TFGameBaseGameModeBase.h
1632a0f5d61b3c0335764842542fe5862b0d5d88
[]
no_license
the-muses-ltd/Cassie
e13bdaca05d79b5aae4b48d1b8e5a2cced5151c3
74bdbf70d40867b68075a5999333af29da809ef2
refs/heads/main
2023-02-04T05:56:20.380965
2020-12-22T10:49:20
2020-12-22T10:49:20
312,335,813
3
0
null
null
null
null
UTF-8
C++
false
false
320
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/GameModeBase.h" #include "TFGameBaseGameModeBase.generated.h" /** * */ UCLASS() class TFGAMEBASE_API ATFGameBaseGameModeBase : public AGameModeBase { GENERATED_BODY() };
[ "alicep35@gmail.com" ]
alicep35@gmail.com
5456f37cb5385ab0a9376214e5ac355c42da21db
9de6af0ff9eb15e857c0c0ecffb6108418a80750
/Ninja_Platformer/src/App.cpp
70a815e60825ec6b51201b09d14114bd299d759c
[ "MIT" ]
permissive
Alejandro-Casanova/Advanced-C-and-Graphics
70157dc13ac0da2f36937c96ce73ddd9b2e73c2a
e7876b23e1cde3368c73fb7e34ebcbc3cb141704
refs/heads/master
2023-02-11T16:26:15.143673
2020-12-24T17:44:59
2020-12-24T17:44:59
289,323,683
0
0
null
null
null
null
UTF-8
C++
false
false
375
cpp
#include "App.h" #include <Bengine/include/ScreenList.h> App::App() { //ctor } App::~App() { //dtor } void App::onInit(){ } void App::addScreens(){ m_gameplayScreen = std::make_unique<GameplayScreen>(&m_window); m_screenList->addScreen(m_gameplayScreen.get()); m_screenList->setScreen(m_gameplayScreen->getScreenIndex()); } void App::onExit(){ }
[ "36633619+Alejandro-Casanova@users.noreply.github.com" ]
36633619+Alejandro-Casanova@users.noreply.github.com
2fa9054b71d3ed180255c09d30aa724fed625665
603eefc58befb614aae826b7340f02a43980c108
/Source/Library/RTCOP/DependentCode/ExecuteLayerdObjectFinalizer.h
f7d16915356710269db4afe046b89c606697c8e3
[]
no_license
tanigawaikuta/RTCOP
b5e6c7b58e02b0620af1715e77d2ebe270c74dfe
fbb5f8e08a824b3c4f20279bcc52b9cd67e62f44
refs/heads/master
2023-05-13T08:31:56.069954
2021-06-01T07:36:47
2021-06-01T07:36:47
277,475,195
3
1
null
2021-06-01T07:36:51
2020-07-06T07:40:58
C#
UTF-8
C++
false
false
814
h
//================================================================================ // ExecuteLayerdObjectFinalizer.h // // 役割: レイヤードなオブジェクトのファイナライザを実行するための関数を提供する。 // この関数の実装は、プラットフォームによって異なる。 //================================================================================ #ifndef __RTCOP_DEPENDENTCODE_EXECUTELAYERDOBJECTFINALIZER__ #define __RTCOP_DEPENDENTCODE_EXECUTELAYERDOBJECTFINALIZER__ namespace RTCOP { namespace DependentCode { // LayerdObjectのFinalizer実行 void ExecuteLayerdObjectFinalizer(void* layerdObject, volatile void* finalizer); } // namespace DependentCode {} } // namespace RTCOP {} #endif // !__RTCOP_DEPENDENTCODE_EXECUTELAYERDOBJECTFINALIZER__
[ "tanigawaikuta@gmail.com" ]
tanigawaikuta@gmail.com
1c812224916c80381ebea9df26b1d096204317cb
2d1f82fe5c4818ef1da82d911d0ed81a0b41ec85
/codeforces/gym/Petrozavodsk Winter Training Camp, Saratov SU Contest 2017/CF101741L.cpp
76cda8e79a3950308eb986ef72dda7ef6e6d6854
[]
no_license
OrigenesZhang/-1s
d12bad12dee37d4bb168647d7b888e2e198e8e56
08a88e4bb84b67a44eead1b034a42f5338aad592
refs/heads/master
2020-12-31T00:43:17.972520
2020-12-23T14:56:38
2020-12-23T14:56:38
80,637,191
4
1
null
null
null
null
UTF-8
C++
false
false
2,824
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++) #define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--) #define REP(i, n) FOR(i, 0, (n)-1) #define sqr(x) ((x) * (x)) #define all(x) (x).begin(), (x).end() #define reset(x, y) memset(x, y, sizeof(x)) #define uni(x) (x).erase(unique(all(x)), (x).end()) #define BUG(x) cerr << #x << " = " << (x) << endl #define pb push_back #define eb emplace_back #define mp make_pair #define _1 first #define _2 second #define chkmin(a, b) a = min(a, b) #define chkmax(a, b) a = max(a, b) const int maxn = 212345; vector<int> G[maxn], adj[maxn]; vector<pii> T[maxn]; vector<int> lis[maxn]; int n, m; int u[maxn], v[maxn], w[maxn], pre[maxn], deg[maxn], ans[maxn], dep[maxn]; int anc[maxn][20]; ll f[maxn]; int lca(int a, int b) { if (dep[a] > dep[b]) swap(a, b); ROF(i, 18, 0) if (dep[anc[b][i]] >= dep[a]) b = anc[b][i]; if (a == b) return a; ROF(i, 18, 0) if (anc[a][i] != anc[b][i]) a = anc[a][i], b = anc[b][i]; return anc[a][0]; } int dfs(int x, int i) { int tot = 0; for (auto _ : T[x]) { int j = _._1, y = _._2; tot += dfs(y, j); } tot++; return ans[i] = tot; } int main() { scanf("%d%d", &n, &m); FOR(i, 1, m) { scanf("%d%d%d", u + i, v + i, w + i); G[u[i]].eb(i); G[v[i]].eb(i); } reset(f, 0x3f); f[1] = 0; set<pair<ll, int>> q; q.emplace(f[1], 1); while (!q.empty()) { auto now = *q.begin(); q.erase(q.begin()); ll d = now._1; int x = now._2; if (f[x] != d) continue; for (auto i : G[x]) { int y = u[i] ^ v[i] ^ x, c = w[i]; if (f[y] > f[x] + c) { pre[y] = i; f[y] = f[x] + c; q.emplace(f[y], y); } } } set<int> s; FOR(i, 1, n) if (pre[i]) { int j = u[pre[i]] ^ v[pre[i]] ^ i; adj[j].eb(pre[i]); deg[i]++; s.emplace(pre[i]); } FOR(i, 1, m) if (!s.count(i)) { int x = u[i], y = v[i], c = w[i]; if (f[x] > f[y]) swap(x, y); if (f[y] == f[x] + c) { adj[x].eb(i); deg[y]++; } } queue<int> que; que.emplace(1); dep[1] = 1; while (!que.empty()) { int x = que.front(); que.pop(); for (auto i : adj[x]) { int y = u[i] ^ v[i] ^ x; lis[y].eb(x); if (!--deg[y]) { if (lis[y].size() == 1) { T[x].eb(i, y); anc[y][0] = x; dep[y] = dep[x] + 1; } else { int a = lca(lis[y][0], lis[y][1]); FOR(j, 2, int(lis[y].size()) - 1) a = lca(a, lis[y][j]); T[a].eb(0, y); anc[y][0] = a; dep[y] = dep[a] + 1; } FOR(j, 1, 18) anc[y][j] = anc[anc[y][j - 1]][j - 1]; que.emplace(y); } } } dfs(1, 0); FOR(i, 1, m) printf("%d\n", ans[i]); }
[ "zhangbin199807@gmail.com" ]
zhangbin199807@gmail.com
bcb23788265b1c147d12b7549a090326f5708646
91f0a562bd2672febf99040d4bca1b8fcfd2c179
/misakalovelibrary/src/main/cpp/libeditcore/video_effect_core.h
7d5092361fd7159a1ba71fbef7758c826462038b
[]
no_license
JabamiLight/MisakaLove
5af77bfb77bbc628e356532b2397caa13115ddc1
c2d9a7426345141cfc8440a710881f56f8f4ebb8
refs/heads/master
2020-03-23T09:56:07.448090
2019-02-12T03:02:49
2019-02-12T03:02:49
141,415,756
1
2
null
null
null
null
UTF-8
C++
false
false
1,362
h
// // Created by TY on 2018/7/25. // #ifndef MISAKALOVE_VIDEO_EFFECT_PROGRAM_H #define MISAKALOVE_VIDEO_EFFECT_PROGRAM_H #define LOG_TAG "VideoEffectCore" #include "../opengl/program.h" #include <list> #include <GLES2/gl2ext.h> #include "common/camera_preview_program.h" #include "../libcommon/CommonTools.h" #include "../3rdparty/facedet/detector.h" #include "filter/cool_filter.h" #include "../3rdparty/facedet/face.h" #include "beauty/beauty_filter.h" #include <map> #define EFFECT_FILTER 1 #define EFFECT_BEAUTY 2 #define EFFECT_STICKER 3 using namespace std; class VideoEffectCore { private: map<int,Program*> filterPrograms; Program* copyCommonProgram; GLuint* processTextureIds; GLuint cameraTextureId; uint8_t processTextureIndex=0; GLuint FBO; jint degress; bool isVFilp; int textureWidth,textureHeight; public: void init(jint textureWidth, bool textureHeight, int i, int i1); void initTexture(); void initPbo(); void process(); void addFilter(Program *program, int i); GLuint getAfterTextureId(); GLuint getESTextureId(); virtual ~VideoEffectCore(); void clearFilter(); /** * 设置人脸数据给program */ void setFaceInfo(Face* face); void *ptr; void setBeautyPara(BeautyPara &i); }; #endif //MISAKALOVE_VIDEO_EFFECT_PROGRAM_H
[ "568478312@qq.com" ]
568478312@qq.com
8784c08929767b821170990ad43b1272e89fb222
981fcc98d4509488697c932ca5fa5e554a98ea7a
/image_util/Bounds.cpp
912319056a116315333ece08e370d27aaf40bc3e
[]
no_license
marknemm/Switchless
fe50c43f492bd101167d3db9976f6a85c63a63b0
1214eddcf17ba88f8cadb0e8303041311b291057
refs/heads/master
2020-03-15T13:52:43.304353
2018-05-04T18:46:50
2018-05-04T18:46:50
132,177,327
0
0
null
null
null
null
UTF-8
C++
false
false
338
cpp
#include "Bounds.h" using namespace cv; cv::Rect Bounds::qRectToCvRect(const QRect &qRect) { cv::Rect cvRect(qRect.x(), qRect.y(), qRect.width(), qRect.height()); return cvRect; } QRect Bounds::cvRectToQRect(const cv::Rect &cvRect) { return QRect(cvRect.x, cvRect.y, cvRect.width, cvRect.height); } Bounds::Bounds(){}
[ "marknemm@buffalo.edu" ]
marknemm@buffalo.edu
1e23c85e2ac4cbeabaf47240458593e953d56482
1917cc3414598031b02f6530a48af20ccc5dd2a6
/kodilib/src/widgets/KButton.cpp
1bc5bb1eba1f7db39bbf65e2564646c48e74fe75
[ "LicenseRef-scancode-warranty-disclaimer", "Unlicense" ]
permissive
Mistress-Anna/kiki
8cebcf4b7b737bb214bbea8908bbdc61bc325cb5
2f615044d72de6b3ca869e2230abdd0aced2aa00
refs/heads/master
2022-04-29T16:34:45.812039
2018-06-24T09:13:39
2020-01-04T23:38:22
42,407,357
2
1
Unlicense
2022-03-16T08:11:09
2015-09-13T18:23:04
C++
UTF-8
C++
false
false
1,911
cpp
/* * KButton.cpp * kodisein */ #include "KButton.h" #include "KConsole.h" #include "KColor.h" KDL_CLASS_INTROSPECTION_2 (KButton, KLabel, KNotificationObject) // -------------------------------------------------------------------------------------------------------- KButton::KButton ( const std::string & n ) : KLabel(n) { flags[KDL_WIDGET_FLAG_FIXED_SIZE] = false; flags[KDL_WIDGET_FLAG_FRAMED] = true; } // -------------------------------------------------------------------------------------------------------- void KButton::setPicked ( bool p ) { if (p) activate(); //picked = p; } // -------------------------------------------------------------------------------------------------------- void KButton::activate() { picked = true; notifyReceivers(); notifyReceivers(true); notifyReceivers(text); } // -------------------------------------------------------------------------------------------------------- void KButton::deactivate () { picked = false; notifyReceivers(false); } // -------------------------------------------------------------------------------------------------------- KColor * KButton::getFGColor () const { if (fg_color) return fg_color; if (parent) return parent->getFGColor(); return NULL; } // -------------------------------------------------------------------------------------------------------- KColor * KButton::getBGColor () const { if (bg_color) return bg_color; if (parent) return parent->getBGColor(); return NULL; } // -------------------------------------------------------------------------------------------------------- void KButton::render () { glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT); if (picked) { glColor4f(1.0, 1.0, 1.0, 1.0); } else if (getFGColor()) { getFGColor()->glColor(); } KLabel::render(); glPopAttrib(); }
[ "monsterkodi@users.sourceforge.net" ]
monsterkodi@users.sourceforge.net
81710e3803eb8eba46dd8947c905b3a3412d3139
e4f90ba52e0f85412a372ca1f0e073f1b8bce1af
/DSA/DSAttractors.cpp
c8b3820dd3a93c8179c158dc4d6a2f2287877a5d
[]
no_license
3bab/DSAttractors
a68f0f21e2a02fc75980a754dc94d2ec20a148b1
2292decde7affa1e26931111074b5a4729ee6f8e
refs/heads/master
2023-08-13T06:42:29.137062
2021-10-05T09:56:37
2021-10-05T09:56:37
295,835,007
0
0
null
null
null
null
UTF-8
C++
false
false
22,269
cpp
#include "DSAttractors.h" using namespace sf; using namespace std; DSAttractors::DSAttractors() { setupText(); view.setCenter(Vector2f(0.0f, 0.0f)); view.setSize(Vector2f(static_cast<float>(screenWidth / 10), static_cast<float>(screenHeight / 10))); attractorConfig = { {10.0f, 30.0f, 8 / 3}, {1.24f, 1.1f, 4.4f, 3.21f}, {0.95f, 0.7f, 0.6f, 3.5f, 0.25f, 0.1f}, {0.3f, 1.0f}, {5.0f, -10.0f, -0.38f}, {1.4f}, {0.001f, 0.2f, 1.1f}, {0.4f, 0.175f}, {1.5f}, {0.2f} }; colours = { Color(115, 62, 101, 42), // 42 Color(255, 126, 210, 127), Color(109, 193, 202, 179), Color(135, 216, 10, 203), Color(125, 26, 133, 99), Color(8, 161, 163, 57), Color(134, 184, 38, 183), Color(132, 159, 149, 188), Color(100, 195, 167, 160), Color(190, 242, 126, 252), }; trailColoursParams = { {61.3f, 62.1f, 33.9f}, {-65.5125f, -27.8521f, -97.0907f}, {-47.3382f, -49.5409f, -33.8347f}, {-12.9346f, -76.7609f, 70.7356f}, {-12.0673f, 51.6949f, 97.4566f}, {93.4094f, -16.196f, 40.8949f}, {-37.5288f, -31.3912f, -48.0061f}, {-5.6245f, -49.0192f, 19.271f}, {98.011f, -81.8857f, -80.084f}, {44.3435f, -93.5679f, -52.0752f}, }; cout << "\n\n\n"; for (unsigned c = 0; c < colours.size(); c++) { cout << static_cast<int>(colours[c].r) << " " << static_cast<int>(colours[c].g) << " " << static_cast<int>(colours[c].b) << " " << static_cast<int>(colours[c].a) << endl; cout << trailColoursParams[c][0] << " " << trailColoursParams[c][1] << " " << trailColoursParams[c][2] << endl; } circle.resize(numPoints); point.resize(numPoints); trail.resize(numPoints); // Create trial trackers for (unsigned i = 0; i < numPoints; i++) { j.push_back(0); } createBalls(); // Create lineStrip object with two vertices. The first line should start with a first point. line.setPrimitiveType(LinesStrip); line.append(Vector2f(point[0].x, point[0].y)); line.append(Vector2f(point[0].x, point[0].y)); initiateCamera(); } void DSAttractors::initiateCamera() {// Set Camera switch (attractorIndex) { case 0: { camPosition = {0, 0, -50}; camAngle = {0, 0, 0}; break; } case 1: { camPosition = {1.07676f, 0.3f, -0.447995f}; camAngle = {0.1f, 4.84f, 0.0f}; break; } case 2: { camPosition = {2.25, 0, 0.75}; camAngle = {0, -PI / 2, 0}; break; } case 3: { camPosition = {-7.5, 5, -15}; camAngle = {0, PI / 6, 0}; break; } case 4: { camPosition = {51.310f, -4.8f, 25.151f}; camAngle = {-0.16f, -2.1f, 0.0f}; break; } case 5: { camPosition = {-23.357f, -16.4f, -20.731f}; camAngle = {-0.5f, -5.48f, 0.0f}; break; } case 6: { camPosition = {1.0216f, -5.7f, 6.1861f}; camAngle = {-0.16f, 3.34f, 0.0f}; break; } case 7: { camPosition = {0, 0, -0.5}; camAngle = {0, 0, -0.134f}; break; } case 8: { camPosition = {-0.14397f, -8.4f, -1.3497f}; camAngle = {-1.66f, -2.94f, 0}; break; } case 9: { camPosition = {7.1565f, 4.2f, 2.6844f}; camAngle = {0.48f, -1.92f, 0}; break; } } } void DSAttractors::createBalls() { for (unsigned i = 0; i < numPoints; i++) { // Create balls circle[i].setRadius(0.5f); circle[i].setOrigin(circle[i].getRadius(), circle[i].getRadius()); circle[i].setFillColor(colours[attractorIndex]); // Set initial positions point[i] = {getRandomNumber(1.0f, 1.0f), getRandomNumber(1.0f, 1.0f), getRandomNumber(1.0f, 1.0f)}; // Create trails trail[i].resize(trailLength); for (auto &pos : trail[i]) { pos = point[i]; } } } void DSAttractors::setupText() { font.loadFromFile("/Users/gintas.palionis/CLionProjects/DSAttractors/arial.ttf"); text.setFont(font); text.setFillColor(Color(100, 0, 0, 255)); text.setString(attractorNames[attractorIndex]); text.setScale(0.1f, 0.1f); text.setPosition(Vector2f(-85, -45)); text.setStyle(0); } void DSAttractors::input(RenderWindow &window) { while (window.pollEvent(event)) { // Window if (Keyboard::isKeyPressed(Keyboard::Escape)) endSubProgram = true; if (Keyboard::isKeyPressed(Keyboard::F)) { isFullscreen = !isFullscreen; window.create(VideoMode(static_cast<int>(screenWidth), static_cast<int>(screenHeight)), "Coding Projects", (isFullscreen ? Style::Fullscreen : Style::Default), ContextSettings()); window.setPosition(Vector2i(0, 0)); window.setVerticalSyncEnabled(true); window.setFramerateLimit(60); } if ((Keyboard::isKeyPressed(Keyboard::H) || Keyboard::isKeyPressed(Keyboard::G)) && inputTimer >= 0.1) { inputTimer = 0; if (Keyboard::isKeyPressed(Keyboard::H)) { attractorIndex++; if (attractorIndex == attractorConfig.size()) attractorIndex--; } else { attractorIndex--; if (attractorIndex == -1) attractorIndex++; } switch (attractorIndex) { case 0: { camPosition = {0, 0, -50}; camAngle = {0, 0, 0}; break; } case 1: { camPosition = {1.07676f, 0.3f, -0.447995f}; camAngle = {0.1f, 4.84f, 0.0f}; break; } case 2: { camPosition = {2.25, 0, 0.75}; camAngle = {0, -PI / 2, 0}; break; } case 3: { camPosition = {-7.5, 5, -15}; camAngle = {0, PI / 6, 0}; break; } case 4: { camPosition = {51.310f, -4.8f, 25.151f}; camAngle = {-0.16f, -2.1f, 0}; break; } case 5: { camPosition = {-23.357f, -16.4f, -20.731f}; camAngle = {-0.5f, -5.48f, 0.0f}; break; } case 6: { camPosition = {1.0216f, -5.7f, 6.1861f}; camAngle = {-0.16f, 3.34f, 0.0f}; break; } case 7: { camPosition = {0, 0, -0.5}; camAngle = {0, 0, 0}; break; } case 8: { camPosition = {-0.1439f, -8.4f, -1.3497f}; camAngle = {-1.66f, -2.94f, 0}; break; } case 9: { camPosition = {7.1565f, 4.2f, 2.6844f}; camAngle = {0.48f, -1.92f, 0}; break; } } const float max = 0.001f; const float min = -max; for (unsigned i = 0; i < numPoints; i++) { circle[i].setFillColor(colours[attractorIndex]); point[i] = {getRandomNumber(min, max), getRandomNumber(min, max), getRandomNumber(min, max)}; } for (unsigned i = 0; i < numPoints; i++) { for (auto &pos : trail[i]) pos = point[i]; } text.setString(attractorNames[attractorIndex]); } } } void DSAttractors::update() { /// Calculate timeStep timeStep = clock.getElapsedTime().asSeconds(); inputTimer += timeStep; clock.restart(); timeStep *= speed; // Slow down or speed up time. // Update position according to chosen equation attractorIndex vector<float> &attractorParams = attractorConfig.at(attractorIndex); switch (attractorIndex) { case 0: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>(attractorParams[0] * (point[i].y - point[i].x) * timeStep); point[i].y += static_cast<float>((point[i].x * (attractorParams[1] - point[i].z) - point[i].y) * timeStep); point[i].z += static_cast<float>((point[i].x * point[i].y - attractorParams[2] * point[i].z) * timeStep); } break; } case 1: { for (unsigned i = 0; i < numPoints; i++) { float h1 = 0.5f * (abs(point[i].x + 1) - abs(point[i].x - 1)); float h2 = 0.5f * (abs(point[i].y + 1) - abs(point[i].y - 1)); float h3 = 0.5f * (abs(point[i].z + 1) - abs(point[i].z - 1)); point[i].x += static_cast<float>( (-point[i].x + attractorParams[0] * h1 - attractorParams[3] * h2 - attractorParams[3] * h3) * timeStep); point[i].y += static_cast<float>( (-point[i].y - attractorParams[3] * h1 + attractorParams[1] * h2 - attractorParams[2] * h3) * timeStep); point[i].z += static_cast<float>( (-point[i].z - attractorParams[3] * h1 + attractorParams[2] * h2 + h3) * timeStep); } break; } case 2: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>( ((point[i].z - attractorParams[1]) * point[i].x - attractorParams[3] * point[i].y) * timeStep); point[i].y += static_cast<float>( (attractorParams[3] * point[i].x + (point[i].z - attractorParams[1]) * point[i].y) * timeStep); point[i].z += static_cast<float>( (attractorParams[2] + attractorParams[0] * point[i].z - (point[i].z * point[i].z * point[i].z) / 3 - (point[i].x * point[i].x + point[i].y * point[i].y) * (1 + attractorParams[4] * point[i].z) + attractorParams[5] * point[i].z * point[i].x * point[i].x * point[i].x) * timeStep); } break; } case 3: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>((point[i].x * (4 - point[i].y) + attractorParams[0] * point[i].z) * timeStep); point[i].y += static_cast<float>((-point[i].y * (1 - point[i].x * point[i].x)) * timeStep); point[i].z += static_cast<float>( (-point[i].x * (1.5 - point[i].z * attractorParams[1]) - 0.05 * point[i].z) * timeStep); } break; } case 4: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>((attractorParams[0] * point[i].x - point[i].y * point[i].z) * timeStep * 0.25f); point[i].y += static_cast<float>((attractorParams[1] * point[i].y + point[i].x * point[i].z) * timeStep * 0.25f); point[i].z += static_cast<float>((attractorParams[2] * point[i].z + point[i].x * point[i].y / 3) * timeStep * 0.25f); } break; } case 5: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>( (-attractorParams[0] * point[i].x - 4 * point[i].y - 4 * point[i].z - point[i].y * point[i].y) * timeStep); point[i].y += static_cast<float>( (-attractorParams[0] * point[i].y - 4 * point[i].z - 4 * point[i].x - point[i].z * point[i].z) * timeStep); point[i].z += static_cast<float>( (-attractorParams[0] * point[i].z - 4 * point[i].x - 4 * point[i].y - point[i].x * point[i].x) * timeStep); } break; } case 6: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>( ((1 / attractorParams[1] - attractorParams[0]) * point[i].x + point[i].z + point[i].x * point[i].y) * timeStep); point[i].y += static_cast<float>((-attractorParams[1] * point[i].y - point[i].x * point[i].x) * timeStep); point[i].z += static_cast<float>((-point[i].x - attractorParams[2] * point[i].z) * timeStep); } break; } case 7: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>( (-attractorParams[0] * point[i].x + point[i].y + 10.0f * point[i].y * point[i].z) * timeStep); point[i].y += static_cast<float>((-point[i].x - 0.4 * point[i].y + 5.0f * point[i].x * point[i].z) * timeStep); point[i].z += static_cast<float>((attractorParams[1] * point[i].z - 5.0f * point[i].x * point[i].y) * timeStep); } break; } case 8: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>((point[i].y) * timeStep); point[i].y += static_cast<float>((-point[i].x + point[i].y * point[i].z) * timeStep); point[i].z += static_cast<float>((attractorParams[0] - point[i].y * point[i].y) * timeStep); } break; } case 9: { for (unsigned i = 0; i < numPoints; i++) { point[i].x += static_cast<float>((-attractorParams[0] * point[i].x + sin(point[i].y)) * timeStep); point[i].y += static_cast<float>((-attractorParams[0] * point[i].y + sin(point[i].z)) * timeStep); point[i].z += static_cast<float>((-attractorParams[0] * point[i].z + sin(point[i].x)) * timeStep); } break; } } // Move Left and Right if (Keyboard::isKeyPressed(Keyboard::A)) { camPosition.x -= sin(camAngle[1] + PI / 2.0f) * 0.25f; camPosition.z -= cos(camAngle[1] + PI / 2.0f) * 0.25f; } if (Keyboard::isKeyPressed(Keyboard::D)) { camPosition.x += sin(camAngle[1] + PI / 2.0f) * 0.25f; camPosition.z += cos(camAngle[1] + PI / 2.0f) * 0.25f; } // Move Forwards and Backwards if (Keyboard::isKeyPressed(Keyboard::S)) { camPosition.z -= cos(camAngle[1]) * 0.25f; camPosition.x -= sin(camAngle[1]) * 0.25f; } if (Keyboard::isKeyPressed(Keyboard::W)) { camPosition.z += cos(camAngle[1]) * 0.25f; camPosition.x += sin(camAngle[1]) * 0.25f; } // Move Up and Down if (Keyboard::isKeyPressed(Keyboard::LShift)) camPosition.y += 0.1f; if (Keyboard::isKeyPressed(Keyboard::Space)) camPosition.y -= 0.1f; /// Update Camera Angle // Look Left and Right if (Keyboard::isKeyPressed(Keyboard::Left)) camAngle[1] -= 0.003f; if (Keyboard::isKeyPressed(Keyboard::Right)) camAngle[1] += 0.003f; // Look Up and Down if (Keyboard::isKeyPressed(Keyboard::Up)) camAngle[0] += 0.003f; if (Keyboard::isKeyPressed(Keyboard::Down)) camAngle[0] -= 0.003f; /// Compute Rotation Matrixes rotMatrixX = { {1, 0, 0}, {0, cos(camAngle[0]), sin(camAngle[0])}, {0, -sin(camAngle[0]), cos(camAngle[0])} }; rotMatrixY = { {cos(camAngle[1]), 0, -sin(camAngle[1])}, {0, 1, 0}, {sin(camAngle[1]), 0, cos(camAngle[1])} }; rotMatrixZ = { {cos(camAngle[2]), sin(camAngle[2]), 0}, {-sin(camAngle[2]), cos(camAngle[2]), 0}, {0, 0, 1} }; // Change speed if (Keyboard::isKeyPressed(Keyboard::PageUp)) speed += 0.025f; if (Keyboard::isKeyPressed(Keyboard::PageDown)) speed -= 0.025f; } void DSAttractors::draw(RenderWindow &window) { // For every point for (unsigned g = 0; g < numPoints; g++) { /// Draw circle // Projection maths Vector3f d; d = point[g] - camPosition; d = rotMatrixX * (rotMatrixY * (rotMatrixZ * d)); // Only if the point is infront of the camera if (d.z >= 0) { projectedPoint = { displayPosition.z * d.x / d.z + displayPosition.x, displayPosition.z * d.y / d.z + displayPosition.y }; circle[g].setPosition(Vector2f(projectedPoint.x, projectedPoint.y)); window.draw(circle[g]); } /// Draw trail /* The point of this algorithm is to use indexes in a clever manner in order to avoid shifting every previous position one across in "trail" every frame, which takes a lot of time. It flows like a "shifting" >for< loop. */ trail[g][j[g]] = point[g]; // Add most recent position to trail at index j[g] j[g]++; // j[g] incremented every frame, shifting the beginning of the for loop. if (j[g] == trail[g].size() - 1) { // If j[g] gets to the final index, set it to 0 j[g] = 0; trail[g][trail[g].size() - 1] = trail[g][trail[g].size() - 2]; // This has to be done. } int k = 0; // Index that goes from 0 to numPoints, used for colour // Starting from the index i right after j[g], then from 0 all the way to j[g]. int i = j[g] + 1; while (i != j[g]) { // Project the front end of the trail Vector3f d1; d1 = trail[g][i] - camPosition; d1 = rotMatrixX * (rotMatrixY * (rotMatrixZ * d1)); Vector2f proj1; proj1 = {displayPosition.z * d1.x / d1.z + displayPosition.x, displayPosition.z * d1.y / d1.z + displayPosition.y}; line[0].position = proj1; // Project the back end of the trail Vector3f d2; if (i == 0) d2 = trail[g][trail[g].size() - 2] - camPosition; else d2 = trail[g][i - 1] - camPosition; d2 = rotMatrixX * (rotMatrixY * (rotMatrixZ * d2)); Vector2f proj2; proj2 = {displayPosition.z * d2.x / d2.z + displayPosition.x, displayPosition.z * d2.y / d2.z + displayPosition.y}; line[1].position = proj2; // Calculate trail colours Color fade; fade = Color( clamp(colours[attractorIndex].r + trailColoursParams[attractorIndex][0] * Magnitude(line[1].position - line[0].position)), clamp(colours[attractorIndex].g + trailColoursParams[attractorIndex][1] * Magnitude(line[1].position - line[0].position)), clamp(colours[attractorIndex].b + trailColoursParams[attractorIndex][2] * Magnitude(line[1].position - line[0].position)), 0 + static_cast<Uint8>((k * 255 / trail[g].size()))); line[0].color = fade; line[1].color = fade; // Draw if both the front and end of the trail are in front of the camera if (d1.z >= 0 && d2.z >= 0) window.draw(line); // Increment counters i++; if (i == trail[g].size()) // Set i to 0 once it gets to the end of "trail" i = 0; k++; } } text.setString(attractorNames[attractorIndex]); text.setScale(0.1f, 0.1f); text.setPosition(Vector2f(-85, -45)); window.draw(text); /// UNCOMMENT FOR ON-SCREEN COORDINATES /* for (unsigned i = 0; i < numPoints; i++) { string coordinate_string = "(" + to_string(static_cast<int>(point[i].x)) + ", " + to_string(static_cast<int>(point[i].y)) + ", " + to_string(static_cast<int>(point[i].z)) + ")"; text.setString(coordinate_string); text.setPosition(circle[i].getPosition() + Vector2f(1.0f, -5.0f)); window.draw(text); } */ window.display(); window.clear(Color(0, 0, 0, 255)); } void DSAttractors::run(RenderWindow &window) { window.setView(view); while (window.isOpen() && !endSubProgram) { this->input(window); // Get Input this->update(); // Update Graphics this->draw(window); // Draw Graphics } window.setView(View(Vector2f(static_cast<float>(screenWidth / 2), static_cast<float>(screenHeight / 2)), Vector2f(static_cast<float>(screenWidth), static_cast<float>(screenHeight)))); } DSAttractors::~DSAttractors() {}
[ "gintas.palionis@gmail.com" ]
gintas.palionis@gmail.com
b24c6649ce457c9828ea65170ede2780c4b8d4e1
666765fbc0275e8dd38580ba7911b199b74c7d2c
/tests/UnitTests/TestTransfersSubscription.cpp
32c0c2681cdc2928eb6a718b34426e4f0e28e59d
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
nixtechie49/4xbitcoin
66b579580662db6280836eb0b02068e0b5b9fe5c
a92535b8f04d56705aaf82581200870823deef5b
refs/heads/master
2020-04-28T18:31:26.314639
2019-03-13T19:29:58
2019-03-13T19:29:58
175,481,543
0
0
null
2019-03-13T18:58:06
2019-03-13T18:58:05
null
UTF-8
C++
false
false
4,876
cpp
/* * Copyright (c) 2018-2019, The Mybtcfx Developers. * Portions Copyright (c) 2012-2017, The CryptoNote Developers, The Bytecoin Developers. * * This file is part of 4xBIT. * * This file is subject to the terms and conditions defined in the * file 'LICENSE', which is part of this source code package. */ #include "gtest/gtest.h" #include <tuple> #include "CryptoNoteCore/TransactionApi.h" #include "Logging/ConsoleLogger.h" #include "Transfers/TransfersSubscription.h" #include "Transfers/TypeHelpers.h" #include "ITransfersContainer.h" #include "TransactionApiHelpers.h" #include "TransfersObserver.h" using namespace CryptoNote; namespace { const uint32_t UNCONFIRMED_TRANSACTION_HEIGHT = std::numeric_limits<uint32_t>::max(); const uint32_t UNCONFIRMED = std::numeric_limits<uint32_t>::max(); std::error_code createError() { return std::make_error_code(std::errc::invalid_argument); } class TransfersSubscriptionTest : public ::testing::Test { public: TransfersSubscriptionTest() : currency(CurrencyBuilder(m_logger).currency()), account(generateAccountKeys()), syncStart(SynchronizationStart{ 0, 0 }), sub(currency, m_logger, AccountSubscription{ account, syncStart, 10 }) { sub.addObserver(&observer); } std::shared_ptr<ITransactionReader> addTransaction(uint64_t amount, uint32_t height, uint32_t outputIndex) { TestTransactionBuilder b1; auto unknownSender = generateAccountKeys(); b1.addTestInput(amount, unknownSender); auto outInfo = b1.addTestKeyOutput(amount, outputIndex, account); auto tx = std::shared_ptr<ITransactionReader>(b1.build().release()); std::vector<TransactionOutputInformationIn> outputs = { outInfo }; sub.addTransaction(TransactionBlockInfo{ height, 100000 }, *tx, outputs); return tx; } Logging::ConsoleLogger m_logger; Currency currency; AccountKeys account; SynchronizationStart syncStart; TransfersSubscription sub; TransfersObserver observer; }; } TEST_F(TransfersSubscriptionTest, getInitParameters) { ASSERT_EQ(syncStart.height, sub.getSyncStart().height); ASSERT_EQ(syncStart.timestamp, sub.getSyncStart().timestamp); ASSERT_EQ(account.address, sub.getAddress()); ASSERT_EQ(account, sub.getKeys()); } TEST_F(TransfersSubscriptionTest, addTransaction) { auto tx1 = addTransaction(10000, 1, 0); auto tx2 = addTransaction(10000, 2, 1); // this transaction should not be added, so no notification auto tx = createTransaction(); addTestInput(*tx, 20000); sub.addTransaction(TransactionBlockInfo{ 2, 100000 }, *tx, {}); ASSERT_EQ(2, sub.getContainer().transactionsCount()); ASSERT_EQ(2, observer.updated.size()); ASSERT_EQ(tx1->getTransactionHash(), observer.updated[0]); ASSERT_EQ(tx2->getTransactionHash(), observer.updated[1]); } TEST_F(TransfersSubscriptionTest, onBlockchainDetach) { addTransaction(10000, 10, 0); auto txHash = addTransaction(10000, 11, 1)->getTransactionHash(); ASSERT_EQ(2, sub.getContainer().transactionsCount()); sub.onBlockchainDetach(11); ASSERT_EQ(1, sub.getContainer().transactionsCount()); ASSERT_EQ(1, observer.deleted.size()); ASSERT_EQ(txHash, observer.deleted[0]); } TEST_F(TransfersSubscriptionTest, onError) { auto err = createError(); addTransaction(10000, 10, 0); addTransaction(10000, 11, 1); ASSERT_EQ(2, sub.getContainer().transactionsCount()); sub.onError(err, 12); ASSERT_EQ(2, sub.getContainer().transactionsCount()); ASSERT_EQ(1, observer.errors.size()); ASSERT_EQ(std::make_tuple(12, err), observer.errors[0]); sub.onError(err, 11); ASSERT_EQ(1, sub.getContainer().transactionsCount()); // one transaction should be detached ASSERT_EQ(2, observer.errors.size()); ASSERT_EQ(std::make_tuple(12, err), observer.errors[0]); ASSERT_EQ(std::make_tuple(11, err), observer.errors[1]); } TEST_F(TransfersSubscriptionTest, advanceHeight) { ASSERT_TRUE(sub.advanceHeight(10)); ASSERT_FALSE(sub.advanceHeight(9)); // can't go backwards } TEST_F(TransfersSubscriptionTest, markTransactionConfirmed) { auto txHash = addTransaction(10000, UNCONFIRMED_TRANSACTION_HEIGHT, UNCONFIRMED)->getTransactionHash(); ASSERT_EQ(1, sub.getContainer().transactionsCount()); ASSERT_EQ(1, observer.updated.size()); // added sub.markTransactionConfirmed(TransactionBlockInfo{ 10, 100000 }, txHash, { 1 }); ASSERT_EQ(2, observer.updated.size()); // added + updated ASSERT_EQ(txHash, observer.updated[0]); } TEST_F(TransfersSubscriptionTest, deleteUnconfirmedTransaction) { auto txHash = addTransaction(10000, UNCONFIRMED_TRANSACTION_HEIGHT, UNCONFIRMED)->getTransactionHash(); ASSERT_EQ(1, sub.getContainer().transactionsCount()); sub.deleteUnconfirmedTransaction(txHash); ASSERT_EQ(0, sub.getContainer().transactionsCount()); ASSERT_EQ(1, observer.deleted.size()); ASSERT_EQ(txHash, observer.deleted[0]); }
[ "33263353+mybtcfx@users.noreply.github.com" ]
33263353+mybtcfx@users.noreply.github.com
cd50527672973dec7d2f37fa822b8b9ab666da98
e12b5ffa7153c58c16e25cd4475189f56e4eb9d1
/Explanation2/P2296.cpp
c94cf6dd032edcf1efdab30c6fee22ac83a6784a
[]
no_license
hhhnnn2112-Home/NOI-ACcode-Explanation
ef1cdf60504b3bd01ba96f93519dde5aa1aec7ad
821b08584b804a2ae425f3f7294cc99bd87c9f5b
refs/heads/main
2023-02-01T02:20:00.421990
2020-12-15T10:11:22
2020-12-15T10:11:22
321,634,613
1
0
null
2020-12-15T10:36:22
2020-12-15T10:36:21
null
UTF-8
C++
false
false
1,235
cpp
#include<bits/stdc++.h> using namespace std; int a[400050],b[400050]; struct edge { int ver,nxt; }z[400050],f[400050]; int head1[400050],head2[400050],cnt; void add1(int x,int y) { cnt++; z[cnt]=(edge){y,head1[x]}; head1[x]=cnt; } void add2(int x,int y) { cnt++; f[cnt]=(edge){y,head2[x]}; head2[x]=cnt; } int n,m; int s,t; void dfs(int x,int fa) { a[x]=1; for(int i=head2[x];i;i=f[i].nxt) { int y=f[i].ver; if(!a[y]) { dfs(y,x); } } } int d[100050]; void bfs(int st) { if(!b[st]) { printf("-1"); exit(0); } queue<int> q; q.push(st); d[st]=1; while(!q.empty()) { int x=q.front(); q.pop(); for(int i=head1[x];i;i=z[i].nxt) { int y=z[i].ver; if(b[y]&&!d[y]) { d[y]=d[x]+1; q.push(y); } } } } int main() { scanf("%d%d",&n,&m); for(int i=1;i<=m;i++) { int x,y; scanf("%d%d",&x,&y); if(a==b)continue; add1(x,y); add2(y,x); } scanf("%d%d",&s,&t); dfs(t,0); for(int i=1;i<=n;i++) { if(!a[i])continue; b[i]=1; for(int j=head1[i];j;j=z[j].nxt) { int y=z[j].ver; if(!a[y]) { b[i]=0; break; } } } bfs(s); printf("%d",d[t]-1); return 0; }
[ "48145116+hhhnnn2112@users.noreply.github.com" ]
48145116+hhhnnn2112@users.noreply.github.com
0238a389cce0ed8f818fceac574fc5edaf0c5c22
0782f9e1df8b7eb0e0e9be12b0dd596c5a117887
/include/Bloco.h
61b9c3335bb015ce04e5daca093c2046dda017e2
[]
no_license
gtroja/qjgo
4084642c23aa6af3c8ae661cad0abb5930159d24
e0b7b71be85c84b75fc8977f11e8ea401ebb4f4b
refs/heads/master
2020-07-01T15:09:21.791333
2019-10-02T04:06:50
2019-10-02T04:06:50
74,335,723
0
0
null
null
null
null
UTF-8
C++
false
false
682
h
#ifndef BLOCO_H #define BLOCO_H #include "Defines.h" #include "Coordenada.h" #include "Terreno.h" class Bloco{ public: Bloco(); //int setLimites(Bloco* lim); int mover(coordenada c); int crescer(coordenada c); int setPosicao(coordenada p); int setTamanho(coordenada t); //bool estaDentro(coordenada d); //bool estaDentro(Bloco *b); //bool estaFora(Bloco *b); Bloco colisao(Bloco* b); Bloco colisao(Terreno* t); coordenada getPosicao(); coordenada getTamanho(); //int verificaLimites(); protected: //bool estaEntre(coordenada la, coordenada lb, coordenada p); //bool estaDentro(Bloco b, coordenada p); coordenada posicao; coordenada tamanho; }; #endif
[ "guilhermetrojan@alunos.utfpr.edu.br" ]
guilhermetrojan@alunos.utfpr.edu.br
df1daeada37d4ab7bfae77c41d26a838555e1ed2
7a1663ae38245aa82d7be716ca33052a6ce1090f
/binding/matlab/Matlab_segmentCoM.h
a55362a495751dbec5dfc5095071b6e95f4e7f83
[ "MIT" ]
permissive
vincentdelpech/biorbd
9d10b22782723bc9b654e667b4e48298bef68cb5
0d7968e75e182f067a4d4c24cc15fa9a331ca792
refs/heads/master
2020-07-11T21:31:42.198425
2019-10-03T15:01:21
2019-10-03T15:01:21
204,647,893
0
0
MIT
2019-08-27T09:40:55
2019-08-27T07:40:52
null
UTF-8
C++
false
false
1,937
h
#ifndef BIORBD_MATLAB_SEGMENT_COM_H #define BIORBD_MATLAB_SEGMENT_COM_H #include <mex.h> #include "BiorbdModel.h" #include "class_handle.h" #include "processArguments.h" void Matlab_segmentCOM( int, mxArray *plhs[], int nrhs, const mxArray*prhs[] ){ // Verifier les arguments d'entrée checkNombreInputParametres(nrhs, 3, 4, "3 arguments are required (+1 optional) where the 2nd is the handler on the model, 3rd is the Q and 4th is the index of body segment"); // Recevoir le model biorbd::Model * model = convertMat2Ptr<biorbd::Model>(prhs[1]); unsigned int nQ = model->nbQ(); // Get the number of DoF // Recevoir Q biorbd::rigidbody::GeneralizedCoordinates Q = *getParameterQ(prhs, 2, nQ).begin(); // Recevoir le numéro du segment (optionnel) int i(0); if (nrhs==4) i = getInteger(prhs, 3); i -= 1; // -1 car le segment 0 est numéroté 1 sous matlab // Trouver la position du CoM if (i==-1){ std::vector<biorbd::rigidbody::NodeBone> COM = model->CoMbySegment(Q,true); // Create a matrix for the return argument plhs[0] = mxCreateDoubleMatrix( 3, model->nbBone(), mxREAL); // Remplir l'output double *tp = mxGetPr(plhs[0]); for (unsigned int j=0; j<model->nbBone(); ++j) for (unsigned int k=0; k<3; ++k) tp[3*j+k] = COM[j][k]; // Transférer le tout dans un tableau de sortie } else { biorbd::rigidbody::NodeBone COM = model->CoMbySegment(Q,static_cast<unsigned int>(i),true); // Create a matrix for the return argument plhs[0] = mxCreateDoubleMatrix( 3, 1, mxREAL); // Remplir l'output double *tp = mxGetPr(plhs[0]); for (unsigned int k=0; k<3; ++k) tp[k] = COM[k]; // Transférer le tout dans un tableau de sortie } return; } #endif // BIORBD_MATLAB_SEGMENT_COM_H
[ "pariterre@hotmail.com" ]
pariterre@hotmail.com
38cc2f39ff5486a4e0f5677e7c6cc296d47cfabe
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/collectd/old_hunk_285.cpp
7bcf7c053e8d38039e38765ed439e6cf86d7baa4
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
225
cpp
CPY_RELEASE_THREADS } static PyObject *cpy_register_generic(cpy_callback_t **list_head, PyObject *args, PyObject *kwds) { cpy_callback_t *c; const char *name = NULL; PyObject *callback = NULL, *data = NULL, *mod = NULL;
[ "993273596@qq.com" ]
993273596@qq.com
462a3599fb0a92544d863106b4ec44f4c35586dd
a8ee1337ed14fb4d47fea6510cdceb535c818e6c
/src/qt/statisticspage.cpp
4c11b6396e719573e899cb53c90b1c1403074016
[ "MIT" ]
permissive
Jspike1/SpikePrivateCoin
26e88438fdbe8c94ace6606501b2decdc76bb73c
3f5e2a571ad9a20c47e94907ef70265b37aa7c5b
refs/heads/master
2021-01-19T19:39:50.232345
2015-08-07T17:40:11
2015-08-07T17:40:11
39,851,648
0
2
null
2015-08-07T17:40:11
2015-07-28T18:43:51
C++
UTF-8
C++
false
false
5,115
cpp
#include "statisticspage.h" #include "ui_statisticspage.h" #include "main.h" #include "wallet.h" #include "init.h" #include "base58.h" #include "clientmodel.h" #include "bitcoinrpc.h" #include <sstream> #include <string> using namespace json_spirit; StatisticsPage::StatisticsPage(QWidget *parent) : QWidget(parent), ui(new Ui::StatisticsPage) { ui->setupUi(this); setFixedSize(400, 420); connect(ui->startButton, SIGNAL(pressed()), this, SLOT(updateStatistics())); } int heightPrevious = -1; int connectionPrevious = -1; int volumePrevious = -1; double rewardPrevious = -1; double netPawratePrevious = -1; double pawratePrevious = -1; double hardnessPrevious = -1; double hardnessPrevious2 = -1; int stakeminPrevious = -1; int stakemaxPrevious = -1; QString stakecPrevious = ""; void StatisticsPage::updateStatistics() { double pHardness = GetDifficulty(); double pHardness2 = GetDifficulty(GetLastBlockIndex(pindexBest, true)); int pPawrate = GetPoWMHashPS(); double pPawrate2 = 0.000; int nHeight = pindexBest->nHeight; double nSubsidy = 10; uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0; pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight); uint64_t nNetworkWeight = GetPoSKernelPS(); int64_t volume = ((pindexBest->nMoneySupply)/100000000); int peers = this->model->getNumConnections(); pPawrate2 = (double)pPawrate; QString height = QString::number(nHeight); QString stakemin = QString::number(nMinWeight); QString stakemax = QString::number(nNetworkWeight); QString phase = ""; if (pindexBest->nHeight < 1000) { phase = "Proof of Work"; } else if (pindexBest->nHeight < 2000) { phase = "Prof Of Work - Proof of Stake"; } else if (pindexBest->nHeight > 2000) { phase = "Proof of Stake"; } QString subsidy = QString::number(nSubsidy, 'f', 6); QString hardness = QString::number(pHardness, 'f', 6); QString hardness2 = QString::number(pHardness2, 'f', 6); QString pawrate = QString::number(pPawrate2, 'f', 3); QString Qlpawrate = model->getLastBlockDate().toString(); QString QPeers = QString::number(peers); QString qVolume = QLocale(QLocale::English).toString((qlonglong)volume); if(nHeight > heightPrevious) { ui->heightBox->setText("<b><font color=\"green\">" + height + "</font></b>"); } else { ui->heightBox->setText(height); } if(0 > stakeminPrevious) { ui->minBox->setText("<b><font color=\"green\">" + stakemin + "</font></b>"); } else { ui->minBox->setText(stakemin); } if(0 > stakemaxPrevious) { ui->maxBox->setText("<b><font color=\"green\">" + stakemax + "</font></b>"); } else { ui->maxBox->setText(stakemax); } if(phase != stakecPrevious) { ui->cBox->setText("<b><font color=\"green\">" + phase + "</font></b>"); } else { ui->cBox->setText(phase); } if(pHardness > hardnessPrevious) { ui->diffBox->setText("<b><font color=\"green\">" + hardness + "</font></b>"); } else { ui->diffBox->setText(hardness); } if(pHardness2 > hardnessPrevious2) { ui->diffBox2->setText("<b><font color=\"green\">" + hardness2 + "</font></b>"); } else { ui->diffBox2->setText(hardness2); } if(pPawrate2 > netPawratePrevious) { ui->pawrateBox->setText("<b><font color=\"green\">" + pawrate + " MH/s</font></b>"); } else { ui->pawrateBox->setText(pawrate + " MH/s"); } if(Qlpawrate != pawratePrevious) { ui->localBox->setText("<b><font color=\"green\">" + Qlpawrate + "</font></b>"); } else { ui->localBox->setText(Qlpawrate); } if(peers > connectionPrevious) { ui->connectionBox->setText("<b><font color=\"green\">" + QPeers + "</font></b>"); } else { ui->connectionBox->setText(QPeers); } if(volume > volumePrevious) { ui->volumeBox->setText("<b><font color=\"green\">" + qVolume + " SPC" + "</font></b>"); } else { ui->volumeBox->setText(qVolume + " SPC"); } updatePrevious(nHeight, nMinWeight, nNetworkWeight, phase, nSubsidy, pHardness, pHardness2, pPawrate2, Qlpawrate, peers, volume); } void StatisticsPage::updatePrevious(int nHeight, int nMinWeight, int nNetworkWeight, QString phase, double nSubsidy, double pHardness, double pHardness2, double pPawrate2, QString Qlpawrate, int peers, int volume) { heightPrevious = nHeight; stakeminPrevious = nMinWeight; stakemaxPrevious = nNetworkWeight; stakecPrevious = phase; rewardPrevious = nSubsidy; hardnessPrevious = pHardness; hardnessPrevious2 = pHardness2; netPawratePrevious = pPawrate2; pawratePrevious = Qlpawrate; connectionPrevious = peers; volumePrevious = volume; } void StatisticsPage::setModel(ClientModel *model) { updateStatistics(); this->model = model; } StatisticsPage::~StatisticsPage() { delete ui; }
[ "info@sandersonlinetrading.nl" ]
info@sandersonlinetrading.nl
5ff9891947ecb8f5e01cfd81b9d4930aab72fe49
4c93ca76318969f1624a0e77749bcdea3e7809d3
/~9999/1289_트리의 가중치_2.cpp
5ef7c132a38cef45ad2582540959349a25cd86c6
[]
no_license
root-jeong/BOJ
080925f6cfbb5dcbdf13c4c3a3c7e0a444908e6e
ec1ef5ad322597883b74d276078da8a508f164a8
refs/heads/master
2022-04-03T22:33:44.866564
2020-01-08T12:21:19
2020-01-08T12:21:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
569
cpp
#include <iostream> #include <vector> using namespace std; vector<pair<int, int> > vec[100001]; int DIV = 1000000007; long long total; long long dfs(int now, int prev) { long long tmp; long long ret = 1; for (const auto & x : vec[now]) { if (x.first != prev) { tmp = dfs(x.first,now )* x.second % DIV; total += (tmp * ret) % DIV; ret += (tmp + ret) % DIV; } } } int main() { int N; int a, b, wei; cin >> N; for (int i = 0; i < N; i++) { cin >> a >> b >> wei; vec[a].push_back(make_pair(b, wei)); vec[b].push_back(make_pair(a, wei)); } }
[ "gjek136@naver.com" ]
gjek136@naver.com
bbbd6312e6eac9ca580fda84f3dbdd7e8a089944
d2b81ede3d3a516f5313835ce07dfea97db46c87
/diophantine/quartics_simple2.1.cpp
c48d65a5dbf7bbfdbba2ce6bc3d3ef5b23557b7c
[]
no_license
p15-git-acc/code
8b847ad95cd59a13446f595ac65d96d6bc45b512
59337447523018dfab71cbbbda53b4bb88b7ce59
refs/heads/master
2022-12-16T14:38:09.073676
2020-09-16T09:23:00
2020-09-16T09:23:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,455
cpp
// version 2.1 use SSE instructions to move nodes // stop after first solution // #include "inttypes.h" #include "stdio.h" #include <stdlib.h> #include <malloc.h> #include <iostream> #include <assert.h> unsigned long int H; // runs to height<=H // 128 bit unsigned built in to GCC (efficiency?) typedef __uint128_t bigint; // a node in our heap typedef struct{ //unsigned int node_no; __attribute__ ((aligned(16))) long unsigned int a; long unsigned int b; bigint pq; } node; void print_bigint(bigint i) { printf("%ju",(uintmax_t) i); } void print_node(node n) { printf("[%lu,%lu,",n.a,n.b); print_bigint(n.pq); printf("]\n"); } void print_heap(node *heap, int last_one) { for(int i=0;i<=last_one;i++) print_node(heap[i]); } inline long unsigned int gcd (long unsigned int a, long unsigned int b) /* Euclid algorithm gcd */ { unsigned int c; while(a!=0) { c=a; a=b%a; b=c; }; return(b); }; inline long unsigned int gcd (long unsigned int a, long unsigned int b, long unsigned int c) { return(gcd(gcd(a,b),c)); } inline long unsigned int gcd (long unsigned int a, long unsigned int b, long unsigned int c, long unsigned int d) { return(gcd(gcd(a,b),gcd(c,d))); } void print_solution(node n1, node n2) { printf("solution found\n"); print_node(n1); print_node(n2); printf("Terminating search.\n"); //exit(0); } // res<-a*x^4 inline bigint p(long unsigned int x, long unsigned int a) { bigint res=x; res*=res; res*=res; res*=a; return(res); } // returns 0 if top <left and top < right // returns 1 if top > left < right // returns -1 if top > right < left inline int comp_nodes(node top, node left, node right) { if(left.pq<=right.pq) // left <= right { if(top.pq<=left.pq) // top <= left <= right return(0); else // top > left and top <= right return(1); // so swap left } // right < left if(top.pq<=right.pq) // top <= right < left return(0); else return(-1); } // use the 128 bit XMM registers to swap two nodes #define swap_node(x,y) \ { \ __asm( \ "movapd %0,%%XMM0\n\t" \ "movapd %1,%%XMM1\n\t" \ "movapd %%XMM0,%1\n\t" \ "movapd %%XMM1,%0\n\t" \ "movapd %2,%%XMM0\n\t" \ "movapd %3,%%XMM1\n\t" \ "movapd %%XMM0,%3\n\t" \ "movapd %%XMM1,%2" \ : "=m" (x), "=m" (y), "=m" (x.pq), "=m" (y.pq) \ : \ : "xmm0","xmm1"); \ } inline void balance_heap (node *heap, int heap_end) { int this_ptr=0,left_ptr,right_ptr,cmp; while(true) { left_ptr=(this_ptr<<1)+1; right_ptr=(this_ptr+1)<<1; if(left_ptr<=heap_end) // it has a left child { if(right_ptr<=heap_end) // it has a left and right children { cmp=comp_nodes(heap[this_ptr],heap[left_ptr],heap[right_ptr]); //printf("comp of %d %d %d returned %d\n",this_ptr,left_ptr,right_ptr,cmp); if(cmp>0) // swap with left { swap_node(heap[this_ptr],heap[left_ptr]); this_ptr=left_ptr; continue; } if(cmp<0) // swap with right { swap_node(heap[this_ptr],heap[right_ptr]); this_ptr=right_ptr; continue; } // parent node is in right place so stop return; } else // this node only has a left child { if(heap[left_ptr].pq<heap[this_ptr].pq) // left<this swap_node(heap[this_ptr],heap[left_ptr]); return; // tree is balanced } } else // this node is at bottom return; } } #define pop_node(heap,heap_end){heap[0]=heap[heap_end];\ balance_heap(heap,heap_end-1);} void check_eqn(long unsigned int A1, long unsigned int A2, long unsigned int A3, long unsigned int A4, node *lnodes, node *rnodes, bigint *ps, bigint *qs) { int cmp; bigint temp,temp1; // set up left heap temp1=p(1,A1); for(long unsigned int i=0;i<H;i++) { lnodes[i].a=1; lnodes[i].b=i+1; lnodes[i].pq=temp1+p(lnodes[i].b,A2); } //printf("Left heap now\n");print_heap(lnodes,H-1); // set up right heap temp1=p(1,A3); for(long unsigned int i=0;i<H;i++) { rnodes[i].a=1; rnodes[i].b=i+1; rnodes[i].pq=temp1+p(rnodes[i].b,A4); } //printf("Right heap now\n");print_heap(rnodes,H-1); int left_end=H-1; int right_end=H-1; while(true) { //printf("Iterating with left=");print_node(lnodes[0]); //printf(" and right=");print_node(rnodes[0]); if(lnodes[0].pq<rnodes[0].pq) // left<right { if(lnodes[0].a<H) // more left nodes to add { lnodes[0].pq+=ps[lnodes[0].a-1]; lnodes[0].a++; //printf("L Pushing ");print_node(lnodes[0]); balance_heap(lnodes,H-1); //print_heap(lnodes,H-1); } else // no more left nodes, so just pop pop_node(lnodes,left_end--); if(left_end<0) // heap empty { //print_node(rnodes[0]); printf("No solutions found.\n"); return; } continue; } if(lnodes[0].pq>rnodes[0].pq) // right<left { if(rnodes[0].a<H) { rnodes[0].pq+=qs[rnodes[0].a-1]; rnodes[0].a++; //printf("R Pushing ");print_node(rnodes[0]); balance_heap(rnodes,H-1); //print_heap(rnodes,H-1); } else pop_node(rnodes,right_end--); if(right_end<0) { //print_node(lnodes[0]); printf("No solutions found.\n"); return; } continue; } // right=left //if(gcd(lnodes[0].a,lnodes[0].b,rnodes[0].a,rnodes[0].b)==1) print_solution(lnodes[0],rnodes[0]); return; } } int main(int argc, char **argv) { node *lnodes,*rnodes,left_node,right_node; bigint *ps,*qs; int cmp; unsigned long int As[4]; // this defines the equation if(argc!=6) { printf("Incorrect command line, #args=%d\n",argc); exit(0); } H=atoi(argv[1]); for(int i=0;i<4;i++) As[i]=atoi(argv[i+2]); assert(lnodes=(node *) memalign(16,H*sizeof(node))); assert(rnodes=(node *) memalign(16,H*sizeof(node))); assert(ps=(bigint *) malloc(H*sizeof(bigint))); assert(qs=(bigint *) malloc(H*sizeof(bigint))); printf("Looking for solutions to %lux^4+%luy^4=%luu^4+%luv^4 to height %lu\n", As[0],As[1],As[2],As[3],H); for(int i=0;i<H;i++) { ps[i]=p(i+1,As[0]); qs[i]=p(i+1,As[2]); } for(int i=0;i<H-1;i++) { ps[i]=ps[i+1]-ps[i]; qs[i]=qs[i+1]-qs[i]; } check_eqn(As[0],As[1],As[2],As[3],lnodes,rnodes,ps,qs); }
[ "dave.platt@bris.ac.uk" ]
dave.platt@bris.ac.uk
3af2f1c6176db72ee508d728cdae2e4b979c4744
2bc4762a1a424f195c9b20b6d89d14763f11b010
/playlist.cpp
8a3b67b0630965cc78ead1b1ce4f09376a82f066
[]
no_license
Danile71/winsaplayer_sources
a6b66ceaca6514418980fa7655a9af8a09a5b0e5
ca607d79788b10ed6775b916497d6b9866e9c0f9
refs/heads/master
2021-08-06T10:31:16.043194
2017-11-05T07:27:53
2017-11-05T07:27:53
109,423,755
0
0
null
null
null
null
UTF-8
C++
false
false
961
cpp
#include "include/playlist.h" #define null "" __fastcall TXml::TXml() { List=new TStringList(); PList=new TStringList(); } AnsiString __fastcall TXml::GetAutor(AnsiString str) { AnsiString ret,strt="no name"; if(str.Pos("<title>")) { ret=""; for(int i=str.Pos("<title>")+7;i<str.Pos("</title>");i++)ret=ret+str[i]; return ret; } else return strt; } void __fastcall TXml::AddSong(AnsiString str) { AnsiString newstr; if(str.Pos("media src=")) { newstr=null; for(int a=str.Pos("media src=")+11;a<str.Pos("/>")-1;a++) { newstr=newstr+str[a]; }//for media if(newstr.Pos("&apos;")) {newstr.Insert("'",newstr.Pos("&apos;"));newstr.Delete(newstr.Pos("&apos;"),6);} PList->Add(newstr); }//if src //PList->Add(); } void __fastcall TXml::LoadFromFile(AnsiString FileName) { AnsiString str; List->LoadFromFile(FileName); for(int i=0;i<List->Count;i++) { //Autor=GetAutor(List->Strings[i]); AddSong(List->Strings[i]); } }
[ "danile71@gmail.com" ]
danile71@gmail.com
12ffc4313dc8491e2b01d43047c021f498f7574f
7ab7b7da369587e9bb76a0b1f26928e24a78c67d
/src/modules/airspeed_selector/airspeed_selector_main.cpp
f483d7e30ee54bf4890d9f020045ee7f1bc83e01
[ "BSD-3-Clause" ]
permissive
a4aleem/Firmware
f0dff97eecac7e8b3a71c2404bcba2d0a0435efa
2fa3ee9336353c337906056efe6a77dc9a30dfe9
refs/heads/master
2020-07-17T15:51:49.244222
2019-08-30T04:40:22
2019-08-30T04:40:22
206,047,341
1
0
BSD-3-Clause
2019-09-03T10:06:35
2019-09-03T10:06:34
null
UTF-8
C++
false
false
23,380
cpp
/**************************************************************************** * * Copyright (c) 2018 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ #include <drivers/drv_hrt.h> #include <ecl/airdata/WindEstimator.hpp> #include <matrix/math.hpp> #include <parameters/param.h> #include <perf/perf_counter.h> #include <px4_module.h> #include <px4_module_params.h> #include <px4_work_queue/ScheduledWorkItem.hpp> #include <lib/airspeed/airspeed.h> #include <AirspeedValidator.hpp> #include <systemlib/mavlink_log.h> #include <uORB/Subscription.hpp> #include <uORB/topics/airspeed.h> #include <uORB/topics/airspeed_validated.h> #include <uORB/topics/estimator_status.h> #include <uORB/topics/mavlink_log.h> #include <uORB/topics/parameter_update.h> #include <uORB/topics/vehicle_acceleration.h> #include <uORB/topics/vehicle_air_data.h> #include <uORB/topics/vehicle_attitude.h> #include <uORB/topics/vehicle_land_detected.h> #include <uORB/topics/vehicle_local_position.h> #include <uORB/topics/vehicle_status.h> #include <uORB/topics/vtol_vehicle_status.h> #include <uORB/topics/wind_estimate.h> using namespace time_literals; static constexpr uint32_t SCHEDULE_INTERVAL{100_ms}; /**< The schedule interval in usec (10 Hz) */ using matrix::Dcmf; using matrix::Quatf; using matrix::Vector2f; using matrix::Vector3f; class AirspeedModule : public ModuleBase<AirspeedModule>, public ModuleParams, public px4::ScheduledWorkItem { public: AirspeedModule(); ~AirspeedModule(); /** @see ModuleBase */ static int task_spawn(int argc, char *argv[]); /** @see ModuleBase */ static int custom_command(int argc, char *argv[]); /** @see ModuleBase */ static int print_usage(const char *reason = nullptr); /* run the main loop */ void Run() override; int print_status() override; private: static constexpr int MAX_NUM_AIRSPEED_SENSORS = 3; /**< Support max 3 airspeed sensors */ orb_advert_t _airspeed_validated_pub {nullptr}; /**< airspeed validated topic*/ orb_advert_t _wind_est_pub[MAX_NUM_AIRSPEED_SENSORS + 1] {}; /**< wind estimate topic (for each airspeed validator + purely sideslip fusion) */ orb_advert_t _mavlink_log_pub {nullptr}; /**< mavlink log topic*/ uORB::Subscription _estimator_status_sub{ORB_ID(estimator_status)}; uORB::Subscription _param_sub{ORB_ID(parameter_update)}; uORB::Subscription _vehicle_acceleration_sub{ORB_ID(vehicle_acceleration)}; uORB::Subscription _vehicle_air_data_sub{ORB_ID(vehicle_air_data)}; uORB::Subscription _vehicle_attitude_sub{ORB_ID(vehicle_attitude)}; uORB::Subscription _vehicle_land_detected_sub{ORB_ID(vehicle_land_detected)}; uORB::Subscription _vehicle_local_position_sub{ORB_ID(vehicle_local_position)}; uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)}; uORB::Subscription _vtol_vehicle_status_sub{ORB_ID(vtol_vehicle_status)}; estimator_status_s _estimator_status {}; parameter_update_s _parameter_update {}; vehicle_acceleration_s _accel {}; vehicle_air_data_s _vehicle_air_data {}; vehicle_attitude_s _vehicle_attitude {}; vehicle_land_detected_s _vehicle_land_detected {}; vehicle_local_position_s _vehicle_local_position {}; vehicle_status_s _vehicle_status {}; vtol_vehicle_status_s _vtol_vehicle_status {}; WindEstimator _wind_estimator_sideslip; /**< wind estimator instance only fusing sideslip */ wind_estimate_s _wind_estimate_sideslip {}; /**< wind estimate message for wind estimator instance only fusing sideslip */ int _airspeed_sub[MAX_NUM_AIRSPEED_SENSORS] {}; /**< raw airspeed topics subscriptions. Max 3 airspeeds sensors. */ int _number_of_airspeed_sensors{0}; /**< number of airspeed sensors in use (detected during initialization)*/ AirspeedValidator *_airspeed_validator{nullptr}; /**< airspeedValidator instances (one for each sensor, assigned dynamically during startup) */ int _valid_airspeed_index{-1}; /**< index of currently chosen (valid) airspeed sensor */ int _prev_airspeed_index{-1}; /**< previously chosen airspeed sensor index */ bool _initialized{false}; /**< module initialized*/ bool _vehicle_local_position_valid{false}; /**< local position (from GPS) valid */ bool _in_takeoff_situation{true}; /**< in takeoff situation (defined as not yet stall speed reached) */ float _ground_minus_wind_TAS{0.0f}; /**< true airspeed from groundspeed minus windspeed */ float _ground_minus_wind_EAS{0.0f}; /**< true airspeed from groundspeed minus windspeed */ bool _scale_estimation_previously_on{false}; /**< scale_estimation was on in the last cycle */ perf_counter_t _perf_elapsed{}; perf_counter_t _perf_interval{}; DEFINE_PARAMETERS( (ParamFloat<px4::params::ARSP_W_P_NOISE>) _param_west_w_p_noise, (ParamFloat<px4::params::ARSP_SC_P_NOISE>) _param_west_sc_p_noise, (ParamFloat<px4::params::ARSP_TAS_NOISE>) _param_west_tas_noise, (ParamFloat<px4::params::ARSP_BETA_NOISE>) _param_west_beta_noise, (ParamInt<px4::params::ARSP_TAS_GATE>) _param_west_tas_gate, (ParamInt<px4::params::ARSP_BETA_GATE>) _param_west_beta_gate, (ParamInt<px4::params::ARSP_SCALE_EST>) _param_west_scale_estimation_on, (ParamFloat<px4::params::ARSP_ARSP_SCALE>) _param_west_airspeed_scale, (ParamFloat<px4::params::COM_TAS_FS_INNOV>) _tas_innov_threshold, /**< innovation check threshold */ (ParamFloat<px4::params::COM_TAS_FS_INTEG>) _tas_innov_integ_threshold, /**< innovation check integrator threshold */ (ParamInt<px4::params::COM_TAS_FS_T1>) _checks_fail_delay, /**< delay to declare airspeed invalid */ (ParamInt<px4::params::COM_TAS_FS_T2>) _checks_clear_delay, /**< delay to declare airspeed valid again */ (ParamFloat<px4::params::COM_ASPD_STALL>) _airspeed_stall /**< stall speed*/ ) int start(); void update_params(); /**< update parameters */ void poll_topics(); /**< poll all topics required beside airspeed (e.g. current temperature) */ void update_wind_estimator_sideslip(); /**< update the wind estimator instance only fusing sideslip */ void update_ground_minus_wind_airspeed(); /**< update airspeed estimate based on groundspeed minus windspeed */ void select_airspeed_and_publish(); /**< select airspeed sensor (or groundspeed-windspeed) */ void publish_wind_estimates(); /**< publish wind estimator states (from all wind estimators running) */ }; AirspeedModule::AirspeedModule(): ModuleParams(nullptr), ScheduledWorkItem(px4::wq_configurations::lp_default) { // initialise parameters update_params(); _perf_elapsed = perf_alloc_once(PC_ELAPSED, "airspeed_selector elapsed"); _perf_interval = perf_alloc_once(PC_INTERVAL, "airspeed_selector interval"); } AirspeedModule::~AirspeedModule() { ScheduleClear(); for (int i = 0; i < MAX_NUM_AIRSPEED_SENSORS; i++) { if (_wind_est_pub[i] != nullptr) { orb_unadvertise(_wind_est_pub[i]); } } orb_unadvertise(_airspeed_validated_pub); perf_free(_perf_elapsed); perf_free(_perf_interval); if (_airspeed_validator != nullptr) { delete[] _airspeed_validator; } } int AirspeedModule::task_spawn(int argc, char *argv[]) { AirspeedModule *dev = new AirspeedModule(); // check if the trampoline is called for the first time if (!dev) { PX4_ERR("alloc failed"); return PX4_ERROR; } _object.store(dev); if (dev) { dev->ScheduleOnInterval(SCHEDULE_INTERVAL, 10000); _task_id = task_id_is_work_queue; return PX4_OK; } return PX4_ERROR; } void AirspeedModule::Run() { perf_count(_perf_interval); perf_begin(_perf_elapsed); /* the first time we run through here, initialize N airspeedValidator * instances (N = number of airspeed sensors detected) */ if (!_initialized) { for (int i = 0; i < MAX_NUM_AIRSPEED_SENSORS; i++) { if (orb_exists(ORB_ID(airspeed), i) != 0) { continue; } _number_of_airspeed_sensors = i + 1; } _airspeed_validator = new AirspeedValidator[_number_of_airspeed_sensors]; if (_number_of_airspeed_sensors > 0) { for (int i = 0; i < _number_of_airspeed_sensors; i++) { _airspeed_sub[i] = orb_subscribe_multi(ORB_ID(airspeed), i); _valid_airspeed_index = 0; // set index to first sensor _prev_airspeed_index = 0; // set index to first sensor } } _initialized = true; } parameter_update_s update; if (_param_sub.update(&update)) { update_params(); } poll_topics(); update_wind_estimator_sideslip(); update_ground_minus_wind_airspeed(); if (_airspeed_validator != nullptr) { bool armed = (_vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED); bool fixed_wing = !_vtol_vehicle_status.vtol_in_rw_mode; bool in_air = !_vehicle_land_detected.landed; /* Prepare data for airspeed_validator */ struct airspeed_validator_update_data input_data = {}; input_data.timestamp = hrt_absolute_time(); input_data.lpos_vx = _vehicle_local_position.vx; input_data.lpos_vy = _vehicle_local_position.vy; input_data.lpos_vz = _vehicle_local_position.vz; input_data.lpos_valid = _vehicle_local_position_valid; input_data.lpos_evh = _vehicle_local_position.evh; input_data.lpos_evv = _vehicle_local_position.evv; input_data.att_q[0] = _vehicle_attitude.q[0]; input_data.att_q[1] = _vehicle_attitude.q[1]; input_data.att_q[2] = _vehicle_attitude.q[2]; input_data.att_q[3] = _vehicle_attitude.q[3]; input_data.air_pressure_pa = _vehicle_air_data.baro_pressure_pa; input_data.accel_z = _accel.xyz[2]; input_data.vel_test_ratio = _estimator_status.vel_test_ratio; input_data.mag_test_ratio = _estimator_status.mag_test_ratio; /* iterate through all airspeed sensors, poll new data from them and update their validators */ for (int i = 0; i < _number_of_airspeed_sensors; i++) { /* poll airspeed data */ airspeed_s airspeed_raw = {}; orb_copy(ORB_ID(airspeed), _airspeed_sub[i], &airspeed_raw); // poll raw airspeed topic of the i-th sensor input_data.airspeed_indicated_raw = airspeed_raw.indicated_airspeed_m_s; input_data.airspeed_true_raw = airspeed_raw.true_airspeed_m_s; input_data.airspeed_timestamp = airspeed_raw.timestamp; input_data.air_temperature_celsius = airspeed_raw.air_temperature_celsius; /* update in_fixed_wing_flight for the current airspeed sensor validator */ /* takeoff situation is active from start till one of the sensors' IAS or groundspeed_EAS is above stall speed */ if (airspeed_raw.indicated_airspeed_m_s > _airspeed_stall.get() || _ground_minus_wind_EAS > _airspeed_stall.get()) { _in_takeoff_situation = false; } /* reset takeoff_situation to true when not in air or not in fixed-wing mode */ if (!in_air || !fixed_wing) { _in_takeoff_situation = true; } input_data.in_fixed_wing_flight = (armed && fixed_wing && in_air && !_in_takeoff_situation); /* push input data into airspeed validator */ _airspeed_validator[i].update_airspeed_validator(input_data); } } select_airspeed_and_publish(); perf_end(_perf_elapsed); if (should_exit()) { exit_and_cleanup(); } } void AirspeedModule::update_params() { updateParams(); /* update wind estimator (sideslip fusion only) parameters */ _wind_estimator_sideslip.set_wind_p_noise(_param_west_w_p_noise.get()); _wind_estimator_sideslip.set_tas_scale_p_noise(_param_west_sc_p_noise.get()); _wind_estimator_sideslip.set_tas_noise(_param_west_tas_noise.get()); _wind_estimator_sideslip.set_beta_noise(_param_west_beta_noise.get()); _wind_estimator_sideslip.set_tas_gate(_param_west_tas_gate.get()); _wind_estimator_sideslip.set_beta_gate(_param_west_beta_gate.get()); /* update airspeedValidator parameters */ for (int i = 0; i < _number_of_airspeed_sensors; i++) { _airspeed_validator[i].set_wind_estimator_wind_p_noise(_param_west_w_p_noise.get()); _airspeed_validator[i].set_wind_estimator_tas_scale_p_noise(_param_west_sc_p_noise.get()); _airspeed_validator[i].set_wind_estimator_tas_noise(_param_west_tas_noise.get()); _airspeed_validator[i].set_wind_estimator_beta_noise(_param_west_beta_noise.get()); _airspeed_validator[i].set_wind_estimator_tas_gate(_param_west_tas_gate.get()); _airspeed_validator[i].set_wind_estimator_beta_gate(_param_west_beta_gate.get()); _airspeed_validator[i].set_wind_estimator_scale_estimation_on(_param_west_scale_estimation_on.get()); /* Only apply manual entered airspeed scale to first airspeed measurement */ _airspeed_validator[0].set_airspeed_scale(_param_west_airspeed_scale.get()); _airspeed_validator[i].set_tas_innov_threshold(_tas_innov_threshold.get()); _airspeed_validator[i].set_tas_innov_integ_threshold(_tas_innov_integ_threshold.get()); _airspeed_validator[i].set_checks_fail_delay(_checks_fail_delay.get()); _airspeed_validator[i].set_checks_clear_delay(_checks_clear_delay.get()); _airspeed_validator[i].set_airspeed_stall(_airspeed_stall.get()); } /* when airspeed scale estimation is turned on and the airspeed is valid, then set the scale inside the wind estimator to -1 such that it starts to estimate it */ if (!_scale_estimation_previously_on && _param_west_scale_estimation_on.get()) { if (_valid_airspeed_index >= 0) { _airspeed_validator[0].set_airspeed_scale( -1.0f); // set it to a negative value to start estimation inside wind estimator } else { mavlink_and_console_log_info(&_mavlink_log_pub, "Airspeed: can't estimate scale as no valid sensor."); _param_west_scale_estimation_on.set(0); // reset this param to 0 as estimation was not turned on _param_west_scale_estimation_on.commit_no_notification(); } /* If one sensor is valid and we switched out of scale estimation, then publish message and change the value of param ARSP_ARSP_SCALE */ } else if (_scale_estimation_previously_on && !_param_west_scale_estimation_on.get()) { if (_valid_airspeed_index >= 0) { _param_west_airspeed_scale.set(_airspeed_validator[_valid_airspeed_index].get_EAS_scale()); _param_west_airspeed_scale.commit_no_notification(); _airspeed_validator[_valid_airspeed_index].set_airspeed_scale(_param_west_airspeed_scale.get()); mavlink_and_console_log_info(&_mavlink_log_pub, "Airspeed: estimated scale (ARSP_ARSP_SCALE): %0.2f", (double)_airspeed_validator[_valid_airspeed_index].get_EAS_scale()); } else { mavlink_and_console_log_info(&_mavlink_log_pub, "Airspeed: can't estimate scale as no valid sensor."); } } _scale_estimation_previously_on = _param_west_scale_estimation_on.get(); } void AirspeedModule::poll_topics() { _estimator_status_sub.update(&_estimator_status); _vehicle_acceleration_sub.update(&_accel); _vehicle_air_data_sub.update(&_vehicle_air_data); _vehicle_attitude_sub.update(&_vehicle_attitude); _vehicle_land_detected_sub.update(&_vehicle_land_detected); _vehicle_status_sub.update(&_vehicle_status); _vtol_vehicle_status_sub.update(&_vtol_vehicle_status); _vehicle_local_position_sub.update(&_vehicle_local_position); _vehicle_local_position_valid = (hrt_absolute_time() - _vehicle_local_position.timestamp < 1_s) && (_vehicle_local_position.timestamp > 0) && _vehicle_local_position.v_xy_valid; } void AirspeedModule::update_wind_estimator_sideslip() { bool att_valid = true; // TODO: check if attitude is valid const hrt_abstime time_now_usec = hrt_absolute_time(); /* update wind and airspeed estimator */ _wind_estimator_sideslip.update(time_now_usec); if (_vehicle_local_position_valid && att_valid) { Vector3f vI(_vehicle_local_position.vx, _vehicle_local_position.vy, _vehicle_local_position.vz); Quatf q(_vehicle_attitude.q); /* sideslip fusion */ _wind_estimator_sideslip.fuse_beta(time_now_usec, vI, q); } /* fill message for publishing later */ _wind_estimate_sideslip.timestamp = time_now_usec; float wind[2]; _wind_estimator_sideslip.get_wind(wind); _wind_estimate_sideslip.windspeed_north = wind[0]; _wind_estimate_sideslip.windspeed_east = wind[1]; float wind_cov[2]; _wind_estimator_sideslip.get_wind_var(wind_cov); _wind_estimate_sideslip.variance_north = wind_cov[0]; _wind_estimate_sideslip.variance_east = wind_cov[1]; _wind_estimate_sideslip.tas_innov = _wind_estimator_sideslip.get_tas_innov(); _wind_estimate_sideslip.tas_innov_var = _wind_estimator_sideslip.get_tas_innov_var(); _wind_estimate_sideslip.beta_innov = _wind_estimator_sideslip.get_beta_innov(); _wind_estimate_sideslip.beta_innov_var = _wind_estimator_sideslip.get_beta_innov_var(); _wind_estimate_sideslip.tas_scale = _wind_estimator_sideslip.get_tas_scale(); } void AirspeedModule::update_ground_minus_wind_airspeed() { /* calculate airspeed estimate based on groundspeed-windspeed to use as fallback */ float TAS_north = _vehicle_local_position.vx - _wind_estimate_sideslip.windspeed_north; float TAS_east = _vehicle_local_position.vy - _wind_estimate_sideslip.windspeed_east; float TAS_down = _vehicle_local_position.vz; // no wind estimate in z _ground_minus_wind_TAS = sqrtf(TAS_north * TAS_north + TAS_east * TAS_east + TAS_down * TAS_down); _ground_minus_wind_EAS = calc_EAS_from_TAS(_ground_minus_wind_TAS, _vehicle_air_data.baro_pressure_pa, _vehicle_air_data.baro_temp_celcius); } void AirspeedModule::select_airspeed_and_publish() { /* airspeed index: / 0: first airspeed sensor valid / 1: second airspeed sensor valid / -1: airspeed sensor(s) invalid, but groundspeed-windspeed estimate valid / -2: airspeed invalid (sensors and groundspeed-windspeed estimate invalid) */ bool find_new_valid_index = false; /* find new valid index if airspeed currently invalid (but we have sensors) */ if ((_number_of_airspeed_sensors > 0 && _prev_airspeed_index < 0) || (_prev_airspeed_index >= 0 && !_airspeed_validator[_prev_airspeed_index].get_airspeed_valid()) || _prev_airspeed_index == -2) { find_new_valid_index = true; } if (find_new_valid_index) { _valid_airspeed_index = -1; for (int i = 0; i < _number_of_airspeed_sensors; i++) { if (_airspeed_validator[i].get_airspeed_valid()) { _valid_airspeed_index = i; break; } } } if (_valid_airspeed_index < 0 && !_vehicle_local_position_valid) { _valid_airspeed_index = -2; } /* publish critical message (and log) in index has changed */ if (_valid_airspeed_index != _prev_airspeed_index) { mavlink_log_critical(&_mavlink_log_pub, "Airspeed: switched from sensor %i to %i", _prev_airspeed_index, _valid_airspeed_index); } _prev_airspeed_index = _valid_airspeed_index; /* fill out airspeed_validated message for publishing it */ airspeed_validated_s airspeed_validated = {}; airspeed_validated.timestamp = hrt_absolute_time(); airspeed_validated.true_ground_minus_wind_m_s = NAN; airspeed_validated.indicated_ground_minus_wind_m_s = NAN; airspeed_validated.indicated_airspeed_m_s = NAN; airspeed_validated.equivalent_airspeed_m_s = NAN; airspeed_validated.true_airspeed_m_s = NAN; airspeed_validated.selected_airspeed_index = _valid_airspeed_index; switch (_valid_airspeed_index) { case -2: break; case -1: airspeed_validated.true_ground_minus_wind_m_s = _ground_minus_wind_TAS; airspeed_validated.indicated_ground_minus_wind_m_s = _ground_minus_wind_EAS; break; default: airspeed_validated.indicated_airspeed_m_s = _airspeed_validator[_valid_airspeed_index].get_IAS(); airspeed_validated.equivalent_airspeed_m_s = _airspeed_validator[_valid_airspeed_index].get_EAS(); airspeed_validated.true_airspeed_m_s = _airspeed_validator[_valid_airspeed_index].get_TAS(); airspeed_validated.true_ground_minus_wind_m_s = _ground_minus_wind_TAS; airspeed_validated.indicated_ground_minus_wind_m_s = _ground_minus_wind_EAS; break; } /* publish airspeed validated topic */ int instance; orb_publish_auto(ORB_ID(airspeed_validated), &_airspeed_validated_pub, &airspeed_validated, &instance, ORB_PRIO_DEFAULT); /* publish sideslip-only-fusion wind topic */ orb_publish_auto(ORB_ID(wind_estimate), &_wind_est_pub[0], &_wind_estimate_sideslip, &instance, ORB_PRIO_LOW); /* publish the wind estimator states from all airspeed validators */ for (int i = 0; i < _number_of_airspeed_sensors; i++) { wind_estimate_s wind_est = _airspeed_validator[i].get_wind_estimator_states(hrt_absolute_time()); orb_publish_auto(ORB_ID(wind_estimate), &_wind_est_pub[i + 1], &wind_est, &instance, ORB_PRIO_LOW); } } int AirspeedModule::custom_command(int argc, char *argv[]) { if (!is_running()) { int ret = AirspeedModule::task_spawn(argc, argv); if (ret) { return ret; } } return print_usage("unknown command"); } int AirspeedModule::print_usage(const char *reason) { if (reason) { PX4_WARN("%s\n", reason); } PRINT_MODULE_DESCRIPTION( R"DESCR_STR( ### Description This module provides a single airspeed_validated topic, containing an indicated (IAS), equivalend (EAS), true airspeed (TAS) and the information if the estimation currently is invalid and if based sensor readings or on groundspeed minus windspeed. Supporting the input of multiple "raw" airspeed inputs, this module automatically switches to a valid sensor in case of failure detection. For failure detection as well as for the estimation of a scale factor from IAS to EAS, it runs several wind estimators and also publishes those. )DESCR_STR"); PRINT_MODULE_USAGE_NAME("airspeed_estimator", "estimator"); PRINT_MODULE_USAGE_COMMAND("start"); PRINT_MODULE_USAGE_DEFAULT_COMMANDS(); return 0; } int AirspeedModule::print_status() { perf_print_counter(_perf_elapsed); perf_print_counter(_perf_interval); int instance = 0; uORB::SubscriptionData<airspeed_validated_s> est{ORB_ID(airspeed_validated), (uint8_t)instance}; est.update(); PX4_INFO("Number of airspeed sensors: %i", _number_of_airspeed_sensors); print_message(est.get()); return 0; } extern "C" __EXPORT int airspeed_selector_main(int argc, char *argv[]); int airspeed_selector_main(int argc, char *argv[]) { return AirspeedModule::main(argc, argv); }
[ "bapstroman@gmail.com" ]
bapstroman@gmail.com
cdd28cce38118074ab91be4cad7bfbb4cbe6791e
254cb2f933e9ead5df3c36a59c7280db481ec885
/TapToExit/main.cpp
d3860ace33d97eec1853e10522078951a107783a
[ "MIT" ]
permissive
KennFatt/Kyoote
d253953ab1b4dc5dd7f0802474fd828f70223529
7b9ec2ef980e8a39fb76662c6259c8c77019b97b
refs/heads/master
2021-04-08T00:17:27.326682
2020-03-20T17:46:55
2020-03-20T17:46:55
248,719,263
0
0
null
null
null
null
UTF-8
C++
false
false
98
cpp
#include "src/application.h" int main(int argc, char **argv) { Application app(argc, argv); }
[ "clashofklen@gmail.com" ]
clashofklen@gmail.com
23d5832e4ae7cfe5443ef701961f082f0e23e33c
ee3039b27532d09c0c435ea7b92e29c70246c66e
/opencv/learnOpencv/001-030/029-快速的图像边缘滤波算法.cpp
73c5cea64d53d71177f00f805e03d2e8559648d8
[]
no_license
Alvazz/fanfuhan_ML_OpenCV
e8b37acc406462b9aaca9c5e6844d1db5aa3c944
dacfdaf87356e857d3ff18c5e0a4fd5a50855324
refs/heads/master
2022-04-05T06:15:31.778227
2020-02-07T01:40:07
2020-02-07T01:40:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
421
cpp
#include <iostream> #include <opencv2/opencv.hpp> using namespace std; using namespace cv; /* * 快速的图像边缘滤波算法 */ int main() { Mat src = imread("../images/test.png"); if (src.empty()) { cout << "could not load image.." << endl; } imshow("input", src); Mat dst; edgePreservingFilter(src, dst, 1, 60, 0.44); imshow("result", dst); waitKey(0); return 0; }
[ "gitea@fake.local" ]
gitea@fake.local
d09ef6438d6f441be39f15438b6808b9c6382204
60ae6b7bc57b2b8555b7abc3d8cfb37b3c72bdce
/BT01/B19.cpp
41963bc45bf7c848a8b1e1e66d213777eb40e9a7
[]
no_license
phvtquang/BT_INT2215
7e5301cbf4b5155e2578cbc52169fa192fab980a
8bb9d577104f7a718a9512bc62f7a6fc7c698102
refs/heads/main
2023-03-29T16:15:17.147792
2021-04-04T11:38:55
2021-04-04T11:38:55
341,636,844
0
0
null
null
null
null
UTF-8
C++
false
false
382
cpp
#include <iostream> using namespace std; int main() { int x, y, z; bool b; cout << "nhap ba so" << endl; cout << "1 = "; cin >> x; cout << "2 = "; cin >> y; cout << "3 = "; cin >> z; if ((x < y) && (y < z)) { b = true; cout << "true"; } else { b = false; cout << "false"; } return 0; }
[ "quangphamviet0@gmail.com" ]
quangphamviet0@gmail.com
31f6069c929005fe3778b44390abdb48474dfb28
8b28fd4982c102e615849b294b8a6b64eeceb017
/src/net.cpp
179b99e1730485e6e914b1a07b7150a7da91a2d7
[ "MIT" ]
permissive
RdeWilde/Breakout-Chain-Client
40147c502b45a41ccc0915b485260594eec11668
76c328f75dbce0250550892c30089ce168a85420
refs/heads/master
2020-05-23T07:54:11.751146
2016-12-01T20:07:25
2016-12-01T20:07:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
58,328
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "irc.h" #include "db.h" #include "net.h" #include "init.h" #include "strlcpy.h" #include "addrman.h" #include "ui_interface.h" #include "onionseed.h" #ifdef WIN32 #include <string.h> #endif #ifdef USE_UPNP #include <miniupnpc/miniwget.h> #include <miniupnpc/miniupnpc.h> #include <miniupnpc/upnpcommands.h> #include <miniupnpc/upnperrors.h> #endif extern unsigned short onion_port; using namespace std; using namespace boost; extern "C" { int tor_main(int argc, char *argv[]); } static const int MAX_OUTBOUND_CONNECTIONS = 16; void ThreadMessageHandler2(void* parg); void ThreadSocketHandler2(void* parg); void ThreadOpenConnections2(void* parg); void ThreadOpenAddedConnections2(void* parg); #ifdef USE_UPNP void ThreadMapPort2(void* parg); #endif void ThreadDNSAddressSeed2(void* parg); bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false); struct LocalServiceInfo { int nScore; int nPort; }; // // Global state variables // bool fClient = false; bool fDiscover = true; bool fUseUPnP = false; uint64_t nLocalServices = (fClient ? 0 : NODE_NETWORK); static CCriticalSection cs_mapLocalHost; static map<CNetAddr, LocalServiceInfo> mapLocalHost; static bool vfReachable[NET_MAX] = {}; static bool vfLimited[NET_MAX] = {}; static CNode* pnodeLocalHost = NULL; CAddress addrSeenByPeer(CService("0.0.0.0", 0), nLocalServices); uint64_t nLocalHostNonce = 0; array<int, THREAD_MAX> vnThreadsRunning; static std::vector<SOCKET> vhListenSocket; CAddrMan addrman; vector<CNode*> vNodes; CCriticalSection cs_vNodes; map<CInv, CDataStream> mapRelay; deque<pair<int64_t, CInv> > vRelayExpiration; CCriticalSection cs_mapRelay; map<CInv, int64_t> mapAlreadyAskedFor; static deque<string> vOneShots; CCriticalSection cs_vOneShots; set<CNetAddr> setservAddNodeAddresses; CCriticalSection cs_setservAddNodeAddresses; static CSemaphore *semOutbound = NULL; void AddOneShot(string strDest) { LOCK(cs_vOneShots); vOneShots.push_back(strDest); } unsigned short GetListenPort() { return (unsigned short)(GetArg("-port", GetDefaultPort())); } unsigned short GetTorPort() { return onion_port; } void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) { // Filter out duplicate requests if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd) return; pindexLastGetBlocksBegin = pindexBegin; hashLastGetBlocksEnd = hashEnd; PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd); } // find 'best' local address for a particular peer bool GetLocal(CService& addr, const CNetAddr *paddrPeer) { if (fNoListen) return false; int nBestScore = -1; int nBestReachability = -1; { LOCK(cs_mapLocalHost); for (map<CNetAddr, LocalServiceInfo>::iterator it = mapLocalHost.begin(); it != mapLocalHost.end(); it++) { int nScore = (*it).second.nScore; int nReachability = (*it).first.GetReachabilityFrom(paddrPeer); if (nReachability > nBestReachability || (nReachability == nBestReachability && nScore > nBestScore)) { addr = CService((*it).first, (*it).second.nPort); nBestReachability = nReachability; nBestScore = nScore; } } } return nBestScore >= 0; } // get best local address for a particular peer as a CAddress CAddress GetLocalAddress(const CNetAddr *paddrPeer) { CAddress ret(CService("0.0.0.0",0),0); CService addr; if (GetLocal(addr, paddrPeer)) { ret = CAddress(addr); ret.nServices = nLocalServices; ret.nTime = GetAdjustedTime(); } return ret; } bool RecvLine(SOCKET hSocket, string& strLine) { strLine = ""; while (true) { char c; int nBytes = recv(hSocket, &c, 1, 0); if (nBytes > 0) { if (c == '\n') continue; if (c == '\r') return true; strLine += c; if (strLine.size() >= 9000) return true; } else if (nBytes <= 0) { if (fShutdown) return false; if (nBytes < 0) { int nErr = WSAGetLastError(); if (nErr == WSAEMSGSIZE) continue; if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS) { MilliSleep(10); continue; } } if (!strLine.empty()) return true; if (nBytes == 0) { // socket closed printf("socket closed\n"); return false; } else { // socket error int nErr = WSAGetLastError(); printf("recv failed: %d\n", nErr); return false; } } } } // Is our peer's addrLocal potentially useful as an external IP source? bool IsPeerAddrLocalGood(CNode *pnode) { return fDiscover && pnode->addr.IsRoutable() && pnode->addrLocal.IsRoutable() && !IsLimited(pnode->addrLocal.GetNetwork()); } // used when scores of local addresses may have changed // pushes better local address to peers void static AdvertizeLocal() { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { if (pnode->fSuccessfullyConnected) { CAddress addrLocal = GetLocalAddress(&pnode->addr); if (addrLocal.IsRoutable() && (CService)addrLocal != (CService)pnode->addrLocal) { pnode->PushAddress(addrLocal); pnode->addrLocal = addrLocal; } } } } void SetReachable(enum Network net, bool fFlag) { LOCK(cs_mapLocalHost); vfReachable[net] = fFlag; if (net == NET_IPV6 && fFlag) vfReachable[NET_IPV4] = true; } // learn a new local address bool AddLocal(const CService& addr, int nScore) { if (!addr.IsRoutable()) return false; if (!fDiscover && nScore < LOCAL_MANUAL) return false; if (IsLimited(addr)) return false; printf("AddLocal(%s,%i)\n", addr.ToString().c_str(), nScore); { LOCK(cs_mapLocalHost); bool fAlready = mapLocalHost.count(addr) > 0; LocalServiceInfo &info = mapLocalHost[addr]; if (!fAlready || nScore >= info.nScore) { info.nScore = nScore + (fAlready ? 1 : 0); info.nPort = addr.GetPort(); } SetReachable(addr.GetNetwork()); } AdvertizeLocal(); return true; } bool AddLocal(const CNetAddr &addr, int nScore) { return AddLocal(CService(addr, GetListenPort()), nScore); } /** Make a particular network entirely off-limits (no automatic connects to it) */ void SetLimited(enum Network net, bool fLimited) { if (net == NET_UNROUTABLE) return; LOCK(cs_mapLocalHost); vfLimited[net] = fLimited; } bool IsLimited(enum Network net) { LOCK(cs_mapLocalHost); return vfLimited[net]; } bool IsLimited(const CNetAddr &addr) { return IsLimited(addr.GetNetwork()); } /** vote for a local address */ bool SeenLocal(const CService& addr) { { LOCK(cs_mapLocalHost); if (mapLocalHost.count(addr) == 0) return false; mapLocalHost[addr].nScore++; } AdvertizeLocal(); return true; } /** check whether a given address is potentially local */ bool IsLocal(const CService& addr) { LOCK(cs_mapLocalHost); return mapLocalHost.count(addr) > 0; } /** check whether a given address is in a network we can probably connect to */ bool IsReachable(const CNetAddr& addr) { LOCK(cs_mapLocalHost); enum Network net = addr.GetNetwork(); return vfReachable[net] && !vfLimited[net]; } bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet) { SOCKET hSocket; if (!ConnectSocket(addrConnect, hSocket)) return error("GetMyExternalIP() : connection to %s failed", addrConnect.ToString().c_str()); send(hSocket, pszGet, strlen(pszGet), MSG_NOSIGNAL); string strLine; while (RecvLine(hSocket, strLine)) { if (strLine.empty()) // HTTP response is separated from headers by blank line { while (true) { if (!RecvLine(hSocket, strLine)) { closesocket(hSocket); return false; } if (pszKeyword == NULL) break; if (strLine.find(pszKeyword) != string::npos) { strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword)); break; } } closesocket(hSocket); if (strLine.find("<") != string::npos) strLine = strLine.substr(0, strLine.find("<")); strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r")); while (strLine.size() > 0 && isspace(strLine[strLine.size()-1])) strLine.resize(strLine.size()-1); CService addr(strLine,0,true); printf("GetMyExternalIP() received [%s] %s\n", strLine.c_str(), addr.ToString().c_str()); if (!addr.IsValid() || !addr.IsRoutable()) return false; ipRet.SetIP(addr); return true; } } closesocket(hSocket); return error("GetMyExternalIP() : connection closed"); } // We now get our external IP from the IRC server first and only use this as a backup bool GetMyExternalIP(CNetAddr& ipRet) { CService addrConnect; const char* pszGet; const char* pszKeyword; for (int nLookup = 0; nLookup <= 1; nLookup++) for (int nHost = 1; nHost <= 2; nHost++) { // We should be phasing out our use of sites like these. If we need // replacements, we should ask for volunteers to put this simple // php file on their web server that prints the client IP: // <?php echo $_SERVER["REMOTE_ADDR"]; ?> if (nHost == 1) { addrConnect = CService("91.198.22.70",80); // checkip.dyndns.org if (nLookup == 1) { CService addrIP("checkip.dyndns.org", 80, true); if (addrIP.IsValid()) addrConnect = addrIP; } pszGet = "GET / HTTP/1.1\r\n" "Host: checkip.dyndns.org\r\n" "User-Agent: breakout\r\n" "Connection: close\r\n" "\r\n"; pszKeyword = "Address:"; } else if (nHost == 2) { addrConnect = CService("74.208.43.192", 80); // www.showmyip.com if (nLookup == 1) { CService addrIP("www.showmyip.com", 80, true); if (addrIP.IsValid()) addrConnect = addrIP; } pszGet = "GET /simple/ HTTP/1.1\r\n" "Host: www.showmyip.com\r\n" "User-Agent: breakout\r\n" "Connection: close\r\n" "\r\n"; pszKeyword = NULL; // Returns just IP address } if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet)) return true; } return false; } void ThreadGetMyExternalIP(void* parg) { // Make this thread recognisable as the external IP detection thread RenameThread("breakout-ext-ip"); CNetAddr addrLocalHost; if (GetMyExternalIP(addrLocalHost)) { printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str()); AddLocal(addrLocalHost, LOCAL_HTTP); } } void AddressCurrentlyConnected(const CService& addr) { addrman.Connected(addr); } CNode* FindNode(const CNetAddr& ip) { { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if ((CNetAddr)pnode->addr == ip) return (pnode); } return NULL; } CNode* FindNode(std::string addrName) { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if (pnode->addrName == addrName) return (pnode); return NULL; } CNode* FindNode(const CService& addr) { { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if ((CService)pnode->addr == addr) return (pnode); } return NULL; } CNode* ConnectNode(CAddress addrConnect, const char *pszDest) { if (pszDest == NULL) { if (IsLocal(addrConnect)) return NULL; // Look for an existing connection CNode* pnode = FindNode((CService)addrConnect); if (pnode) { pnode->AddRef(); return pnode; } } /// debug print printf("trying connection %s lastseen=%.1fhrs\n", pszDest ? pszDest : addrConnect.ToString().c_str(), pszDest ? 0 : (double)(GetAdjustedTime() - addrConnect.nTime)/3600.0); // Connect SOCKET hSocket; if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, GetDefaultPort()) : ConnectSocket(addrConnect, hSocket)) { addrman.Attempt(addrConnect); /// debug print printf("connected %s\n", pszDest ? pszDest : addrConnect.ToString().c_str()); // Set to non-blocking #ifdef WIN32 u_long nOne = 1; if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) printf("ConnectSocket() : ioctlsocket non-blocking setting failed, error %d\n", WSAGetLastError()); #else if (fcntl(hSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR) printf("ConnectSocket() : fcntl non-blocking setting failed, error %d\n", errno); #endif // Add node CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false); pnode->AddRef(); { LOCK(cs_vNodes); vNodes.push_back(pnode); } pnode->nTimeConnected = GetTime(); return pnode; } else { return NULL; } } void CNode::CloseSocketDisconnect() { fDisconnect = true; if (hSocket != INVALID_SOCKET) { printf("disconnecting node %s\n", addrName.c_str()); closesocket(hSocket); hSocket = INVALID_SOCKET; vRecv.clear(); } } void CNode::Cleanup() { } void CNode::PushVersion() { /// when NTP implemented, change to just nTime = GetAdjustedTime() int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime()); CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0))); CAddress addrMe = GetLocalAddress(&addr); RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce)); printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str()); PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe, nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight); } std::map<CNetAddr, int64_t> CNode::setBanned; CCriticalSection CNode::cs_setBanned; void CNode::ClearBanned() { setBanned.clear(); } bool CNode::IsBanned(CNetAddr ip) { bool fResult = false; { LOCK(cs_setBanned); std::map<CNetAddr, int64_t>::iterator i = setBanned.find(ip); if (i != setBanned.end()) { int64_t t = (*i).second; if (GetTime() < t) fResult = true; } } return fResult; } bool CNode::Misbehaving(int howmuch) { if (addr.IsLocal()) { printf("Warning: Local node %s misbehaving (delta: %d)!\n", addrName.c_str(), howmuch); return false; } nMisbehavior += howmuch; if (nMisbehavior >= GetArg("-banscore", 100)) { int64_t banTime = GetTime()+GetArg("-bantime", 60*60*24); // Default 24-hour ban printf("Misbehaving: %s (%d -> %d) DISCONNECTING\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior); { LOCK(cs_setBanned); if (setBanned[addr] < banTime) setBanned[addr] = banTime; } CloseSocketDisconnect(); return true; } else printf("Misbehaving: %s (%d -> %d)\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior); return false; } #undef X #define X(name) stats.name = name void CNode::copyStats(CNodeStats &stats) { X(nServices); X(nLastSend); X(nLastRecv); X(nTimeConnected); X(addrName); X(nVersion); X(strSubVer); X(fInbound); X(nStartingHeight); X(nMisbehavior); } #undef X void ThreadSocketHandler(void* parg) { // Make this thread recognisable as the networking thread RenameThread("breakout-net"); try { vnThreadsRunning[THREAD_SOCKETHANDLER]++; ThreadSocketHandler2(parg); vnThreadsRunning[THREAD_SOCKETHANDLER]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_SOCKETHANDLER]--; PrintException(&e, "ThreadSocketHandler()"); } catch (...) { vnThreadsRunning[THREAD_SOCKETHANDLER]--; throw; // support pthread_cancel() } printf("ThreadSocketHandler exited\n"); } void ThreadSocketHandler2(void* parg) { printf("ThreadSocketHandler started\n"); list<CNode*> vNodesDisconnected; unsigned int nPrevNodeCount = 0; while (true) { // // Disconnect nodes // { LOCK(cs_vNodes); // Disconnect unused nodes vector<CNode*> vNodesCopy = vNodes; BOOST_FOREACH(CNode* pnode, vNodesCopy) { if (pnode->fDisconnect || (pnode->GetRefCount() <= 0 && pnode->vRecv.empty() && pnode->vSend.empty())) { // remove from vNodes vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end()); // release outbound grant (if any) pnode->grantOutbound.Release(); // close socket and cleanup pnode->CloseSocketDisconnect(); pnode->Cleanup(); // hold in disconnected pool until all refs are released if (pnode->fNetworkNode || pnode->fInbound) pnode->Release(); vNodesDisconnected.push_back(pnode); } } // Delete disconnected nodes list<CNode*> vNodesDisconnectedCopy = vNodesDisconnected; BOOST_FOREACH(CNode* pnode, vNodesDisconnectedCopy) { // wait until threads are done using it if (pnode->GetRefCount() <= 0) { bool fDelete = false; { TRY_LOCK(pnode->cs_vSend, lockSend); if (lockSend) { TRY_LOCK(pnode->cs_vRecv, lockRecv); if (lockRecv) { TRY_LOCK(pnode->cs_mapRequests, lockReq); if (lockReq) { TRY_LOCK(pnode->cs_inventory, lockInv); if (lockInv) fDelete = true; } } } } if (fDelete) { vNodesDisconnected.remove(pnode); delete pnode; } } } } if (vNodes.size() != nPrevNodeCount) { nPrevNodeCount = vNodes.size(); uiInterface.NotifyNumConnectionsChanged(vNodes.size()); } // // Find which sockets have data to receive // struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 50000; // frequency to poll pnode->vSend fd_set fdsetRecv; fd_set fdsetSend; fd_set fdsetError; FD_ZERO(&fdsetRecv); FD_ZERO(&fdsetSend); FD_ZERO(&fdsetError); SOCKET hSocketMax = 0; bool have_fds = false; BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket) { FD_SET(hListenSocket, &fdsetRecv); hSocketMax = max(hSocketMax, hListenSocket); have_fds = true; } { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { if (pnode->hSocket == INVALID_SOCKET) continue; FD_SET(pnode->hSocket, &fdsetRecv); FD_SET(pnode->hSocket, &fdsetError); hSocketMax = max(hSocketMax, pnode->hSocket); have_fds = true; { TRY_LOCK(pnode->cs_vSend, lockSend); if (lockSend && !pnode->vSend.empty()) FD_SET(pnode->hSocket, &fdsetSend); } } } vnThreadsRunning[THREAD_SOCKETHANDLER]--; int nSelect = select(have_fds ? hSocketMax + 1 : 0, &fdsetRecv, &fdsetSend, &fdsetError, &timeout); vnThreadsRunning[THREAD_SOCKETHANDLER]++; if (fShutdown) return; if (nSelect == SOCKET_ERROR) { if (have_fds) { int nErr = WSAGetLastError(); printf("socket select error %d\n", nErr); for (unsigned int i = 0; i <= hSocketMax; i++) FD_SET(i, &fdsetRecv); } FD_ZERO(&fdsetSend); FD_ZERO(&fdsetError); MilliSleep(timeout.tv_usec/1000); } // // Accept new connections // BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket) if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv)) { struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len); CAddress addr; int nInbound = 0; if (hSocket != INVALID_SOCKET) if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr)) printf("Warning: Unknown socket family\n"); { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if (pnode->fInbound) nInbound++; } if (hSocket == INVALID_SOCKET) { int nErr = WSAGetLastError(); if (nErr != WSAEWOULDBLOCK) printf("socket error accept failed: %d\n", nErr); } else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS) { closesocket(hSocket); } else if (CNode::IsBanned(addr)) { printf("connection from %s dropped (banned)\n", addr.ToString().c_str()); closesocket(hSocket); } else { printf("accepted connection %s\n", addr.ToString().c_str()); CNode* pnode = new CNode(hSocket, addr, "", true); pnode->AddRef(); { LOCK(cs_vNodes); vNodes.push_back(pnode); } } } // // Service each socket // vector<CNode*> vNodesCopy; { LOCK(cs_vNodes); vNodesCopy = vNodes; BOOST_FOREACH(CNode* pnode, vNodesCopy) pnode->AddRef(); } BOOST_FOREACH(CNode* pnode, vNodesCopy) { if (fShutdown) return; // // Receive // if (pnode->hSocket == INVALID_SOCKET) continue; if (FD_ISSET(pnode->hSocket, &fdsetRecv) || FD_ISSET(pnode->hSocket, &fdsetError)) { TRY_LOCK(pnode->cs_vRecv, lockRecv); if (lockRecv) { CDataStream& vRecv = pnode->vRecv; unsigned int nPos = vRecv.size(); if (nPos > ReceiveBufferSize()) { if (!pnode->fDisconnect) printf("socket recv flood control disconnect (%"PRIszu" bytes)\n", vRecv.size()); pnode->CloseSocketDisconnect(); } else { // typical socket buffer is 8K-64K char pchBuf[0x10000]; int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT); if (nBytes > 0) { vRecv.resize(nPos + nBytes); memcpy(&vRecv[nPos], pchBuf, nBytes); pnode->nLastRecv = GetTime(); } else if (nBytes == 0) { // socket closed gracefully if (!pnode->fDisconnect) printf("socket closed\n"); pnode->CloseSocketDisconnect(); } else if (nBytes < 0) { // error int nErr = WSAGetLastError(); if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS) { if (!pnode->fDisconnect) printf("socket recv error %d\n", nErr); pnode->CloseSocketDisconnect(); } } } } } // // Send // if (pnode->hSocket == INVALID_SOCKET) continue; if (FD_ISSET(pnode->hSocket, &fdsetSend)) { TRY_LOCK(pnode->cs_vSend, lockSend); if (lockSend) { CDataStream& vSend = pnode->vSend; if (!vSend.empty()) { int nBytes = send(pnode->hSocket, &vSend[0], vSend.size(), MSG_NOSIGNAL | MSG_DONTWAIT); if (nBytes > 0) { vSend.erase(vSend.begin(), vSend.begin() + nBytes); pnode->nLastSend = GetTime(); } else if (nBytes < 0) { // error int nErr = WSAGetLastError(); if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS) { printf("socket send error %d\n", nErr); pnode->CloseSocketDisconnect(); } } } } } // // Inactivity checking // if (pnode->vSend.empty()) pnode->nLastSendEmpty = GetTime(); if (GetTime() - pnode->nTimeConnected > 60) { if (pnode->nLastRecv == 0 || pnode->nLastSend == 0) { printf("socket no message in first 60 seconds, %d %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0); pnode->fDisconnect = true; } else if (GetTime() - pnode->nLastSend > 90*60 && GetTime() - pnode->nLastSendEmpty > 90*60) { printf("socket not sending\n"); pnode->fDisconnect = true; } else if (GetTime() - pnode->nLastRecv > 90*60) { printf("socket inactivity timeout\n"); pnode->fDisconnect = true; } } } { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodesCopy) pnode->Release(); } MilliSleep(10); } } #ifdef USE_UPNP void ThreadMapPort(void* parg) { // Make this thread recognisable as the UPnP thread RenameThread("breakout-UPnP"); try { vnThreadsRunning[THREAD_UPNP]++; ThreadMapPort2(parg); vnThreadsRunning[THREAD_UPNP]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_UPNP]--; PrintException(&e, "ThreadMapPort()"); } catch (...) { vnThreadsRunning[THREAD_UPNP]--; PrintException(NULL, "ThreadMapPort()"); } printf("ThreadMapPort exited\n"); } void ThreadMapPort2(void* parg) { printf("ThreadMapPort started\n"); std::string port = strprintf("%u", GetListenPort()); const char * multicastif = 0; const char * minissdpdpath = 0; struct UPNPDev * devlist = 0; char lanaddr[64]; #ifndef UPNPDISCOVER_SUCCESS /* miniupnpc 1.5 */ devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); #else /* miniupnpc 1.6 */ int error = 0; devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); #endif struct UPNPUrls urls; struct IGDdatas data; int r; r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); if (r == 1) { if (fDiscover) { char externalIPAddress[40]; r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress); if(r != UPNPCOMMAND_SUCCESS) printf("UPnP: GetExternalIPAddress() returned %d\n", r); else { if(externalIPAddress[0]) { printf("UPnP: ExternalIPAddress = %s\n", externalIPAddress); AddLocal(CNetAddr(externalIPAddress), LOCAL_UPNP); } else printf("UPnP: GetExternalIPAddress failed.\n"); } } string strDesc = "breakout " + FormatFullVersion(); #ifndef UPNPDISCOVER_SUCCESS /* miniupnpc 1.5 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0); #else /* miniupnpc 1.6 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0"); #endif if(r!=UPNPCOMMAND_SUCCESS) printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", port.c_str(), port.c_str(), lanaddr, r, strupnperror(r)); else printf("UPnP Port Mapping successful.\n"); int i = 1; while (true) { if (fShutdown || !fUseUPnP) { r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); printf("UPNP_DeletePortMapping() returned : %d\n", r); freeUPNPDevlist(devlist); devlist = 0; FreeUPNPUrls(&urls); return; } if (i % 600 == 0) // Refresh every 20 minutes { #ifndef UPNPDISCOVER_SUCCESS /* miniupnpc 1.5 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0); #else /* miniupnpc 1.6 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0"); #endif if(r!=UPNPCOMMAND_SUCCESS) printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", port.c_str(), port.c_str(), lanaddr, r, strupnperror(r)); else printf("UPnP Port Mapping successful.\n");; } MilliSleep(2000); i++; } } else { printf("No valid UPnP IGDs found\n"); freeUPNPDevlist(devlist); devlist = 0; if (r != 0) FreeUPNPUrls(&urls); while (true) { if (fShutdown || !fUseUPnP) return; MilliSleep(2000); } } } void MapPort() { if (fUseUPnP && vnThreadsRunning[THREAD_UPNP] < 1) { if (!NewThread(ThreadMapPort, NULL)) printf("Error: ThreadMapPort(ThreadMapPort) failed\n"); } } #else void MapPort() { // Intentionally left blank. } #endif void ThreadOnionSeed(void* parg) { // Make this thread recognisable as the tor thread RenameThread("onionseed"); static const char *(*strOnionSeed)[1] = fTestNet ? strTestNetOnionSeed : strMainNetOnionSeed; int found = 0; printf("Loading addresses from .onion seeds\n"); for (unsigned int seed_idx = 0; strOnionSeed[seed_idx][0] != NULL; seed_idx++) { CNetAddr parsed; if ( !parsed.SetSpecial( strOnionSeed[seed_idx][0] ) ) { throw runtime_error("ThreadOnionSeed() : invalid .onion seed"); } int nOneDay = 24*3600; CAddress addr = CAddress(CService(parsed, GetDefaultPort())); addr.nTime = GetTime() - 3*nOneDay - GetRand(4*nOneDay); // use a random age between 3 and 7 days old found++; addrman.Add(addr, parsed); } printf("%d addresses found from .onion seeds\n", found); } unsigned int pnSeed[] = { 0xdf4bd379, 0x7934d29b, 0x26bc02ad, 0x7ab743ad, 0x0ab3a7bc, 0x375ab5bc, 0xc90b1617, 0x5352fd17, 0x5efc6c18, 0xccdc7d18, 0x443d9118, 0x84031b18, 0x347c1e18, 0x86512418, 0xfcfe9031, 0xdb5eb936, 0xef8d2e3a, 0xcf51f23c, 0x18ab663e, 0x36e0df40, 0xde48b641, 0xad3e4e41, 0xd0f32b44, 0x09733b44, 0x6a51f545, 0xe593ef48, 0xc5f5ef48, 0x96f4f148, 0xd354d34a, 0x36206f4c, 0xceefe953, 0x50468c55, 0x89d38d55, 0x65e61a5a, 0x16b1b95d, 0x702b135e, 0x0f57245e, 0xdaab5f5f, 0xba15ef63, }; void DumpAddresses() { int64_t nStart = GetTimeMillis(); CAddrDB adb; adb.Write(addrman); printf("Flushed %d addresses to peers.dat %" PRId64 "ms\n", addrman.size(), GetTimeMillis() - nStart); } void ThreadDumpAddress2(void* parg) { vnThreadsRunning[THREAD_DUMPADDRESS]++; while (!fShutdown) { DumpAddresses(); vnThreadsRunning[THREAD_DUMPADDRESS]--; MilliSleep(600000); vnThreadsRunning[THREAD_DUMPADDRESS]++; } vnThreadsRunning[THREAD_DUMPADDRESS]--; } void ThreadDumpAddress(void* parg) { // Make this thread recognisable as the address dumping thread RenameThread("breakout-adrdump"); try { ThreadDumpAddress2(parg); } catch (std::exception& e) { PrintException(&e, "ThreadDumpAddress()"); } printf("ThreadDumpAddress exited\n"); } void ThreadOpenConnections(void* parg) { // Make this thread recognisable as the connection opening thread RenameThread("breakout-opencon"); try { vnThreadsRunning[THREAD_OPENCONNECTIONS]++; ThreadOpenConnections2(parg); vnThreadsRunning[THREAD_OPENCONNECTIONS]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_OPENCONNECTIONS]--; PrintException(&e, "ThreadOpenConnections()"); } catch (...) { vnThreadsRunning[THREAD_OPENCONNECTIONS]--; PrintException(NULL, "ThreadOpenConnections()"); } printf("ThreadOpenConnections exited\n"); } void static ProcessOneShot() { string strDest; { LOCK(cs_vOneShots); if (vOneShots.empty()) return; strDest = vOneShots.front(); vOneShots.pop_front(); } CAddress addr; CSemaphoreGrant grant(*semOutbound, true); if (grant) { if (!OpenNetworkConnection(addr, &grant, strDest.c_str(), true)) AddOneShot(strDest); } } void static ThreadStakeMiner(void* parg) { printf("ThreadStakeMiner started\n"); CWallet* pwallet = (CWallet*)parg; try { vnThreadsRunning[THREAD_STAKE_MINER]++; StakeMiner(pwallet); vnThreadsRunning[THREAD_STAKE_MINER]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_STAKE_MINER]--; PrintException(&e, "ThreadStakeMiner()"); } catch (...) { vnThreadsRunning[THREAD_STAKE_MINER]--; PrintException(NULL, "ThreadStakeMiner()"); } printf("ThreadStakeMiner exiting, %d threads remaining\n", vnThreadsRunning[THREAD_STAKE_MINER]); } void ThreadOpenConnections2(void* parg) { printf("ThreadOpenConnections started\n"); // Connect to specific addresses if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) { for (int64_t nLoop = 0;; nLoop++) { ProcessOneShot(); BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"]) { CAddress addr; OpenNetworkConnection(addr, NULL, strAddr.c_str()); for (int i = 0; i < 10 && i < nLoop; i++) { MilliSleep(500); if (fShutdown) return; } } MilliSleep(500); } } // Initiate network connections int64_t nStart = GetTime(); while (true) { ProcessOneShot(); vnThreadsRunning[THREAD_OPENCONNECTIONS]--; MilliSleep(500); vnThreadsRunning[THREAD_OPENCONNECTIONS]++; if (fShutdown) return; vnThreadsRunning[THREAD_OPENCONNECTIONS]--; CSemaphoreGrant grant(*semOutbound); vnThreadsRunning[THREAD_OPENCONNECTIONS]++; if (fShutdown) return; // Add seed nodes if IRC isn't working if (addrman.size()==0 && (GetTime() - nStart > 60) && !fTestNet) { std::vector<CAddress> vAdd; for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++) { // It'll only connect to one or two seed nodes because once it connects, // it'll get a pile of addresses with newer timestamps. // Seed nodes are given a random 'last seen time' of between one and two // weeks ago. const int64_t nOneWeek = 7*24*60*60; struct in_addr ip; memcpy(&ip, &pnSeed[i], sizeof(ip)); CAddress addr(CService(ip, GetDefaultPort())); addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek; vAdd.push_back(addr); } addrman.Add(vAdd, CNetAddr("127.0.0.1")); } // // Choose an address to connect to based on most recently seen // CAddress addrConnect; // Only connect out to one peer per network group (/16 for IPv4). // Do this here so we don't have to critsect vNodes inside mapAddresses critsect. int nOutbound = 0; set<vector<unsigned char> > setConnected; { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { if (!pnode->fInbound) { setConnected.insert(pnode->addr.GetGroup()); nOutbound++; } } } int64_t nANow = GetAdjustedTime(); int nTries = 0; while (true) { // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections) CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); // if we selected an invalid address, restart if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr)) break; // If we didn't find an appropriate destination after trying 100 addresses fetched from addrman, // stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates // already-connected network ranges, ...) before trying new addrman addresses. nTries++; if (nTries > 100) break; if (IsLimited(addr)) continue; // only consider very recently tried nodes after 30 failed attempts if (nANow - addr.nLastTry < 600 && nTries < 30) continue; // do not allow non-default ports, unless after 50 invalid addresses selected already if (addr.GetPort() != GetDefaultPort() && nTries < 50) continue; addrConnect = addr; break; } if (addrConnect.IsValid()) OpenNetworkConnection(addrConnect, &grant); } } void ThreadOpenAddedConnections(void* parg) { // Make this thread recognisable as the connection opening thread RenameThread("breakout-opencon"); try { vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++; ThreadOpenAddedConnections2(parg); vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--; PrintException(&e, "ThreadOpenAddedConnections()"); } catch (...) { vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--; PrintException(NULL, "ThreadOpenAddedConnections()"); } printf("ThreadOpenAddedConnections exited\n"); } void ThreadOpenAddedConnections2(void* parg) { printf("ThreadOpenAddedConnections started\n"); if (mapArgs.count("-addnode") == 0) return; if (HaveNameProxy()) { while(!fShutdown) { BOOST_FOREACH(string& strAddNode, mapMultiArgs["-addnode"]) { CAddress addr; CSemaphoreGrant grant(*semOutbound); OpenNetworkConnection(addr, &grant, strAddNode.c_str()); MilliSleep(500); } vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--; MilliSleep(120000); // Retry every 2 minutes vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++; } return; } vector<vector<CService> > vservAddressesToAdd(0); BOOST_FOREACH(string& strAddNode, mapMultiArgs["-addnode"]) { vector<CService> vservNode(0); if(Lookup(strAddNode.c_str(), vservNode, GetDefaultPort(), fNameLookup, 0)) { vservAddressesToAdd.push_back(vservNode); { LOCK(cs_setservAddNodeAddresses); BOOST_FOREACH(CService& serv, vservNode) setservAddNodeAddresses.insert(serv); } } } while (true) { vector<vector<CService> > vservConnectAddresses = vservAddressesToAdd; // Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry // (keeping in mind that addnode entries can have many IPs if fNameLookup) { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) for (vector<vector<CService> >::iterator it = vservConnectAddresses.begin(); it != vservConnectAddresses.end(); it++) BOOST_FOREACH(CService& addrNode, *(it)) if (pnode->addr == addrNode) { it = vservConnectAddresses.erase(it); it--; break; } } BOOST_FOREACH(vector<CService>& vserv, vservConnectAddresses) { CSemaphoreGrant grant(*semOutbound); OpenNetworkConnection(CAddress(*(vserv.begin())), &grant); MilliSleep(500); if (fShutdown) return; } if (fShutdown) return; vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--; MilliSleep(120000); // Retry every 2 minutes vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++; if (fShutdown) return; } } // if successful, this moves the passed grant to the constructed node bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound, const char *strDest, bool fOneShot) { // // Initiate outbound network connection // if (fShutdown) return false; if (!strDest) if (IsLocal(addrConnect) || FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) || FindNode(addrConnect.ToStringIPPort().c_str())) return false; if (strDest && FindNode(strDest)) return false; vnThreadsRunning[THREAD_OPENCONNECTIONS]--; CNode* pnode = ConnectNode(addrConnect, strDest); vnThreadsRunning[THREAD_OPENCONNECTIONS]++; if (fShutdown) return false; if (!pnode) return false; if (grantOutbound) grantOutbound->MoveTo(pnode->grantOutbound); pnode->fNetworkNode = true; if (fOneShot) pnode->fOneShot = true; return true; } void ThreadMessageHandler(void* parg) { // Make this thread recognisable as the message handling thread RenameThread("breakout-msghand"); try { vnThreadsRunning[THREAD_MESSAGEHANDLER]++; ThreadMessageHandler2(parg); vnThreadsRunning[THREAD_MESSAGEHANDLER]--; } catch (std::exception& e) { vnThreadsRunning[THREAD_MESSAGEHANDLER]--; PrintException(&e, "ThreadMessageHandler()"); } catch (...) { vnThreadsRunning[THREAD_MESSAGEHANDLER]--; PrintException(NULL, "ThreadMessageHandler()"); } printf("ThreadMessageHandler exited\n"); } void ThreadMessageHandler2(void* parg) { printf("ThreadMessageHandler started\n"); SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL); while (!fShutdown) { vector<CNode*> vNodesCopy; { LOCK(cs_vNodes); vNodesCopy = vNodes; BOOST_FOREACH(CNode* pnode, vNodesCopy) pnode->AddRef(); } // Poll the connected nodes for messages CNode* pnodeTrickle = NULL; if (!vNodesCopy.empty()) pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())]; BOOST_FOREACH(CNode* pnode, vNodesCopy) { // Receive messages { TRY_LOCK(pnode->cs_vRecv, lockRecv); if (lockRecv) ProcessMessages(pnode); } if (fShutdown) return; // Send messages { TRY_LOCK(pnode->cs_vSend, lockSend); if (lockSend) SendMessages(pnode, pnode == pnodeTrickle); } if (fShutdown) return; } { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodesCopy) pnode->Release(); } // Wait and allow messages to bunch up. // Reduce vnThreadsRunning so StopNode has permission to exit while // we're sleeping, but we must always check fShutdown after doing this. vnThreadsRunning[THREAD_MESSAGEHANDLER]--; MilliSleep(100); if (fRequestShutdown) StartShutdown(); vnThreadsRunning[THREAD_MESSAGEHANDLER]++; if (fShutdown) return; } } bool BindListenPort(const CService &addrBind, string& strError) { strError = ""; int nOne = 1; #ifdef WIN32 // Initialize Windows Sockets WSADATA wsadata; int ret = WSAStartup(MAKEWORD(2,2), &wsadata); if (ret != NO_ERROR) { strError = strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret); printf("%s\n", strError.c_str()); return false; } #endif // Create socket for listening for incoming connections struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len)) { strError = strprintf("Error: bind address family for %s not supported", addrBind.ToString().c_str()); printf("%s\n", strError.c_str()); return false; } SOCKET hListenSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP); if (hListenSocket == INVALID_SOCKET) { strError = strprintf("Error: Couldn't open socket for incoming connections (socket returned error %d)", WSAGetLastError()); printf("%s\n", strError.c_str()); return false; } #ifdef SO_NOSIGPIPE // Different way of disabling SIGPIPE on BSD setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); #endif #ifndef WIN32 // Allow binding if the port is still in TIME_WAIT state after // the program was closed and restarted. Not an issue on windows. setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int)); #endif #ifdef WIN32 // Set to non-blocking, incoming connections will also inherit this if (ioctlsocket(hListenSocket, FIONBIO, (u_long*)&nOne) == SOCKET_ERROR) #else if (fcntl(hListenSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR) #endif { strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %d)", WSAGetLastError()); printf("%s\n", strError.c_str()); return false; } // some systems don't have IPV6_V6ONLY but are always v6only; others do have the option // and enable it by default or not. Try to enable it, if possible. if (addrBind.IsIPv6()) { #ifdef IPV6_V6ONLY #ifdef WIN32 setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int)); #else setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int)); #endif #endif #ifdef WIN32 int nProtLevel = 10 /* PROTECTION_LEVEL_UNRESTRICTED */; int nParameterId = 23 /* IPV6_PROTECTION_LEVEl */; // this call is allowed to fail setsockopt(hListenSocket, IPPROTO_IPV6, nParameterId, (const char*)&nProtLevel, sizeof(int)); #endif } if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR) { int nErr = WSAGetLastError(); if (nErr == WSAEADDRINUSE) strError = strprintf(_("Unable to bind to %s on this computer. breakout is probably already running."), addrBind.ToString().c_str()); else strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr)); printf("%s\n", strError.c_str()); return false; } printf("Bound to %s\n", addrBind.ToString().c_str()); // Listen for incoming connections if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR) { strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError()); printf("%s\n", strError.c_str()); return false; } vhListenSocket.push_back(hListenSocket); if (addrBind.IsRoutable() && fDiscover) AddLocal(addrBind, LOCAL_BIND); return true; } void static Discover() { // no network discovery } static void run_tor() { fprintf(stdout, "TOR thread started.\n"); std::string logDecl = "notice file " + GetDataDir().string() + "/tor/tor.log"; char* argv[4]; argv[0] = (char*)"tor"; argv[1] = (char*)"--hush"; argv[2] = (char*)"--Log"; argv[3] = (char*)logDecl.c_str(); tor_main(4, argv); } void StartTor(void* parg) { // Make this thread recognisable as the tor thread RenameThread("onion"); try { run_tor(); } catch (std::exception& e) { PrintException(&e, "StartTor()"); } printf("Onion thread exited."); } void StartNode(void* parg) { // Make this thread recognisable as the startup thread RenameThread("breakout-start"); if (semOutbound == NULL) { // initialize semaphore int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, (int)GetArg("-maxconnections", 125)); semOutbound = new CSemaphore(nMaxOutbound); } if (pnodeLocalHost == NULL) pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", 0), nLocalServices)); printf("StartNode(): pnodeLocalHost addr: %s\n", pnodeLocalHost->addr.ToString().c_str()); Discover(); // // Start threads // // start the onion seeder if (!GetBoolArg("-onionseed", true)) printf(".onion seeding disabled\n"); else if (!NewThread(ThreadOnionSeed, NULL)) printf("Error: could not start .onion seeding\n"); // Map ports with UPnP (default) #ifdef USE_UPNP if (fUseUPnP) MapPort(fUseUPnP); #endif // Send and receive from sockets, accept connections if (!NewThread(ThreadSocketHandler, NULL)) printf("Error: NewThread(ThreadSocketHandler) failed\n"); // Initiate outbound connections from -addnode if (!NewThread(ThreadOpenAddedConnections, NULL)) printf("Error: NewThread(ThreadOpenAddedConnections) failed\n"); // Initiate outbound connections if (!NewThread(ThreadOpenConnections, NULL)) printf("Error: NewThread(ThreadOpenConnections) failed\n"); // Process messages if (!NewThread(ThreadMessageHandler, NULL)) printf("Error: NewThread(ThreadMessageHandler) failed\n"); // Dump network addresses if (!NewThread(ThreadDumpAddress, NULL)) printf("Error; NewThread(ThreadDumpAddress) failed\n"); // Mine proof-of-stake blocks in the background if (!GetBoolArg("-staking", true)) { printf("Staking disabled\n"); } else { if (!NewThread(ThreadStakeMiner, pwalletMain)) { printf("Error: NewThread(ThreadStakeMiner) failed\n"); } } } bool StopNode() { printf("StopNode()\n"); fShutdown = true; nTransactionsUpdated++; int64_t nStart = GetTime(); if (semOutbound) for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++) semOutbound->post(); do { int nThreadsRunning = 0; for (int n = 0; n < THREAD_MAX; n++) nThreadsRunning += vnThreadsRunning[n]; if (nThreadsRunning == 0) break; if (GetTime() - nStart > 20) break; MilliSleep(20); } while(true); if (vnThreadsRunning[THREAD_SOCKETHANDLER] > 0) printf("ThreadSocketHandler still running\n"); if (vnThreadsRunning[THREAD_OPENCONNECTIONS] > 0) printf("ThreadOpenConnections still running\n"); if (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0) printf("ThreadMessageHandler still running\n"); if (vnThreadsRunning[THREAD_RPCLISTENER] > 0) printf("ThreadRPCListener still running\n"); if (vnThreadsRunning[THREAD_RPCHANDLER] > 0) printf("ThreadsRPCServer still running\n"); #ifdef USE_UPNP if (vnThreadsRunning[THREAD_UPNP] > 0) printf("ThreadMapPort still running\n"); #endif if (vnThreadsRunning[THREAD_DNSSEED] > 0) printf("ThreadDNSAddressSeed still running\n"); if (vnThreadsRunning[THREAD_ADDEDCONNECTIONS] > 0) printf("ThreadOpenAddedConnections still running\n"); if (vnThreadsRunning[THREAD_DUMPADDRESS] > 0) printf("ThreadDumpAddresses still running\n"); if (vnThreadsRunning[THREAD_STAKE_MINER] > 0) printf("ThreadStakeMiner still running\n"); while (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0 || vnThreadsRunning[THREAD_RPCHANDLER] > 0) MilliSleep(20); MilliSleep(50); DumpAddresses(); return true; } class CNetCleanup { public: CNetCleanup() { } ~CNetCleanup() { // Close sockets BOOST_FOREACH(CNode* pnode, vNodes) if (pnode->hSocket != INVALID_SOCKET) closesocket(pnode->hSocket); BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket) if (hListenSocket != INVALID_SOCKET) if (closesocket(hListenSocket) == SOCKET_ERROR) printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError()); #ifdef WIN32 // Shutdown Windows Sockets WSACleanup(); #endif } } instance_of_cnetcleanup; void RelayTransaction(const CTransaction& tx, const uint256& hash) { CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(10000); ss << tx; RelayTransaction(tx, hash, ss); } void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataStream& ss) { CInv inv(MSG_TX, hash); { LOCK(cs_mapRelay); // Expire old relay messages while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime()) { mapRelay.erase(vRelayExpiration.front().second); vRelayExpiration.pop_front(); } // Save original serialized message so newer versions are preserved mapRelay.insert(std::make_pair(inv, ss)); vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv)); } RelayInventory(inv); }
[ "BreakoutCoin@users.noreply.github.com" ]
BreakoutCoin@users.noreply.github.com
e8b530b46a0c794f87781fd6dbf38186f52c179c
3ea34c23f90326359c3c64281680a7ee237ff0f2
/Data/2451/H
cb2e7858153ea4b728cdf85e74b67bc723760a18
[]
no_license
lcnbr/EM
c6b90c02ba08422809e94882917c87ae81b501a2
aec19cb6e07e6659786e92db0ccbe4f3d0b6c317
refs/heads/master
2023-04-28T20:25:40.955518
2020-02-16T23:14:07
2020-02-16T23:14:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
91,826
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source Cstd::filesystem::create_directory();FD | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "Data/2451"; object H; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 4096 ( (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.8187504071923e-12,1.14778763052927e-11,-1.21530559580352e-11) (3.20420316287273e-12,2.32687804570544e-11,-1.17877857354911e-11) (4.56804805136083e-12,3.791624613847e-11,-1.08481892719083e-11) (6.55394423721697e-12,5.97827913812408e-11,-9.56345790397223e-12) (7.0818578151963e-12,9.25810768631403e-11,-7.85370590722618e-12) (5.65324870868563e-12,1.44964527640633e-10,-5.56572872310898e-12) (4.24563829734528e-12,2.30746096638789e-10,-3.13767454158745e-12) (3.22193232558615e-12,3.73937292358355e-10,-1.68313543185932e-12) (3.45703184780961e-12,6.11346470731087e-10,-1.01286431527076e-12) (4.01730700978986e-12,9.41392798683354e-10,-3.89238476151437e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.48898016153696e-12,1.07678410322294e-11,-2.57958462616229e-11) (6.56267673127115e-12,2.21569144259161e-11,-2.52828065970737e-11) (9.07365378992e-12,3.66233658068171e-11,-2.35593486856966e-11) (1.21958341230709e-11,5.83362390540329e-11,-2.10174952536704e-11) (1.2915444036109e-11,9.08665050882313e-11,-1.70116929711256e-11) (1.06294845591983e-11,1.43342470969556e-10,-1.18913910765516e-11) (8.02415431989563e-12,2.30012651019529e-10,-7.32794123227275e-12) (7.16414808138779e-12,3.73841156806806e-10,-4.59189902444297e-12) (8.42813138868945e-12,6.11397089541822e-10,-3.10113628997794e-12) (9.4292383181083e-12,9.41646119135592e-10,-1.60599876230596e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.80550388131997e-12,9.95594459709606e-12,-4.31756794346278e-11) (9.35426269376243e-12,2.03919019154172e-11,-4.17503156272778e-11) (1.3480235569295e-11,3.3986048401264e-11,-3.90844989607859e-11) (1.75214789712406e-11,5.44093779619977e-11,-3.5604407005325e-11) (1.88685383747311e-11,8.58807640228851e-11,-2.98098058565179e-11) (1.70321946836611e-11,1.38878288176485e-10,-2.24892319693527e-11) (1.38345625444735e-11,2.27261132600451e-10,-1.56821662910626e-11) (1.15298843393158e-11,3.72969888905714e-10,-1.11362810264584e-11) (1.21685809495875e-11,6.11247804794656e-10,-8.13271983373469e-12) (1.3262028376648e-11,9.41537393538789e-10,-4.67099186223234e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.4561927338781e-12,8.69511379046852e-12,-6.54363272542706e-11) (1.14348925536472e-11,1.80679725376759e-11,-6.40114805270037e-11) (1.72217324306164e-11,3.02474379758813e-11,-6.09014493494568e-11) (2.12335480089143e-11,4.84316315873462e-11,-5.64155529125501e-11) (2.3795001754922e-11,7.8333532326241e-11,-4.98519379080403e-11) (2.34804995307597e-11,1.31302649210515e-10,-4.13832406379872e-11) (2.08416462304793e-11,2.21663163491101e-10,-3.2617491592108e-11) (1.70146116936711e-11,3.70208012553864e-10,-2.52520802333692e-11) (1.55859629620856e-11,6.09327150721924e-10,-1.84489188219773e-11) (1.64743082475945e-11,9.39020987474547e-10,-1.01224744032123e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.37614040342334e-12,7.00445647157128e-12,-9.80149098794369e-11) (1.18419855575092e-11,1.4637403103667e-11,-9.65528416871989e-11) (1.83918226402356e-11,2.47681373302511e-11,-9.36365449788377e-11) (2.24160779671168e-11,4.0639667837471e-11,-8.94006191572874e-11) (2.55127474961355e-11,6.85848415169955e-11,-8.35447849466775e-11) (2.6287250514386e-11,1.20553534600669e-10,-7.58763649291562e-11) (2.39601982622256e-11,2.12459002732294e-10,-6.63345396424466e-11) (2.07177873568613e-11,3.63426613051275e-10,-5.30143351025988e-11) (1.98322861629659e-11,6.0213122427939e-10,-3.79553052623326e-11) (2.08174673464569e-11,9.30739745528964e-10,-2.00375663774415e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.63089424365217e-12,5.12864612646027e-12,-1.49136770449975e-10) (1.25657455377936e-11,1.07456686191003e-11,-1.47729917316285e-10) (1.85913010356784e-11,1.91085813129937e-11,-1.45576585879826e-10) (2.21567496480185e-11,3.30016928969409e-11,-1.42269959085773e-10) (2.44709725599113e-11,5.87177168052822e-11,-1.3730632590661e-10) (2.51224442758762e-11,1.09012714882724e-10,-1.2987612581142e-10) (2.40806892742251e-11,2.01464807602519e-10,-1.17476048128414e-10) (2.18186658567619e-11,3.50892785268856e-10,-9.79390265389889e-11) (2.17853171452702e-11,5.86712035362133e-10,-7.17646189065499e-11) (2.27487848270091e-11,9.13421508562247e-10,-3.8407006024624e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.09622732325186e-12,4.02304589160919e-12,-2.3138876099835e-10) (1.23570033968032e-11,8.07682883507952e-12,-2.30145167996741e-10) (1.7623684425857e-11,1.48323846583206e-11,-2.28784720333968e-10) (1.97644938634351e-11,2.67929608328454e-11,-2.26340879549467e-10) (2.0807637239026e-11,4.96130625827349e-11,-2.21905609994046e-10) (2.20768381241459e-11,9.58789734444911e-11,-2.13686719893525e-10) (2.40260185005549e-11,1.84652663589364e-10,-1.96884874119453e-10) (2.4064762815423e-11,3.27353345677019e-10,-1.69953632374563e-10) (2.50059362616108e-11,5.56248097022939e-10,-1.27764334694452e-10) (2.54132690311838e-11,8.7836847650639e-10,-6.96911297317356e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.84393924006723e-12,2.64110382799315e-12,-3.70513150301485e-10) (1.07656207957774e-11,5.74310538667767e-12,-3.70132341264506e-10) (1.48966212755489e-11,1.12359156638406e-11,-3.69292321901254e-10) (1.64711231091253e-11,2.13593859323102e-11,-3.67039928226601e-10) (1.66475356081901e-11,4.13217599839425e-11,-3.62387396271595e-10) (1.85993500828792e-11,8.20491543317339e-11,-3.52531529089892e-10) (2.17963716616387e-11,1.59499596486399e-10,-3.3154213205083e-10) (2.41194761054079e-11,2.8665243194418e-10,-2.9176932326967e-10) (2.60586179134209e-11,5.00384057724787e-10,-2.26247507909167e-10) (2.59561561569622e-11,8.11102600235256e-10,-1.28194515609484e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.23637243644051e-12,1.40069461582446e-12,-6.04587180592413e-10) (1.0731398180861e-11,3.55003920202821e-12,-6.04600413834341e-10) (1.28999636195453e-11,7.75387201055491e-12,-6.03882231905284e-10) (1.33945376615199e-11,1.57041707630562e-11,-6.01346124492301e-10) (1.32535840954767e-11,3.10083728063376e-11,-5.95711844000611e-10) (1.62081820941248e-11,6.16120678303237e-11,-5.82925461074133e-10) (2.00557342883549e-11,1.19812105203404e-10,-5.55442880268234e-10) (2.29410376028993e-11,2.2134229204894e-10,-5.01471436977561e-10) (2.56176359527175e-11,4.03557004351687e-10,-4.056558640718e-10) (2.55013311594491e-11,6.84219230249334e-10,-2.43538214352614e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.96206377843e-12,6.81923822922544e-13,-9.34303391210821e-10) (1.05385667855296e-11,1.9523799161242e-12,-9.33793730874773e-10) (1.08662440845415e-11,4.19949039445886e-12,-9.32418699585681e-10) (1.0294627529394e-11,8.58123770070591e-12,-9.29450432188968e-10) (1.06143905909445e-11,1.68822387965811e-11,-9.22866350998492e-10) (1.5057840846281e-11,3.34897244222131e-11,-9.07807671572915e-10) (1.96756520586229e-11,6.5519597583837e-11,-8.75148850811226e-10) (2.28485926213368e-11,1.25343259971967e-10,-8.10130987784926e-10) (2.58928177420813e-11,2.42081867245817e-10,-6.85245330635968e-10) (2.61773118337826e-11,4.41516767782893e-10,-4.42591371375628e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.16351545770839e-12,2.11294348838524e-11,-2.34281540131157e-11) (3.37647273042781e-12,4.32179473230313e-11,-2.24443576074927e-11) (4.57619701505761e-12,7.02866471869865e-11,-2.04955468483149e-11) (6.29074456767825e-12,1.09262703240527e-10,-1.74759474176973e-11) (6.50845240593031e-12,1.67277068593688e-10,-1.30247775462524e-11) (4.84725119825548e-12,2.58334309006821e-10,-7.89350491716156e-12) (3.52454480696823e-12,4.04764610388597e-10,-3.04628454585673e-12) (2.64779676040863e-12,6.53530610389321e-10,-2.69972665434527e-13) (2.7827871975862e-12,1.12767165047311e-09,4.50366557507435e-13) (3.37474808093106e-12,2.21190261236036e-09,2.79931436302164e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.78783693212173e-12,2.00695002777006e-11,-4.76448113487592e-11) (6.60423133039636e-12,4.11881873655296e-11,-4.63086850742612e-11) (9.16911776345324e-12,6.73695583559383e-11,-4.2709840726774e-11) (1.21168929325485e-11,1.0560785661371e-10,-3.67966704388933e-11) (1.27808832068846e-11,1.6303374699755e-10,-2.76556506347129e-11) (1.0530217507964e-11,2.54558715668315e-10,-1.68906651402285e-11) (8.03963053102897e-12,4.03553065109702e-10,-7.29263693236112e-12) (6.54465324829797e-12,6.53983623967288e-10,-2.60076247092262e-12) (7.08227860850892e-12,1.12848572718097e-09,-1.26482815092831e-12) (7.93196515271893e-12,2.21260026278914e-09,-7.9191678826047e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.64097088059804e-12,1.82553139333408e-11,-7.97183630430755e-11) (9.01237540501722e-12,3.74494396361198e-11,-7.71288000698553e-11) (1.37387540392297e-11,6.17056315085556e-11,-7.18934694274352e-11) (1.7704624197093e-11,9.75833324998267e-11,-6.36635125171454e-11) (1.90951961841637e-11,1.53187432117541e-10,-5.10052401434297e-11) (1.78007679713518e-11,2.45877137773386e-10,-3.5190350272855e-11) (1.48866463891919e-11,3.99955799333892e-10,-1.95302697682126e-11) (1.12881994982493e-11,6.54468313854871e-10,-1.19806383774113e-11) (1.06275070506401e-11,1.1298855530278e-09,-8.92430978819059e-12) (1.11074425784069e-11,2.21353666000273e-09,-5.47067531222834e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.72200332550779e-12,1.54631325432126e-11,-1.20958191773376e-10) (1.17554308101058e-11,3.22266881294706e-11,-1.17782457674241e-10) (1.82151366393318e-11,5.35816046103514e-11,-1.11601728321134e-10) (2.24618967542821e-11,8.53730991122615e-11,-1.02072932757293e-10) (2.50749952940981e-11,1.37177017491328e-10,-8.81774388372497e-11) (2.54638650947369e-11,2.29319515019395e-10,-6.95135149241457e-11) (2.26803956305418e-11,3.90550738884734e-10,-4.9031705749356e-11) (1.69928497849743e-11,6.53202202327103e-10,-3.69681031812589e-11) (1.44554449863815e-11,1.12967672514434e-09,-2.75539702502165e-11) (1.46330757908142e-11,2.21155019538164e-09,-1.53502186778325e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.78988255629676e-12,1.22451917215442e-11,-1.7909000408388e-10) (1.28174233337132e-11,2.58485541974544e-11,-1.76134356171447e-10) (1.98154528359422e-11,4.33597113348702e-11,-1.70435939072273e-10) (2.41982186970276e-11,6.99081246391282e-11,-1.61588638268053e-10) (2.77114521903407e-11,1.1555464838632e-10,-1.49372676310015e-10) (2.82862449456268e-11,2.033129432169e-10,-1.34391596837197e-10) (2.16341888521492e-11,3.69616239283536e-10,-1.20104579943304e-10) (1.81925852991998e-11,6.45983980323373e-10,-9.31867646179048e-11) (1.73337361951821e-11,1.12192841486561e-09,-6.58615437859952e-11) (1.80981379351007e-11,2.20079206272179e-09,-3.46446303814206e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.32964134481278e-12,9.25819390415288e-12,-2.68411847819523e-10) (1.30812538853523e-11,1.93418160263814e-11,-2.65886319611226e-10) (1.95608708962932e-11,3.28115153473624e-11,-2.61341531997061e-10) (2.3401848532968e-11,5.41794253886739e-11,-2.54515540924256e-10) (2.61454266872835e-11,9.38206674589206e-11,-2.45125781505305e-10) (2.58561080310581e-11,1.7837751503836e-10,-2.32322563216631e-10) (2.13558116980106e-11,3.52837095161743e-10,-2.13488384945672e-10) (1.91836978161958e-11,6.27641824831618e-10,-1.77589682592421e-10) (1.88916426024712e-11,1.09759853683076e-09,-1.28458398587259e-10) (1.93948108585931e-11,2.17217952304522e-09,-6.80229438734332e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.2345763852577e-12,6.92256454220454e-12,-4.09219300150431e-10) (1.33302791824328e-11,1.39889351756373e-11,-4.07066845888195e-10) (1.87763126358378e-11,2.39737559277986e-11,-4.0393671180748e-10) (2.07627992085399e-11,4.07683357156661e-11,-3.99695067444595e-10) (2.08800497373203e-11,7.39815460133792e-11,-3.94007601622364e-10) (1.91048114628623e-11,1.50040669987475e-10,-3.83571050660767e-10) (2.22478438586333e-11,3.23351883120826e-10,-3.516680641671e-10) (2.25763788680611e-11,5.86124558486118e-10,-3.08305778074564e-10) (2.27967705967899e-11,1.04350723570606e-09,-2.28414645164946e-10) (2.2988015570994e-11,2.11003341659795e-09,-1.23218715704608e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.70353941525635e-12,4.47451417418037e-12,-6.49699901708684e-10) (1.21186676171761e-11,9.74959817223162e-12,-6.48562113047587e-10) (1.61262712541859e-11,1.7991357635824e-11,-6.46351925228153e-10) (1.74738063233742e-11,3.23477555865371e-11,-6.4284492839135e-10) (1.71050556040627e-11,6.33795810650473e-11,-6.3782632434183e-10) (1.80470395452524e-11,1.34422584570239e-10,-6.26373131499678e-10) (2.17110541635072e-11,2.81788098951888e-10,-5.93031184351241e-10) (2.39078006399734e-11,5.09640043023721e-10,-5.20804662944954e-10) (2.48326789869878e-11,9.4254729828158e-10,-4.01134602810058e-10) (2.46450105327861e-11,1.99127048413895e-09,-2.27849902378801e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.96837647127023e-12,2.62707072267954e-12,-1.11677081027511e-09) (1.16108755377081e-11,6.23363543087318e-12,-1.11614849331303e-09) (1.39182378226604e-11,1.27784540028811e-11,-1.11443510129743e-09) (1.48831902321843e-11,2.46200127325555e-11,-1.11056557237903e-09) (1.45933351787715e-11,4.96420565583212e-11,-1.10292208973838e-09) (1.68479446963155e-11,1.03824944890388e-10,-1.08441031479786e-09) (2.03767986172519e-11,2.10109518769224e-10,-1.03897673972917e-09) (2.31244967740983e-11,3.91541888488217e-10,-9.44064931306826e-10) (2.4975123339381e-11,7.71703671845453e-10,-7.75023959994829e-10) (2.46655792733143e-11,1.76577120712999e-09,-4.8369214479909e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.13432726530468e-12,1.54171859443914e-12,-2.19848541709843e-09) (1.11159154125618e-11,3.63270315612398e-12,-2.19720066867607e-09) (1.20974670822858e-11,7.12714883125377e-12,-2.19451135529455e-09) (1.22917840396245e-11,1.37670705223852e-11,-2.18983924303928e-09) (1.24379499619398e-11,2.76630420224144e-11,-2.1798223846664e-09) (1.58887445067935e-11,5.68857465356902e-11,-2.15587523939855e-09) (2.01773866161474e-11,1.14221801817335e-10,-2.10095548386101e-09) (2.33061954443916e-11,2.22559346601127e-10,-1.98808880107881e-09) (2.53207257275607e-11,4.81363515735087e-10,-1.76600885081069e-09) (2.51027082411356e-11,1.28305197559792e-09,-1.28402343137723e-09) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.23965365795826e-12,2.67400893930104e-11,-3.25138324262703e-11) (3.45742192826219e-12,5.61691803733145e-11,-3.08706858648025e-11) (4.47368641632474e-12,9.23572294174461e-11,-2.77359926630042e-11) (5.49442132323849e-12,1.4261759768324e-10,-2.2879248676111e-11) (5.62050137254328e-12,2.14503962308605e-10,-1.5494475943343e-11) (3.77562416566291e-12,3.20903007795691e-10,-6.44517621601847e-12) (1.95977820514244e-12,4.78031322961152e-10,1.48186007644162e-12) (1.47444395929061e-12,7.06782459241937e-10,4.51404911734531e-12) (2.13914561119503e-12,1.0321346788424e-09,3.70502689711972e-12) (2.95702908830502e-12,1.42785204950107e-09,1.50216507493402e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.2658970016504e-12,2.57038715058094e-11,-6.55835358367795e-11) (6.74413471179496e-12,5.39352099655984e-11,-6.31689489809131e-11) (8.91987432151641e-12,8.84894132307216e-11,-5.74776682574523e-11) (1.1000397242915e-11,1.36751684947402e-10,-4.79694441024496e-11) (1.18622125930007e-11,2.07340437747884e-10,-3.31300414204548e-11) (9.61376719483485e-12,3.14900438513738e-10,-1.38444811313038e-11) (6.94502184445644e-12,4.77409436437633e-10,4.21862933785248e-12) (4.72402904218086e-12,7.09753064245218e-10,8.84847621836139e-12) (5.20954139858842e-12,1.03575310985291e-09,6.23151336941393e-12) (6.2036511513565e-12,1.43050109321509e-09,2.51554321121881e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.84358929561354e-12,2.34816139752477e-11,-1.08236081022163e-10) (8.99979627038318e-12,4.90588911447171e-11,-1.04501791890867e-10) (1.36328240278699e-11,8.0183620833349e-11,-9.62477797230969e-11) (1.72565852102216e-11,1.24053651299832e-10,-8.23320019951771e-11) (1.92907209398612e-11,1.91066908656076e-10,-6.05724466096625e-11) (1.86983102206307e-11,3.00328426188343e-10,-2.97725189290228e-11) (1.67420754485607e-11,4.76020642066678e-10,4.40548707880895e-12) (9.49798243552886e-12,7.16457904538635e-10,8.60877005640343e-12) (7.38270045927674e-12,1.04284729142264e-09,2.91118659943549e-12) (7.62323188666586e-12,1.43583993861212e-09,-5.14100810153971e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.76421004743716e-12,1.95691778634599e-11,-1.62434487963827e-10) (1.19528353902535e-11,4.11633465635401e-11,-1.5780072655855e-10) (1.89082343501039e-11,6.72270931412794e-11,-1.48102648039447e-10) (2.40313773066922e-11,1.04163227733798e-10,-1.32050017877309e-10) (2.80334404862563e-11,1.62904776869215e-10,-1.0679613739924e-10) (3.09886277222915e-11,2.68902962512031e-10,-6.73467619703684e-11) (3.15512926638901e-11,4.69768634480099e-10,-1.37493715514679e-11) (1.4796938857942e-11,7.28878435773256e-10,-1.30538499979492e-11) (1.00000036930431e-11,1.05253655389505e-09,-1.68741120360033e-11) (1.00409897721294e-11,1.44038691771662e-09,-1.18228080526122e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.82123246081921e-12,1.4846497723219e-11,-2.34442164052012e-10) (1.36257444068184e-11,3.18030352798093e-11,-2.30367650653601e-10) (2.1516348017842e-11,5.19240011308031e-11,-2.21572606505599e-10) (2.77109559895342e-11,7.91244572615591e-11,-2.06722253902906e-10) (3.44643536461823e-11,1.22242755527262e-10,-1.85349023629553e-10) (3.89346562293437e-11,2.06943499250455e-10,-1.59795620775274e-10) (1.14955176476026e-11,4.12588950114528e-10,-1.64033508626029e-10) (9.2095199588438e-12,7.41091301619733e-10,-1.05832265170909e-10) (1.04467008272367e-11,1.05674804189913e-09,-7.28168982981728e-11) (1.20660472298854e-11,1.43546078381189e-09,-3.86575517176209e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.13974249867865e-12,1.08462338261186e-11,-3.3778579370753e-10) (1.38893471215525e-11,2.2788470717617e-11,-3.34391410911433e-10) (2.15726392429346e-11,3.63189428714571e-11,-3.27750067209028e-10) (2.74231787884776e-11,5.38816656639288e-11,-3.17385446846764e-10) (3.31813298429732e-11,8.38665520862468e-11,-3.03594160673738e-10) (3.53587748111321e-11,1.60915332854262e-10,-2.85841209438669e-10) (1.49423213860495e-11,4.16003436807758e-10,-2.80962435796892e-10) (1.15696801559831e-11,7.32941114210592e-10,-2.22961455369105e-10) (1.2547489014018e-11,1.03440177076866e-09,-1.5658016319279e-10) (1.35179734313724e-11,1.40450957335912e-09,-8.13731887391965e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.53017249160067e-12,7.60389149778839e-12,-4.86222455566526e-10) (1.44394821042085e-11,1.5299200294806e-11,-4.83184380438588e-10) (2.05170665653514e-11,2.34202002493816e-11,-4.79026776047325e-10) (2.34959135152735e-11,3.28863223106288e-11,-4.75470550174956e-10) (2.10454637242069e-11,4.76146074659666e-11,-4.75681645907828e-10) (2.81991038649376e-12,9.42442467669745e-11,-4.80745712106623e-10) (2.04493419351883e-11,3.83814801877995e-10,-4.12747229563028e-10) (1.91697614200877e-11,6.85996075703714e-10,-3.99440887479432e-10) (1.85607785615606e-11,9.68667652183538e-10,-2.78619419300914e-10) (1.85322323258273e-11,1.32923630594385e-09,-1.43709123202535e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.41319420590054e-12,4.70314592282048e-12,-7.02623421529213e-10) (1.34244425393074e-11,1.00546488660281e-11,-7.00485353238365e-10) (1.78321780493454e-11,1.66546231170331e-11,-6.97957507759798e-10) (2.01829451290619e-11,2.61368454818998e-11,-6.96750029379899e-10) (1.93893872677267e-11,5.00474832353527e-11,-6.99281597667206e-10) (1.53027320771734e-11,1.25455137232251e-10,-7.04541280571331e-10) (2.11631129400366e-11,3.51581314892791e-10,-6.87135266949781e-10) (2.23358950393244e-11,5.68350535320727e-10,-5.85294234704765e-10) (2.23916049922544e-11,8.37833458865991e-10,-4.26670904382109e-10) (2.229438516351e-11,1.18919327779244e-09,-2.29919247039711e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.43141163728922e-12,2.68893340614442e-12,-1.01773848881451e-09) (1.24984157968805e-11,6.44943447408444e-12,-1.01653008213846e-09) (1.57000140765639e-11,1.21735186682429e-11,-1.01480437895163e-09) (1.80926498014179e-11,2.19240672291551e-11,-1.01243793111164e-09) (1.80605747746527e-11,4.68376758768813e-11,-1.00864715249769e-09) (1.83535679819952e-11,1.1071020811102e-10,-9.96871643925412e-10) (2.13527071470351e-11,2.47246778851303e-10,-9.54200174307891e-10) (2.30660673480923e-11,4.11307094248721e-10,-8.38339286781063e-10) (2.39834642545725e-11,6.43487129330333e-10,-6.48343428294037e-10) (2.36926660061137e-11,9.61651200841292e-10,-3.71775999412913e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.39129743663316e-12,1.41889919155385e-12,-1.40840609290491e-09) (1.20593051869682e-11,3.69566605274113e-12,-1.40749450129985e-09) (1.45525036585412e-11,7.06419303482317e-12,-1.40509999818431e-09) (1.60419961889667e-11,1.32669799252503e-11,-1.40086483538163e-09) (1.61538467167557e-11,2.83754513660687e-11,-1.39172131993641e-09) (1.78547355042744e-11,6.28975060667673e-11,-1.36850408070608e-09) (2.15325056516697e-11,1.28950567214055e-10,-1.31005482925277e-09) (2.37855917762521e-11,2.21447808231076e-10,-1.18308687459893e-09) (2.4698822029798e-11,3.68090820387949e-10,-9.61590511327858e-10) (2.41312524625178e-11,5.9126732972011e-10,-5.9257268294769e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.63272498370286e-12,2.96757447304379e-11,-3.79312664760086e-11) (2.55669913415875e-12,6.35653474736977e-11,-3.60419126521511e-11) (3.48475861617153e-12,1.04086303437644e-10,-3.22694349480844e-11) (3.97556132631873e-12,1.58921954619395e-10,-2.56531675931135e-11) (3.73472620594341e-12,2.34648093892181e-10,-1.54125241410133e-11) (1.85115715520239e-12,3.39603505580151e-10,-2.31777213622228e-12) (-4.50524312297618e-13,4.82993831917277e-10,9.39955202613194e-12) (-6.8713882376125e-13,6.61689849383991e-10,1.17373258372549e-11) (7.23576422825165e-13,8.61515381159068e-10,8.24008247287658e-12) (1.81015044920767e-12,1.03204508119327e-09,3.64854028216913e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.07356767634831e-12,2.81814489969496e-11,-7.82808357676397e-11) (5.92917280922577e-12,6.01876127754404e-11,-7.46706462926959e-11) (7.71744256386431e-12,9.83333516560934e-11,-6.74138781351193e-11) (8.85902820854075e-12,1.50428409043164e-10,-5.4683933804689e-11) (8.85018139563316e-12,2.24113349986397e-10,-3.37367248345585e-11) (6.12266905108862e-12,3.3089507535765e-10,-3.59610909811393e-12) (3.70396933488883e-12,4.8409926411981e-10,2.85063171512159e-11) (6.36151597783995e-13,6.68180556828946e-10,3.00638770739326e-11) (1.83132998708713e-12,8.68558240613717e-10,1.87353957629765e-11) (3.38034896535152e-12,1.03781142216654e-09,7.95813083972621e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.0217362760971e-12,2.55407866552764e-11,-1.27065413947366e-10) (8.64132868378345e-12,5.40818653872713e-11,-1.219285749458e-10) (1.26735739920178e-11,8.74574156787424e-11,-1.11253236382273e-10) (1.53874533907562e-11,1.32648856561469e-10,-9.21468303198683e-11) (1.66529250460793e-11,1.99145833941526e-10,-5.9559709545205e-11) (1.59457678890235e-11,3.06902398268248e-10,-4.82312608640934e-12) (1.87908000576736e-11,4.93472045641248e-10,7.68764883168722e-11) (2.77503465769441e-12,6.88191891535916e-10,6.02690978854349e-11) (1.11872539634894e-12,8.85136742001e-10,2.86787635191932e-11) (2.56215197254782e-12,1.05020555252393e-09,9.52859031705446e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.85312878244544e-12,2.11934273332211e-11,-1.8796646824722e-10) (1.16150681548842e-11,4.44467876388001e-11,-1.81958169561909e-10) (1.81586961984353e-11,7.08138029141902e-11,-1.69450124774441e-10) (2.38162673008396e-11,1.0476820939266e-10,-1.4703558871332e-10) (2.92460863993534e-11,1.5341700628588e-10,-1.06790391628043e-10) (3.93507005649495e-11,2.4531412466347e-10,-2.41984059424603e-11) (8.80354554759431e-11,5.43550357085695e-10,2.06081712854474e-10) (6.40433504940791e-12,7.4212362197994e-10,8.58305474486828e-11) (7.37211705675718e-13,9.14657799013198e-10,2.00998188037141e-11) (3.14431562392276e-12,1.06587208569937e-09,1.15086051388553e-14) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.74698295950146e-12,1.60957062684215e-11,-2.64254993185956e-10) (1.38452648210199e-11,3.31786438188926e-11,-2.58816018797267e-10) (2.22710536744774e-11,5.11840526497198e-11,-2.47115340859456e-10) (3.1580517313801e-11,6.98826704719721e-11,-2.26026829167972e-10) (4.7287154232934e-11,8.52108205449131e-11,-1.89721721327706e-10) (8.92007104762747e-11,7.50434501373453e-11,-1.23587523807167e-10) (-5.01202125007522e-11,1.02300031177433e-09,-4.58008029749316e-17) (-1.56556595048169e-11,8.70565215981328e-10,-7.00392829827285e-11) (-1.36637462286248e-12,9.52526422335111e-10,-5.56984054338848e-11) (4.35970596536146e-12,1.07416461186988e-09,-3.30922690403497e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.98770203091458e-12,1.14195732199585e-11,-3.64484780151465e-10) (1.47372738419652e-11,2.23012600086166e-11,-3.59984853003891e-10) (2.41067615027653e-11,3.13738528221503e-11,-3.51149094263044e-10) (3.46272359687268e-11,3.54165587910824e-11,-3.36487755818197e-10) (5.16803232281498e-11,2.5234677071662e-11,-3.12494719325175e-10) (9.71510872566262e-11,-1.30645804376573e-11,-2.57130657644726e-10) (-1.08700241120245e-11,1.04291945452007e-09,-5.83959679260964e-16) (-7.86657351332181e-12,8.9339710596532e-10,-2.18325553190052e-10) (3.07463314556754e-12,9.4267425092785e-10,-1.56074298292321e-10) (7.41805210724753e-12,1.04790852495004e-09,-8.12142850298791e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.39284293871594e-12,7.12929995310962e-12,-4.94118211096108e-10) (1.55264291416547e-11,1.32250640606214e-11,-4.90896431102803e-10) (2.37264178253652e-11,1.51416716340398e-11,-4.86221252128238e-10) (3.04564860769015e-11,5.53868347570896e-12,-4.83942677444655e-10) (2.36766541535103e-11,-4.76154947301627e-11,-4.9944439258442e-10) (-9.63894626223596e-11,-2.99561959189178e-10,-6.19455426538744e-10) (3.93764868369896e-11,1.25037440166335e-09,-1.37330059644698e-09) (1.59938336244499e-11,8.76813286399755e-10,-5.87823088624216e-10) (1.4484675780657e-11,8.78410998040551e-10,-3.15865359852368e-10) (1.48661372747809e-11,9.71126629763152e-10,-1.48012199024058e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.28933843177794e-12,3.90862915941435e-12,-6.56174339629719e-10) (1.45018114526667e-11,7.69079243192476e-12,-6.54103462445431e-10) (2.1105804118237e-11,8.78552151986512e-12,-6.52176872357795e-10) (2.69272916689828e-11,4.10292452441421e-12,-6.54588031862344e-10) (2.78588775304695e-11,-6.91879782372694e-12,-6.71854549601761e-10) (1.26416475766311e-11,1.36295457603019e-11,-7.33440840735386e-10) (2.36566167367289e-11,5.04273288252731e-10,-8.69769566142182e-10) (2.0756005788582e-11,6.13986313333644e-10,-6.36597359650631e-10) (1.99862771857179e-11,7.13520826227212e-10,-4.14822126596286e-10) (1.99172150746332e-11,8.25244747275849e-10,-2.08675076698874e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.49303917567374e-12,1.89637814007146e-12,-8.4415306410393e-10) (1.35264810314066e-11,4.75706279955725e-12,-8.43087962844244e-10) (1.84428918701677e-11,7.20869550162282e-12,-8.42090431069694e-10) (2.29589584912153e-11,9.88164031636497e-12,-8.42790117144589e-10) (2.47472907131995e-11,2.29113328055447e-11,-8.48032605548451e-10) (2.34948004086829e-11,8.0055324755438e-11,-8.58614039145283e-10) (2.37880312573414e-11,2.70749371875984e-10,-8.51683845545579e-10) (2.29294948788953e-11,3.94660162523466e-10,-7.1232456355928e-10) (2.28123443157408e-11,5.0943083667363e-10,-5.14925845528749e-10) (2.23005377144469e-11,6.18331916130883e-10,-2.75575887532425e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.8986050231288e-12,9.05672948029719e-13,-1.00916334763493e-09) (1.33604681241734e-11,2.79395904996401e-12,-1.00849086802817e-09) (1.73815338906894e-11,4.92446888887242e-12,-1.00681710200235e-09) (2.0165460668982e-11,8.47944044121956e-12,-1.00456772771907e-09) (2.13120588525035e-11,2.03860628225143e-11,-1.0010160595094e-09) (2.23029901177849e-11,5.44632695812849e-11,-9.88085756846282e-10) (2.35151182117499e-11,1.28035742637611e-10,-9.41511320782074e-10) (2.37370367364374e-11,1.9786372596736e-10,-8.15940493112145e-10) (2.37718140373737e-11,2.71607187741581e-10,-6.17636331346136e-10) (2.28258992349806e-11,3.43936502425164e-10,-3.4489139196598e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.23766689334826e-12,3.09821545102671e-11,-4.02695377304149e-11) (2.16195612835107e-12,6.68110706424187e-11,-3.91035371671574e-11) (2.62144304276195e-12,1.089010594577e-10,-3.52103338178771e-11) (2.22846345044754e-12,1.63883831107653e-10,-2.73536629331566e-11) (1.17471810693048e-12,2.35926393254996e-10,-1.52368110167754e-11) (-1.15773678462627e-12,3.30441602540204e-10,6.13940024435577e-13) (-3.89373032597118e-12,4.52794635261132e-10,1.63395762127117e-11) (-3.68060290436601e-12,5.88418107526504e-10,1.8535195368796e-11) (-1.72774084109625e-12,7.15478024348842e-10,1.25698956788586e-11) (-3.0765024175624e-13,8.02175273936187e-10,5.6908010065025e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.10404054311505e-12,2.92616625002629e-11,-8.58776019434457e-11) (4.77815203980183e-12,6.30001408516451e-11,-8.25408071086539e-11) (5.8634342107964e-12,1.0229465684292e-10,-7.430516257245e-11) (5.691371720063e-12,1.53639488427883e-10,-5.91416008219349e-11) (3.67708170410489e-12,2.22082169728683e-10,-3.38988439144562e-11) (-1.98708010883366e-12,3.17030096788091e-10,4.52055529827293e-12) (-7.22637210922297e-12,4.53137883845903e-10,5.32379639237916e-11) (-8.04670179834761e-12,5.96285038834587e-10,5.25456260329861e-11) (-3.96990647687018e-12,7.23949222951769e-10,3.09339722770758e-11) (-1.05565055233711e-12,8.09398155071016e-10,1.27620754386236e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.23225659655674e-12,2.61569932468287e-11,-1.38459998872264e-10) (7.60106786875393e-12,5.58156137521508e-11,-1.33194826457322e-10) (1.02107806941825e-11,8.9417239677772e-11,-1.20968746713297e-10) (1.06809797848423e-11,1.31684701099315e-10,-9.9001000567147e-11) (7.64516924291264e-12,1.87863091510842e-10,-6.06839781276952e-11) (-4.1655729094114e-12,2.73932117528587e-10,9.67814518228401e-12) (-1.46801209552632e-11,4.62687322082744e-10,1.65542800906322e-10) (-1.95663614201275e-11,6.23648460460578e-10,1.30007146493081e-10) (-9.25215841376872e-12,7.45771717672157e-10,5.80212809358465e-11) (-3.57579088575685e-12,8.25066302709455e-10,1.95073822117487e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.94255116192154e-12,2.16192060095357e-11,-2.0044968258809e-10) (1.0375167187333e-11,4.52023791365516e-11,-1.94271149394017e-10) (1.53739104018026e-11,7.0512183289977e-11,-1.80020608030375e-10) (1.84566091362708e-11,9.82566138776648e-11,-1.54920731600438e-10) (1.48602864547194e-11,1.24111709162794e-10,-1.12869484826421e-10) (-2.06587437059068e-11,1.26178725900104e-10,-4.95698637387546e-11) (-2.71163333806896e-10,5.2607164187212e-10,1.74773760544678e-16) (-5.63065303069974e-11,7.07650663176716e-10,3.11521825187139e-10) (-1.70431014177223e-11,7.89376019767749e-10,7.80690954330433e-11) (-5.13670194166304e-12,8.47871503492373e-10,1.58375427436416e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.98414161926888e-12,1.64575397111898e-11,-2.74569896870184e-10) (1.30219706934783e-11,3.3038551862476e-11,-2.6857645043108e-10) (2.09927418105707e-11,4.91258481999256e-11,-2.54758875222949e-10) (2.97415211543997e-11,6.22706853742109e-11,-2.29407020504164e-10) (4.11291001856741e-11,6.71304336914447e-11,-1.85203945251246e-10) (5.37212630449797e-11,5.9808716479248e-11,-1.10936659993851e-10) (-1.18064566341242e-16,7.22658115112092e-16,-2.93444008258104e-17) (-5.28284270376153e-11,9.57136004607371e-10,5.96300743163797e-17) (-1.41203396091788e-11,8.55477765493306e-10,-2.03546497776723e-11) (-2.47647615503445e-12,8.65898234284218e-10,-2.07276929286226e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.7780481501772e-12,1.11994010119312e-11,-3.64847678195579e-10) (1.49777110491252e-11,2.10716417897718e-11,-3.59528243734355e-10) (2.5677604246008e-11,2.76906828555342e-11,-3.48040302018504e-10) (4.05120747911163e-11,2.57889120852035e-11,-3.2652318097599e-10) (6.91664333494956e-11,7.75266841355013e-12,-2.86049800257507e-10) (1.265183923232e-10,-2.52058706836219e-11,-1.99227680096694e-10) (-2.02493411094052e-18,5.47065219110972e-16,-5.36551585975358e-17) (-5.35340088455881e-11,9.29793911637959e-10,-2.66541880785658e-16) (-7.5221272295117e-12,8.46161993649755e-10,-1.08087815428578e-10) (2.98566226415348e-12,8.43508849534351e-10,-6.80381312309309e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.39173373911204e-12,6.29687582747793e-12,-4.69979248419052e-10) (1.63855217958056e-11,1.09411575907078e-11,-4.66290060878025e-10) (2.78039932559499e-11,9.75548919292588e-12,-4.5932422992705e-10) (4.73939601679337e-11,-6.55127189256552e-12,-4.48197010014044e-10) (1.02990991201411e-10,-5.74084329196994e-11,-4.28996891544721e-10) (3.44264202336258e-10,-1.6557500488118e-10,-3.68803828434981e-10) (9.24249549328501e-17,7.52893705047052e-16,-9.30088271555237e-16) (6.86307791868796e-12,9.93838912870607e-10,-6.37932219265928e-10) (1.1521686765752e-11,7.95075402162522e-10,-3.09386389775391e-10) (1.27358207379363e-11,7.72839924742592e-10,-1.38518253936434e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.23071226675967e-12,3.22913879447165e-12,-5.86065708547381e-10) (1.55089509974466e-11,5.21553176427041e-12,-5.83649992017181e-10) (2.50937896410024e-11,1.21214873361392e-12,-5.80625415514485e-10) (3.84150936164913e-11,-1.88514434435277e-11,-5.80519334325108e-10) (5.96150380347859e-11,-8.50414122574546e-11,-5.95508853218535e-10) (8.25445939883129e-11,-3.20216028442046e-10,-6.73843107977998e-10) (2.40083266220148e-11,6.37932100251056e-10,-1.04339833235075e-09) (1.83069235442984e-11,6.27033025784215e-10,-6.44957671386293e-10) (1.79292168418893e-11,6.14861254423354e-10,-3.83447285054641e-10) (1.81549695208248e-11,6.32790527505405e-10,-1.83510786019873e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.41864310807292e-12,1.2799835920148e-12,-6.98197618443613e-10) (1.44920530063683e-11,2.66094492257169e-12,-6.96845173121006e-10) (2.1426804557886e-11,1.35105090030008e-12,-6.95418409985426e-10) (2.96036467701862e-11,-4.68222463954323e-12,-6.96266174088703e-10) (3.78539942930774e-11,-1.28953992184331e-11,-7.04970621774398e-10) (4.21566619831193e-11,6.61197802661958e-12,-7.30613551205739e-10) (2.71423785094042e-11,2.70941076593595e-10,-7.69807388794051e-10) (2.2327213404471e-11,3.64262616517371e-10,-6.12365201618267e-10) (2.12860352514995e-11,4.13508550236177e-10,-4.18959238855015e-10) (2.11200638877536e-11,4.49621587373629e-10,-2.14266262876192e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (7.13179836440241e-12,4.1650183537897e-13,-7.78720825797471e-10) (1.44806611483115e-11,1.46242968909906e-12,-7.7794841006182e-10) (2.00566284962843e-11,1.89896359272963e-12,-7.7631228072456e-10) (2.50932329005298e-11,2.20417257916354e-12,-7.74617870398266e-10) (2.87678190119024e-11,7.67543287444758e-12,-7.74199491508637e-10) (3.01918236348613e-11,3.50572718587528e-11,-7.69833554459651e-10) (2.59800331794322e-11,1.1715727532638e-10,-7.38588864137739e-10) (2.32966009377911e-11,1.71883408977552e-10,-6.21307956493093e-10) (2.26340623988173e-11,2.09751893960957e-10,-4.48527238060135e-10) (2.18710096941285e-11,2.36537372061439e-10,-2.37571859150057e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.79215834009402e-12,3.17826892514696e-11,-4.10773687246957e-11) (2.07968256984172e-12,6.88217964647114e-11,-3.98164099594923e-11) (1.37117477282118e-12,1.10909808405992e-10,-3.58012060984962e-11) (3.55954213839935e-13,1.63381034430672e-10,-2.84556987163106e-11) (-8.31809407967663e-13,2.28963620731797e-10,-1.67377072410251e-11) (-3.4718672208171e-12,3.10670037032559e-10,-3.63775921983785e-13) (-6.43259806675886e-12,4.11564712483592e-10,1.64741152081661e-11) (-5.58223452260173e-12,5.14753518779671e-10,1.92802942353458e-11) (-3.31984477161686e-12,6.01977399685901e-10,1.30286195649083e-11) (-1.83973037002549e-12,6.55121380825489e-10,5.96213014436835e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.87191496176828e-12,3.00179886096734e-11,-8.85291182961585e-11) (3.727034603082e-12,6.4818203525144e-11,-8.50812189657247e-11) (3.57728962543589e-12,1.04118648787952e-10,-7.66418396738978e-11) (2.40340214113766e-12,1.52471011930126e-10,-6.16220899354328e-11) (-5.23239290777389e-13,2.13451331799941e-10,-3.64481049828537e-11) (-7.60650947486022e-12,2.94180943945203e-10,2.62457821942718e-12) (-1.60834724552926e-11,4.08199682665432e-10,5.29641744848037e-11) (-1.37984696684014e-11,5.20004669365247e-10,5.44138172489799e-11) (-7.62050435889361e-12,6.08491479817218e-10,3.25897239464528e-11) (-3.96172275217007e-12,6.60639167533158e-10,1.35780115527347e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.50487141890411e-12,2.65831549370936e-11,-1.42581439558017e-10) (5.9882227403413e-12,5.68934564944447e-11,-1.37326474743286e-10) (7.14809093581167e-12,9.01268863302134e-11,-1.24905283257183e-10) (5.79204456704058e-12,1.28809885232324e-10,-1.0288629365508e-10) (1.03442828094439e-12,1.76075751722514e-10,-6.49672060740983e-11) (-1.22768370049719e-11,2.44673823707858e-10,4.53673359798433e-12) (-4.25287863313917e-11,4.06047824042188e-10,1.58658349838292e-10) (-3.15826985790956e-11,5.39889863521059e-10,1.32035073974363e-10) (-1.43425617852819e-11,6.26524600471486e-10,6.07561747359644e-11) (-6.87360945710742e-12,6.73795090101924e-10,2.08845895925567e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.92568426622446e-12,2.20247509962954e-11,-2.04193627615769e-10) (8.28845309775338e-12,4.60601729619469e-11,-1.98119057596008e-10) (1.16603690619581e-11,7.04594018901679e-11,-1.83571173763558e-10) (1.2391290865701e-11,9.41737246932557e-11,-1.58039863502353e-10) (8.54194083840384e-12,1.10507217297826e-10,-1.17026593534956e-10) (-3.85877279758036e-12,9.41593822728834e-11,-5.87241355922497e-11) (-5.6614065006267e-11,4.34918542806602e-10,9.88033675992562e-17) (-7.23391419835593e-11,6.06282864763957e-10,3.04253399624387e-10) (-2.09132944538438e-11,6.63505515650254e-10,8.20572628009148e-11) (-7.32588998982367e-12,6.93480813444131e-10,1.82709576395826e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.24883387939185e-12,1.71314540961442e-11,-2.734179082324e-10) (1.11713055580766e-11,3.41640795851359e-11,-2.67257718943438e-10) (1.70760524361594e-11,4.91879946378736e-11,-2.52572682790941e-10) (2.2020219190511e-11,6.00002595911951e-11,-2.2578229178382e-10) (2.62395802061385e-11,6.23500601658524e-11,-1.80339434758409e-10) (2.77992195584111e-11,5.50842989764789e-11,-1.07019343372552e-10) (-3.14461454823108e-17,3.6457511913893e-16,-2.75321021041905e-17) (-5.13162466045675e-12,8.15837740281381e-10,6.87254505224197e-17) (-4.43152461463594e-12,7.19690103044568e-10,-1.45087374373122e-11) (-8.14784333761681e-13,7.08314662880048e-10,-1.67673981557522e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.3611388734226e-12,1.20460530752797e-11,-3.51537198960433e-10) (1.36202535323198e-11,2.2342834292948e-11,-3.45716338416114e-10) (2.20956768661523e-11,2.8434014766988e-11,-3.3257009713346e-10) (3.2378878050308e-11,2.59584303630571e-11,-3.07881121128973e-10) (4.75054145219503e-11,1.00427310996013e-11,-2.62015820845127e-10) (6.76599000792224e-11,-1.50527347763388e-11,-1.72047113365283e-10) (5.03330214110161e-18,2.15747233665455e-16,-4.5610936627187e-17) (-9.4914611915367e-12,7.88063448503891e-10,-1.97159100255857e-16) (3.51478006005938e-12,7.08521617805301e-10,-9.2722358229005e-11) (5.61645582493573e-12,6.86572950748091e-10,-5.91589808734109e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.77028323105979e-12,7.32703714389885e-12,-4.35390734264387e-10) (1.51453166713045e-11,1.21525726013982e-11,-4.30944874774436e-10) (2.52201138022697e-11,1.08494977939276e-11,-4.21738675727882e-10) (4.04940132495676e-11,-4.87895113499983e-12,-4.04958393648817e-10) (7.0430907429409e-11,-4.80539227532112e-11,-3.72667673474536e-10) (1.30102327550393e-10,-1.24524314426807e-10,-2.90583196243154e-10) (3.42452613656835e-17,3.47278228181393e-16,-4.66837082067393e-16) (4.51231355145226e-11,8.49052889583654e-10,-5.46857422141791e-10) (2.08676986659678e-11,6.63136428308922e-10,-2.68407078191825e-10) (1.4266964038697e-11,6.23034404199906e-10,-1.20055676139964e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.76415093902754e-12,3.993260598043e-12,-5.19533552758312e-10) (1.5038961336433e-11,5.66924859419987e-12,-5.1628183369778e-10) (2.48488062849208e-11,7.17129107991814e-13,-5.11252513887554e-10) (3.9235393705959e-11,-2.17960387923564e-11,-5.06250535983876e-10) (6.58032797552326e-11,-9.27115058127856e-11,-5.11184865319996e-10) (1.25271811892447e-10,-3.25307215239899e-10,-5.68650420785679e-10) (-7.44131068498596e-12,5.46857317520956e-10,-8.86629552775525e-10) (1.95669464794755e-11,5.35354885071334e-10,-5.5146513208227e-10) (1.93454219943422e-11,5.05903487737601e-10,-3.25564114752491e-10) (1.78131236326895e-11,5.00530078847901e-10,-1.54148712154213e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.9296795421712e-12,1.80736028863197e-12,-5.90925159915041e-10) (1.42638051042711e-11,2.91753504778177e-12,-5.8858870263859e-10) (2.17266559686397e-11,3.74367719917141e-13,-5.85325224983026e-10) (3.14216972371876e-11,-8.45167866504948e-12,-5.82936823952755e-10) (4.29260916315437e-11,-2.29162911203956e-11,-5.86539438384281e-10) (5.29052057392693e-11,-1.40216104751574e-11,-6.05716493210307e-10) (2.34839926008566e-11,2.29248436629187e-10,-6.40112005287478e-10) (2.13004581810435e-11,3.06219061164472e-10,-5.04084008123324e-10) (2.0349715547884e-11,3.32630200477885e-10,-3.38622130401019e-10) (1.99380163238279e-11,3.46426527068899e-10,-1.70235935461924e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.77588446413102e-12,5.41071309109813e-13,-6.36248636463918e-10) (1.430696150015e-11,1.60361644857355e-12,-6.3481906147349e-10) (2.02611817627209e-11,1.39387159174181e-12,-6.31410599767799e-10) (2.6879026590064e-11,-2.64378127289824e-14,-6.27103715205252e-10) (3.20773148373645e-11,2.03190368243918e-12,-6.23781380689004e-10) (3.40044051717011e-11,2.41785530877702e-11,-6.18425130560886e-10) (2.58564008611656e-11,9.83837281771217e-11,-5.91018021227635e-10) (2.23992914823847e-11,1.42256714211716e-10,-4.89477227734905e-10) (2.14305774497008e-11,1.65189126013776e-10,-3.45338804491388e-10) (2.08365226054877e-11,1.77777595873747e-10,-1.78930992599842e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.29590021675413e-12,3.25898549632806e-11,-4.14041396950743e-11) (2.0680716483777e-12,6.92559374365421e-11,-3.98332308991431e-11) (8.16827008678594e-13,1.10315632282143e-10,-3.58849171880295e-11) (-4.52014760898014e-13,1.59308787341112e-10,-2.9548145790404e-11) (-1.69345179516443e-12,2.18751772295415e-10,-1.95431334744738e-11) (-3.82066526361237e-12,2.89037983050407e-10,-5.3612795737139e-12) (-5.87374727579805e-12,3.71608076872863e-10,8.80377565821735e-12) (-4.58171043773422e-12,4.52572916214283e-10,1.17952675040775e-11) (-2.76743548233033e-12,5.17367381974296e-10,7.93883288454528e-12) (-1.39538693329689e-12,5.54346880218329e-10,3.57367940592346e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.85884930392134e-12,3.09014943035452e-11,-8.84536434038778e-11) (3.21240234193028e-12,6.53986047286795e-11,-8.5175491229881e-11) (2.54930234473805e-12,1.04124744020791e-10,-7.74500361781089e-11) (8.90543886363708e-13,1.49265349028874e-10,-6.39026481126592e-11) (-2.2203424156603e-12,2.04263965143299e-10,-4.19161818511692e-11) (-8.43898550291602e-12,2.73087615034668e-10,-9.25070904118501e-12) (-1.53812565962164e-11,3.6489283884116e-10,3.06704435449092e-11) (-1.18595705216965e-11,4.53805420224194e-10,3.49595615657133e-11) (-6.64191261945129e-12,5.20689170788068e-10,2.15981102485883e-11) (-3.53963376835586e-12,5.57330566365565e-10,8.9674124585496e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.80831054497028e-12,2.79671807597717e-11,-1.42014069792085e-10) (4.40031478673793e-12,5.81924546111827e-11,-1.37183976407265e-10) (4.79658577375625e-12,9.11475623802679e-11,-1.25957574081323e-10) (2.50911752511591e-12,1.27584647700512e-10,-1.0607032808461e-10) (-2.90097696641482e-12,1.70503566869622e-10,-7.35860593026558e-11) (-1.58840118103391e-11,2.27565548642597e-10,-1.83920087958344e-11) (-4.47762292318607e-11,3.47223522097663e-10,9.44388628185355e-11) (-2.66968005835851e-11,4.58587599065321e-10,8.26818068828967e-11) (-1.14518918205391e-11,5.2948909325383e-10,3.81845627508355e-11) (-5.67474320677274e-12,5.6449419674006e-10,1.26959002394617e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.74441114661116e-12,2.37977519175164e-11,-2.02087930426359e-10) (5.63666264214015e-12,4.81281265557395e-11,-1.96455921418216e-10) (7.40046605300863e-12,7.27343962491457e-11,-1.83303326387066e-10) (5.55148600039923e-12,9.61544559788065e-11,-1.60159895410637e-10) (-1.60335997235575e-12,1.13310312118063e-10,-1.25277080563573e-10) (-2.35079238968094e-11,1.00031206107808e-10,-8.29642974576688e-11) (7.40508124041945e-11,3.0276596359566e-10,-8.76328133370707e-11) (-5.9697880677514e-11,4.76472247444275e-10,1.77976394311456e-10) (-1.33115766868523e-11,5.4507973378714e-10,4.37527086951161e-11) (-3.88878178619018e-12,5.72774929865591e-10,7.49841452807357e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.17404561125713e-12,1.87286238234738e-11,-2.67270212885565e-10) (8.30751469779739e-12,3.67365852289074e-11,-2.61405861978641e-10) (1.103964129994e-11,5.2537914824694e-11,-2.47415239942391e-10) (1.06191913932272e-11,6.48396425675103e-11,-2.22804817170094e-10) (5.22681788654132e-12,7.12567403569229e-11,-1.83368439640415e-10) (-9.08306252920534e-12,7.75407390536749e-11,-1.20083356880862e-10) (2.11241873645541e-17,3.69623139998323e-16,-1.00947994647017e-16) (3.71514732798012e-11,5.33910251833651e-10,-6.95550827749528e-11) (8.99562134312938e-12,5.63665092507958e-10,-3.80314531605717e-11) (4.15952964253674e-12,5.7429637486488e-10,-2.25091788789732e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.25929426046991e-12,1.33802780526984e-11,-3.34521741052599e-10) (1.06642739412188e-11,2.52042101530925e-11,-3.29011482453114e-10) (1.49912178347019e-11,3.3111658348526e-11,-3.15841304114276e-10) (1.73509592645642e-11,3.45725224191668e-11,-2.92776945476278e-10) (1.56333608949051e-11,2.65865198724394e-11,-2.5277098372256e-10) (5.08441197534e-12,1.16212570176399e-11,-1.75243256349417e-10) (2.50504712538332e-17,2.48077421375938e-16,-1.34723560705516e-16) (2.22412587986045e-11,5.06699032281262e-10,-1.08207594723513e-10) (1.53365922008991e-11,5.43420601711187e-10,-1.03684363854455e-10) (9.9960214996764e-12,5.48738743363677e-10,-5.67086671643737e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.65820028693212e-12,8.98172867367075e-12,-4.0257908114974e-10) (1.24224416319562e-11,1.57012865777718e-11,-3.98131026007783e-10) (1.85722004091471e-11,1.72296241313602e-11,-3.87724628048976e-10) (2.51203807326246e-11,8.72834320569213e-12,-3.70067738634896e-10) (3.30040132576204e-11,-1.7840417225678e-11,-3.38287162584758e-10) (4.03024989574043e-11,-6.55570057839389e-11,-2.62847673950561e-10) (1.93072384145166e-17,3.10132988416338e-16,-4.26254422295802e-16) (8.03707960768793e-11,4.84458742063571e-10,-3.64851937091649e-10) (2.97492371853593e-11,4.92893733338884e-10,-2.11229325653464e-10) (1.67156132506974e-11,4.90440566483162e-10,-9.89877117787296e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.69833218788774e-12,5.6584066461367e-12,-4.65528087102237e-10) (1.27613550726146e-11,9.03802929010849e-12,-4.61916411080484e-10) (2.0189589769342e-11,7.09820811460194e-12,-4.54763267171636e-10) (3.08253629147554e-11,-6.36609089197039e-12,-4.45340921065516e-10) (5.34736205285312e-11,-4.96319063405058e-11,-4.37150950726883e-10) (1.31965339117548e-10,-1.84801736329412e-10,-4.43070488061027e-10) (-2.49968504864601e-11,3.23282581042743e-10,-5.15729148420252e-10) (2.28017530565474e-11,3.73531100099357e-10,-3.97660901923036e-10) (2.12033066557691e-11,3.88315857067905e-10,-2.55318905867276e-10) (1.77679632573982e-11,3.93174041675987e-10,-1.24114982263126e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.85951124523792e-12,2.9415883591323e-12,-5.14308789246082e-10) (1.23142460479257e-11,5.24208122160021e-12,-5.11278151916352e-10) (1.83187510665375e-11,4.66351283207057e-12,-5.05789613010825e-10) (2.65990708163725e-11,-5.10325218166987e-14,-4.99154199991526e-10) (3.7154951654754e-11,-7.43739032910919e-12,-4.9314258430323e-10) (4.91005542535098e-11,5.10278003750587e-12,-4.90081402907956e-10) (1.83207038887095e-11,1.66558340395426e-10,-4.82069805122386e-10) (1.9800927411489e-11,2.33273366019039e-10,-3.91977804617405e-10) (1.94045950728915e-11,2.60311278669627e-10,-2.68422789337103e-10) (1.83510120570923e-11,2.71243705581607e-10,-1.35470708790408e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.88738078281257e-12,1.0185018328761e-12,-5.42221884583643e-10) (1.25021162430325e-11,2.52959656516735e-12,-5.39985685100164e-10) (1.73481687919159e-11,3.16697654838009e-12,-5.34569367786929e-10) (2.35302542610877e-11,2.94175446164337e-12,-5.27246154817366e-10) (2.87529683916849e-11,5.68736877856026e-12,-5.18288053551991e-10) (3.07758489262212e-11,2.39525665812458e-11,-5.03878171775489e-10) (2.26993355455569e-11,7.75304660992389e-11,-4.69481106459699e-10) (2.05175824505858e-11,1.12059007870968e-10,-3.87402855985405e-10) (2.02118915719104e-11,1.30085098412427e-10,-2.72741968515703e-10) (1.9683125879388e-11,1.38461559193671e-10,-1.4048938898494e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.41335208061484e-12,3.2330535661653e-11,-4.22332046060195e-11) (1.97709064508034e-12,6.85134701290521e-11,-4.04362113647784e-11) (6.70943872441276e-13,1.08642334597964e-10,-3.67733437543705e-11) (-4.13588764599338e-13,1.546986488493e-10,-3.14137278861592e-11) (-1.38749854382045e-12,2.09114501618809e-10,-2.33427467595816e-11) (-2.03535247980664e-12,2.71435629112882e-10,-1.27168489677849e-11) (-2.15000108998066e-12,3.40500450293285e-10,-2.58050939582956e-12) (-1.95777982807084e-12,4.06278056954453e-10,1.33296658226909e-12) (-1.7240708175214e-12,4.5754050416759e-10,1.47618790105758e-12) (-8.05393674603941e-13,4.85545802948943e-10,7.907017267006e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.51501067370702e-12,3.08849211738002e-11,-8.88291986771e-11) (2.69309740766315e-12,6.50770996615678e-11,-8.5702458503838e-11) (1.97909591978741e-12,1.03189795956311e-10,-7.88027056107262e-11) (5.84778953244136e-13,1.46392870720813e-10,-6.70485131182933e-11) (-1.12541695194987e-12,1.97974010379736e-10,-4.92905005631952e-11) (-2.83807169695614e-12,2.60089677138595e-10,-2.55158750087883e-11) (-2.0010578735115e-12,3.35083074428648e-10,-5.32801937651816e-13) (-3.28029804569985e-12,4.05224142453556e-10,7.5665412740339e-12) (-2.81113729514256e-12,4.57752694608363e-10,5.96283551974714e-12) (-1.73585168428741e-12,4.85882308845344e-10,2.6372025819748e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.14764600240567e-12,2.83660041093813e-11,-1.40984103801302e-10) (3.23824051623584e-12,5.87653807419178e-11,-1.36386804028421e-10) (3.32250590819062e-12,9.19941181230838e-11,-1.26303661959202e-10) (1.45504046489007e-12,1.2885471700393e-10,-1.09138854118228e-10) (-9.01772721709868e-13,1.73343750162876e-10,-8.32014287429317e-11) (-1.18054088993401e-12,2.32496980349422e-10,-4.42270694638225e-11) (1.14383852057969e-11,3.24299630727122e-10,9.58741895012045e-12) (-8.42048304667829e-14,4.04422443242773e-10,1.60335052395928e-11) (-1.55386984248201e-12,4.59498904068188e-10,7.01514078408266e-12) (-1.25957609285874e-12,4.87072955889278e-10,1.49322841108905e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.18153023250206e-12,2.43546292315966e-11,-1.98064233037636e-10) (3.87560893779946e-12,4.97640286781002e-11,-1.92860938132792e-10) (4.45351650105649e-12,7.61118747282518e-11,-1.81398504313709e-10) (1.98348456460718e-12,1.03481683081533e-10,-1.61682046527619e-10) (-1.86257131710347e-12,1.33264021044877e-10,-1.32012926603373e-10) (3.65105903673035e-12,1.75856994931247e-10,-8.49747773350033e-11) (1.1120719872824e-10,3.21659809291645e-10,2.72966518083072e-11) (1.7087800549469e-11,4.10097112509514e-10,1.1238099239637e-11) (4.35735875935867e-12,4.61842018637179e-10,-6.08082419799186e-12) (2.08818774254825e-12,4.85610316787543e-10,-7.02539165605346e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.6580404751247e-12,1.94331306595483e-11,-2.58247328564215e-10) (5.8492677373342e-12,3.93817832385032e-11,-2.52934915404481e-10) (5.85547500380732e-12,5.80146675622198e-11,-2.40853278414541e-10) (1.44993401188977e-12,7.48009378707093e-11,-2.21329295356966e-10) (-1.33880443885165e-11,8.46983968082378e-11,-1.94868558212965e-10) (-6.32468364260211e-11,6.31221757446222e-11,-1.68932253482687e-10) (6.95551244968639e-11,4.21257339503505e-10,-1.93847527228511e-10) (3.28390632177584e-11,4.32043639905095e-10,-9.92569356822254e-11) (1.37178378581839e-11,4.6121730001495e-10,-5.93130338102185e-11) (7.20798226478656e-12,4.76671220270162e-10,-2.97867083594396e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.14758503996701e-12,1.48220893926653e-11,-3.17548601309628e-10) (6.99701917773794e-12,2.92909819919376e-11,-3.12382677101652e-10) (7.80889341386611e-12,4.11488088741436e-11,-3.00774952966941e-10) (3.18917672432599e-12,4.96635752207531e-11,-2.833055835138e-10) (-1.74674293801158e-11,5.09357017038105e-11,-2.60629402906125e-10) (-9.29804468489165e-11,3.43206382713369e-11,-2.40917260830837e-10) (1.08207422994856e-10,3.72556392789102e-10,-2.70203155097229e-10) (3.99583181472417e-11,4.07465057659622e-10,-1.73806071719732e-10) (1.88877638831957e-11,4.35589203563409e-10,-1.12941504589997e-10) (1.15855312158366e-11,4.47553401742404e-10,-5.61329337959472e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.53346717251479e-12,1.10699932623084e-11,-3.75188654835281e-10) (8.67930096074648e-12,2.08363706100759e-11,-3.70536030774031e-10) (1.10467270118651e-11,2.73324066464857e-11,-3.60432960712426e-10) (8.43423878013772e-12,2.92521283258889e-11,-3.46121983121536e-10) (-1.06439862617309e-11,2.16425305783526e-11,-3.29872577266366e-10) (-1.03300018193253e-10,-1.24740616286529e-11,-3.28436522680752e-10) (4.15692592347244e-11,3.57469916476799e-10,-4.53714241831037e-10) (3.7675826602862e-11,3.66136047272009e-10,-2.8331410989765e-10) (2.20854995815887e-11,3.8504750777315e-10,-1.74136107604099e-10) (1.49944262791145e-11,3.9375223598145e-10,-8.37519445214502e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.80347445315001e-12,7.7513980360187e-12,-4.25318615161075e-10) (9.40415923221957e-12,1.42026506860552e-11,-4.20904306817776e-10) (1.32019389458032e-11,1.74734819821984e-11,-4.12241164457963e-10) (1.63203342059405e-11,1.73593940948085e-11,-4.01107070629419e-10) (1.71986418512837e-11,1.40136477272199e-11,-3.89354234976574e-10) (1.4719483109835e-11,2.68466976719976e-11,-3.83754899337494e-10) (1.36591436636818e-11,2.13637855106451e-10,-3.93022717500595e-10) (2.07174910811087e-11,2.76166590052368e-10,-3.07216875701113e-10) (1.80039614499115e-11,3.03179964900486e-10,-2.04792326969778e-10) (1.55833170886812e-11,3.14050428852658e-10,-1.01823384011238e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.75196044180049e-12,4.41146128991821e-12,-4.60958505506824e-10) (9.53819179882738e-12,8.65406744168637e-12,-4.57077957001331e-10) (1.31798743309328e-11,1.13398497654694e-11,-4.494233900662e-10) (1.75946681446114e-11,1.34448287024074e-11,-4.39441591020022e-10) (2.09690111518014e-11,1.90886092507001e-11,-4.26898550915898e-10) (2.22391699241892e-11,4.55782176302686e-11,-4.11411422894967e-10) (1.72565776799546e-11,1.29953680058356e-10,-3.85013542520002e-10) (1.74602702792675e-11,1.80269414657008e-10,-3.13480593980273e-10) (1.66786947833948e-11,2.05726902947948e-10,-2.17273845263423e-10) (1.56624496546192e-11,2.16184720820011e-10,-1.10382998996794e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.66968313221005e-12,1.77308585711281e-12,-4.80619644782703e-10) (9.61539549496494e-12,3.80944809217725e-12,-4.77070681571103e-10) (1.31919323707326e-11,5.72654883027391e-12,-4.69571671318842e-10) (1.75139074573571e-11,8.02390709799688e-12,-4.59118934597335e-10) (2.00304553937422e-11,1.36418370189213e-11,-4.44810980296396e-10) (2.03313501916718e-11,2.99716935601905e-11,-4.22988767264273e-10) (1.81515511704991e-11,6.33656924280163e-11,-3.84780129043096e-10) (1.79157028518464e-11,8.87782327189899e-11,-3.15870092597643e-10) (1.80444104535592e-11,1.03528226773279e-10,-2.22329256541445e-10) (1.76552960881139e-11,1.09951320367787e-10,-1.14188992552429e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.06197332724948e-12,3.20088499439045e-11,-4.31741213813608e-11) (1.75059350216084e-12,6.73805203952913e-11,-4.1436473785627e-11) (7.63866645865486e-13,1.06731801362678e-10,-3.79953528406502e-11) (-1.78791762680947e-13,1.50779374464174e-10,-3.32522991813068e-11) (-8.72905096573258e-13,2.01087516282487e-10,-2.67367372338301e-11) (-8.25740077415595e-13,2.58325776040345e-10,-1.88699351226367e-11) (-6.46101203447828e-13,3.19578776141005e-10,-1.11472252319217e-11) (-1.04708664601234e-12,3.76247819952114e-10,-6.27895055322504e-12) (-1.25077508392768e-12,4.19052885804023e-10,-3.46340996497999e-12) (-3.51197844272294e-13,4.42635400269914e-10,-1.72124305080901e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.9071875648526e-12,3.10072524958459e-11,-8.93059402320218e-11) (2.10506343418538e-12,6.45223591277498e-11,-8.66666918728518e-11) (1.4205812605901e-12,1.0218663249858e-10,-8.03539586461364e-11) (3.64920115060196e-13,1.44156226183127e-10,-7.00084867668288e-11) (-2.69782289517419e-13,1.92883887388305e-10,-5.58193724194605e-11) (-2.2844797894666e-13,2.50254880966852e-10,-3.86236211628059e-11) (6.83042616376265e-13,3.1452451131982e-10,-2.16062102284339e-11) (-8.74893080646294e-13,3.73094280100917e-10,-1.13075875637936e-11) (-1.23171381720493e-12,4.16843233883693e-10,-6.38876884047529e-12) (-2.8929614621351e-13,4.40682800734984e-10,-3.33993705597166e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.5617211073019e-12,2.87978310070407e-11,-1.40184851315249e-10) (2.1564505108403e-12,5.88556288165317e-11,-1.35728808674337e-10) (2.03994146205994e-12,9.24777329312597e-11,-1.26513103199924e-10) (8.90649011976147e-13,1.30322360331928e-10,-1.11681299826277e-10) (2.03597117175063e-13,1.75676706822972e-10,-9.12264482663453e-11) (1.64495611433762e-12,2.32978515153865e-10,-6.47470494553231e-11) (7.6321203516925e-12,3.04715514847243e-10,-3.59002810248572e-11) (3.25949035834473e-12,3.67918396016548e-10,-2.10623112093241e-11) (1.62492796150673e-12,4.13128764960258e-10,-1.41172386833114e-11) (1.69629141994899e-12,4.36651628059518e-10,-7.52307811020723e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.89973389968017e-12,2.4739874171717e-11,-1.94909336278195e-10) (2.79542055832395e-12,5.07127847264629e-11,-1.89689379567547e-10) (2.83426588102787e-12,7.89656426405891e-11,-1.78966621766569e-10) (9.95109851194073e-13,1.10749456120782e-10,-1.62032889160425e-10) (-3.35096348874216e-13,1.4947309186352e-10,-1.38802505356602e-10) (4.11444908003508e-12,2.04754807134654e-10,-1.07859867707008e-10) (2.76682210850553e-11,2.94812951955576e-10,-6.78090701410023e-11) (1.24601965914924e-11,3.62747173459534e-10,-4.72813597470508e-11) (5.92664483962103e-12,4.07003590135261e-10,-3.29205188290309e-11) (4.00189260391106e-12,4.28870022266588e-10,-1.72574587305488e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.95666858226938e-12,2.01817823923599e-11,-2.50380318484915e-10) (3.85843199395746e-12,4.13959465065974e-11,-2.45090010426417e-10) (3.19735063431977e-12,6.35478258516482e-11,-2.34180159813854e-10) (1.26559517830469e-13,8.82216952725384e-11,-2.17596400385949e-10) (-5.56165401436689e-12,1.18222316149809e-10,-1.96437115342204e-10) (-9.53002520688198e-12,1.66783764125584e-10,-1.73247062085541e-10) (2.36654796649474e-11,2.94634053593875e-10,-1.52145964857109e-10) (1.74737435912458e-11,3.55869755570241e-10,-1.07535781626182e-10) (9.81960885904188e-12,3.94360875453378e-10,-6.98971629171169e-11) (6.53909243308429e-12,4.1296936691919e-10,-3.50245085196971e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.73375696238176e-12,1.62503039990931e-11,-3.04403981549816e-10) (3.84390642488048e-12,3.25991143713069e-11,-2.99067235143945e-10) (4.15592618838385e-12,4.87984821275849e-11,-2.88427704066e-10) (9.24443011521099e-13,6.71623662930858e-11,-2.73017553329308e-10) (-7.88640032994992e-12,9.10428739237263e-11,-2.54619040617541e-10) (-1.68998526825234e-11,1.36625198571799e-10,-2.3645966194135e-10) (2.68968159296954e-11,2.66076093681761e-10,-2.20502960827371e-10) (2.04227614050508e-11,3.28727487238166e-10,-1.65681566795428e-10) (1.26208888794218e-11,3.64840211339376e-10,-1.10004191243939e-10) (9.25376318089587e-12,3.80819113304976e-10,-5.49057666068737e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.19943833751393e-12,1.24650657548021e-11,-3.55676233613928e-10) (5.20995082317087e-12,2.43896810017603e-11,-3.50593380338311e-10) (6.59467408524562e-12,3.58468211365595e-11,-3.40711409056262e-10) (4.07756715604547e-12,4.90812242536324e-11,-3.26715906847618e-10) (-4.45115799617754e-12,6.70945612355678e-11,-3.10682826838134e-10) (-1.73430583436354e-11,1.05630948152779e-10,-2.97535765109687e-10) (1.50011886717446e-11,2.29911350834778e-10,-2.93333780708807e-10) (1.84672815289854e-11,2.85191258847383e-10,-2.23470636193555e-10) (1.35688793715952e-11,3.16461054526736e-10,-1.48208526001695e-10) (1.09442888864346e-11,3.30155481217072e-10,-7.36141023595784e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.72910285596946e-12,9.04895098479566e-12,-3.99017670591401e-10) (6.28960011676141e-12,1.75519248220272e-11,-3.93955559866051e-10) (8.20147733400592e-12,2.55385048441297e-11,-3.84461693401023e-10) (8.48206394549363e-12,3.50903888482755e-11,-3.71437504613513e-10) (6.52434468871696e-12,5.01974045597822e-11,-3.5545279793439e-10) (5.25578131475939e-12,8.54640875192812e-11,-3.37533518590526e-10) (1.15374769122232e-11,1.6863567868739e-10,-3.13100230692515e-10) (1.41901177451377e-11,2.20224438043828e-10,-2.50510152343099e-10) (1.24880804439218e-11,2.48979074462449e-10,-1.71686416647259e-10) (1.16256411100945e-11,2.61658022291181e-10,-8.68848176143258e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.509787369113e-12,5.74620445161894e-12,-4.28012167585005e-10) (6.72824421321709e-12,1.12462565969155e-11,-4.23351823752959e-10) (8.81137621995769e-12,1.68321413920825e-11,-4.14036443607719e-10) (1.0472549644902e-11,2.37925257737597e-11,-4.01133225962865e-10) (1.09286553626139e-11,3.61517933710052e-11,-3.84034005198113e-10) (1.14478136192744e-11,6.30092251805501e-11,-3.60993625827262e-10) (1.23116167706259e-11,1.11163465893397e-10,-3.25212837567798e-10) (1.27447035004233e-11,1.48015393992422e-10,-2.63461908915834e-10) (1.19865246914588e-11,1.70037059381455e-10,-1.83516702741157e-10) (1.15128511100468e-11,1.79731751367718e-10,-9.36569416540446e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (2.89380577772287e-12,2.83255215937795e-12,-4.43810933417082e-10) (5.92583333488094e-12,5.27911174347001e-12,-4.39146218750201e-10) (8.46574447949935e-12,8.40744246146863e-12,-4.30243931690419e-10) (1.12298602544164e-11,1.24102471975375e-11,-4.17067072137253e-10) (1.18500793805412e-11,1.96100189991844e-11,-3.98599150703712e-10) (1.20944055306878e-11,3.35633523954431e-11,-3.72189866763495e-10) (1.26072071530556e-11,5.53518470439847e-11,-3.3199212911378e-10) (1.31530995146442e-11,7.40167053954867e-11,-2.7029121005918e-10) (1.34323732378108e-11,8.58898545489787e-11,-1.89869845020667e-10) (1.34176239034579e-11,9.11174919463469e-11,-9.73534721677266e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.32592317960932e-12,3.07754672632601e-11,-4.33816299508475e-11) (1.16763382470801e-12,6.5306278230181e-11,-4.1385256709121e-11) (5.65981850624089e-13,1.05206132901868e-10,-3.7736881344351e-11) (-7.12054291019602e-14,1.48592944614363e-10,-3.30372885801848e-11) (-5.36078313604132e-13,1.97547574676784e-10,-2.74723384666967e-11) (-4.7755489462295e-13,2.52323763855265e-10,-2.10589423011511e-11) (-4.60111060966225e-13,3.09281468930955e-10,-1.44683398917404e-11) (-7.09087383049896e-13,3.61313347490482e-10,-9.64030197374002e-12) (-7.83290077790601e-13,4.0013484156239e-10,-6.11590043087574e-12) (-1.19841360166427e-13,4.21470106612401e-10,-3.39475147747771e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.477360694485e-12,3.01050172011543e-11,-8.8112439556318e-11) (1.45906051871319e-12,6.28255366901139e-11,-8.53152124123702e-11) (7.84008948623283e-13,1.01072521988282e-10,-7.89756197621556e-11) (9.67161884584291e-15,1.42956789071799e-10,-6.93589145540791e-11) (-2.58352980826276e-13,1.90598100197641e-10,-5.75418183712225e-11) (3.05068996600101e-14,2.45255606551273e-10,-4.38657960036434e-11) (1.93416424288429e-13,3.0399331995196e-10,-2.98319633457313e-11) (-6.17827719589201e-13,3.57079858564565e-10,-1.94650680266029e-11) (-5.66076678279558e-13,3.96630402531207e-10,-1.26143286946416e-11) (4.019394732997e-13,4.17955513774757e-10,-6.72044176477444e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.16363530174992e-12,2.87851507516966e-11,-1.38726639026286e-10) (1.08358912648199e-12,5.79450045586169e-11,-1.3364961778191e-10) (7.20228379053811e-13,9.22398257288389e-11,-1.24711246976773e-10) (8.70166319379118e-15,1.31149364507789e-10,-1.11340597490806e-10) (-7.21867343922716e-14,1.76663724849237e-10,-9.42191396975622e-11) (1.02189570308211e-12,2.3125228079301e-10,-7.33734517472918e-11) (2.69671342786097e-12,2.93819841057107e-10,-5.16235394474072e-11) (1.48564038932552e-12,3.49611291513029e-10,-3.54791658005029e-11) (1.155942213385e-12,3.9017043892306e-10,-2.37867265857369e-11) (1.95481910267168e-12,4.1163701148328e-10,-1.23786850991147e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.23786896840748e-12,2.48717648090589e-11,-1.91383506569908e-10) (1.38950097719288e-12,5.00902228799791e-11,-1.858155494473e-10) (1.31835006384867e-12,7.95894046219128e-11,-1.75781074235703e-10) (2.9248689561706e-13,1.14036608377747e-10,-1.60628326124871e-10) (-2.69582847586123e-14,1.55745850164562e-10,-1.41054335286087e-10) (2.03469452314306e-12,2.1052426419622e-10,-1.16834462210844e-10) (7.31940905286181e-12,2.80372180838055e-10,-8.94864314802322e-11) (4.97677356270953e-12,3.39404492687591e-10,-6.53172969542228e-11) (2.90629942305056e-12,3.79918339649824e-10,-4.35068418285497e-11) (2.6450892207711e-12,4.01213145486833e-10,-2.23726174440051e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.59783891707441e-12,2.05416766548755e-11,-2.44480838154179e-10) (1.7454135167024e-12,4.14452486455659e-11,-2.39085958010285e-10) (1.36293493043494e-12,6.57550065749083e-11,-2.29248614285019e-10) (2.66034535510253e-14,9.47551044346041e-11,-2.14161032859139e-10) (-1.57226504492805e-12,1.3149901880456e-10,-1.94925095217482e-10) (-4.72556881541764e-13,1.85210927988744e-10,-1.72542136898952e-10) (7.61325634613596e-12,2.63522455364879e-10,-1.45880947660426e-10) (6.97739321420971e-12,3.22570811124674e-10,-1.10214264673633e-10) (4.46761857562462e-12,3.61690414688318e-10,-7.36798642234141e-11) (3.66483752759167e-12,3.81485617263592e-10,-3.7649665090819e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.18224880079533e-12,1.67446354280433e-11,-2.96154466265015e-10) (1.41380871649108e-12,3.33533184369996e-11,-2.90722125403537e-10) (1.69743644274048e-12,5.20303600794642e-11,-2.8108859826104e-10) (6.07072339188696e-13,7.55457702465205e-11,-2.66739541031681e-10) (-2.09746631800516e-12,1.07543795441082e-10,-2.48696006366632e-10) (-1.8623033775144e-12,1.58077181868704e-10,-2.28175124354328e-10) (8.24016474475064e-12,2.35469028724211e-10,-2.0118773544036e-10) (8.28161424437727e-12,2.93013803888653e-10,-1.56593628897476e-10) (5.90162105496439e-12,3.30127834131363e-10,-1.06160979963641e-10) (5.01162866187214e-12,3.47500789700366e-10,-5.38529012147922e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.532699831916e-12,1.24945433673562e-11,-3.43813483664625e-10) (2.16573572085337e-12,2.51336000109991e-11,-3.38779580241938e-10) (2.9074881690715e-12,3.93787392928427e-11,-3.29790267485654e-10) (2.03532255188569e-12,5.81093079206435e-11,-3.16412476280409e-10) (-7.01063048843585e-13,8.49254471108211e-11,-2.98936808369526e-10) (-1.37818211097646e-12,1.29227489577195e-10,-2.78521851862621e-10) (6.41371630381375e-12,1.99115086926088e-10,-2.50889648892963e-10) (8.17199214067573e-12,2.50862769199181e-10,-1.9859708217835e-10) (6.45643579380157e-12,2.83721376437482e-10,-1.35560402578016e-10) (5.82764545275267e-12,2.98659517147449e-10,-6.86373978480059e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.96973866383277e-12,8.99333977658942e-12,-3.83093249573178e-10) (3.10140187681829e-12,1.8310022975574e-11,-3.7828149532171e-10) (3.8836519985482e-12,2.89084362566767e-11,-3.69044116677154e-10) (3.79522034089277e-12,4.26689625616586e-11,-3.5586937836389e-10) (2.65067653361124e-12,6.38094275550804e-11,-3.3816367297561e-10) (3.27735575546407e-12,1.00217104496504e-10,-3.15254064855762e-10) (6.41961135683857e-12,1.53236236515314e-10,-2.81166112465477e-10) (7.57542610067397e-12,1.95998081739525e-10,-2.25697883029691e-10) (6.62849649198687e-12,2.23254807501293e-10,-1.56198538012795e-10) (6.66709441921959e-12,2.35849764752198e-10,-7.99013203677286e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.76309582930761e-12,6.15132418896098e-12,-4.09711928850677e-10) (3.38000892142505e-12,1.21740462078102e-11,-4.05271875153669e-10) (4.33285750572118e-12,1.96173499419798e-11,-3.95835905331714e-10) (4.7556074563615e-12,2.8758477514268e-11,-3.82026397349851e-10) (4.43005036358313e-12,4.35504959688453e-11,-3.63410928337903e-10) (5.11289814492667e-12,6.94065078616771e-11,-3.38123018084949e-10) (6.37230696806763e-12,1.04187618436354e-10,-2.99248072994354e-10) (6.79818592269182e-12,1.34074162823311e-10,-2.41306337001819e-10) (6.27396843682349e-12,1.53586086348214e-10,-1.68228654907372e-10) (6.47016887737438e-12,1.62615538803692e-10,-8.6358323751042e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.06164327021848e-12,3.47436632127383e-12,-4.2383655071163e-10) (2.30265801856701e-12,6.1180853072816e-12,-4.19300541120138e-10) (3.69632738780398e-12,1.01406994658384e-11,-4.10879797794289e-10) (5.17218601841267e-12,1.48986159586785e-11,-3.97042770940646e-10) (5.05081443951203e-12,2.26926360794513e-11,-3.76971968963555e-10) (5.46002027640765e-12,3.56444609160374e-11,-3.49228518444592e-10) (6.25813514244922e-12,5.26181894118763e-11,-3.08124037252147e-10) (6.74843987161573e-12,6.77946666515572e-11,-2.49247712697822e-10) (6.80585493384753e-12,7.79897236287038e-11,-1.74704606174649e-10) (7.18164368207517e-12,8.27273839300221e-11,-8.99090276120973e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) ) ; boundaryField { fuel { type fixedValue; value uniform (0.1 0 0); } air { type fixedValue; value uniform (-0.1 0 0); } outlet { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
[ "huberlulu@gmail.com" ]
huberlulu@gmail.com
5c812ce865e1a9d3224ebbcc21aecec818b84fa9
f8f903486ebca5bfa1f304c0d4308c494f4331b1
/test/keyframe_test.cpp
2a62ed453ee705630a4aede0e7c69779249a0ef6
[]
no_license
utomore/ncuipc
530ad1a7aa8389b24256d8413cd5afb512f72dcf
6301d63ea8ac7db679dee9b5a0f9e2a0b6266f7c
refs/heads/master
2021-09-20T23:49:13.344028
2018-08-17T03:35:17
2018-08-17T03:35:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,123
cpp
#include "tako/common_include.hpp" #include <string> #include <vector> #include <iostream> //DBoW3 #include "DBoW3/DBoW3.h" using namespace std; using namespace cv; int main(int argc, char **argv) { //read the image cout << "read images" << endl; vector<Mat> images; for (int i = 0; i < 10; i++) { string path = "./data2/"+to_string(i+1)+".png"; images.push_back( imread(path, 0) ); } //detect ORB features cout<<"detecting ORB feature " <<endl; Ptr< Feature2D > detector = ORB::create(); vector<Mat> descriptors; cout<<"detecting image ...."<<endl; for(Mat& image:images) { cout<<"image run ..." <<endl; vector<KeyPoint> keypoints; Mat descriptor; detector->detectAndCompute( image, Mat(), keypoints, descriptor); descriptors.push_back(descriptor); } //create vocabulary cout<< " creating Vocabulary " <<endl; DBoW3::Vocabulary vocab; vocab.create( descriptors ); cout<<"vocabulary info:" <<vocab<<endl; vocab.save("vocabulary.yml.gz"); cout<<"done"<<endl; return 0 ; }
[ "lhm.stu@gmail.com" ]
lhm.stu@gmail.com
4521879a270666d0870c36ab4a573d7255bebd28
3233accbde095c41593861c9d5b44d0f7959c721
/1394camera/1394camera/1394CamFMR.cpp
5ab2d848ee3a714ff6e912102d5da36baa3d4f9b
[]
no_license
iamchucky/tdloc
6cf4a76f0ab7f19bb2cb5db7150a8750943cba34
d30cce12c626260df86885770033323156aa6224
refs/heads/master
2021-01-19T16:23:40.961659
2011-05-19T18:22:49
2011-05-19T18:22:49
1,204,147
0
0
null
null
null
null
UTF-8
C++
false
false
20,564
cpp
/**\file 1394CamFMR.cpp * \brief Implements Format, Mode, Rate manipulation for the C1394Camera class. * \ingroup camfmr */ ////////////////////////////////////////////////////////////////////// // // Version 6.4 // // Copyright 8/2006 // // Christopher Baker // Robotics Institute // Carnegie Mellon University // Pittsburgh, PA // // Copyright 5/2000 // // Iwan Ulrich // Robotics Institute // Carnegie Mellon University // Pittsburgh, PA // // This file is part of the CMU 1394 Digital Camera Driver // // The CMU 1394 Digital Camera Driver is free software; you can redistribute // it and/or modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either version 2.1 of the License, // or (at your option) any later version. // // The CMU 1394 Digital Camera Driver 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the CMU 1394 Digital Camera Driver; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ////////////////////////////////////////////////////////////////////// #include "pch.h" /** \defgroup camfmr Video Format Controls * \ingroup camcore * \brief Protected accessors and mutators for manipulation of video settings. */ /**\brief Set the Video Format * \ingroup camfmr * \param format The format in [0,7] that you wish to use * \return * - CAM_SUCCESS: Format selection is successful. * - CAM_ERROR_NOT_INITIALIZED: No camera celected and/or camera not initialized * - CAM_ERROR_BUSY: The camera is actively acquiring images * - CAM_ERROR: WriteRegister() has failed, use GetLastError() to find out why. * * For a valid format selection, the first valid mode and rate will be automatically * selected to maintain internal consistency. */ int C1394Camera::SetVideoFormat(unsigned long format) { DWORD dwRet; int ret = CAM_ERROR; DllTrace(DLL_TRACE_ENTER,"ENTER SetVideoFormat (%d)\n",format); if (!m_pName || !m_cameraInitialized) { DllTrace(DLL_TRACE_ERROR,"SetVideoFormat: Camera is not initialized\n"); ret = CAM_ERROR_NOT_INITIALIZED; goto _exit; } if(m_hDeviceAcquisition != INVALID_HANDLE_VALUE) { DllTrace(DLL_TRACE_ERROR,"SetVideoFormat: Camera is busy\n"); ret = CAM_ERROR_BUSY; goto _exit; } if(this->HasVideoFormat(format)) { // shift it over into the most significant bits if(dwRet = WriteQuadlet(0x608, format << 29)) { DllTrace(DLL_TRACE_ERROR,"SetVideoFormat: error %08x on WriteRegister\n",dwRet); ret = CAM_ERROR; } else { m_videoFormat = format; // update parameters is a little funky, but leave it anyway UpdateParameters(); ret = CAM_SUCCESS; } } else { DllTrace(DLL_TRACE_ERROR,"SetVideoFormat: Format %d not supported\n",format); ret = CAM_ERROR_INVALID_VIDEO_SETTINGS; } _exit: DllTrace(DLL_TRACE_EXIT,"EXIT SetVideoFormat (%d)\n",ret); return ret; } /**\brief Set the Video Mode * \ingroup camfmr * \param mode The desired mode in [0,7] that you wish to set * \return * - CAM_SUCCESS: Mode selection completed. * - CAM_ERROR_NOT_INITIALIZED: No camera celected and/or camera not initialized * - CAM_ERROR_BUSY: The camera is actively acquiring images * - CAM_ERROR: WriteRegister has failed, use GetLastError() to find out why. * * This function is invalid for Format 7 * * For a valid mode selection, the first valid framerate will be selected for consistency */ int C1394Camera::SetVideoMode(unsigned long mode) { DWORD dwRet; int ret = CAM_ERROR; DllTrace(DLL_TRACE_ENTER,"ENTER SetVideoMode (%d)\n",mode); if (!m_pName || !m_cameraInitialized) { DllTrace(DLL_TRACE_ERROR,"SetVideoMode: Camera is not initialized\n"); ret = CAM_ERROR_NOT_INITIALIZED; goto _exit; } if(m_hDeviceAcquisition != INVALID_HANDLE_VALUE) { DllTrace(DLL_TRACE_ERROR,"SetVideoMode: Camera is busy\n"); ret = CAM_ERROR_BUSY; goto _exit; } if(this->HasVideoMode(m_videoFormat,mode)) { if(dwRet = WriteQuadlet(0x604, mode << 29)) { DllTrace(DLL_TRACE_ERROR,"SetVideoMode: error %08x on WriteRegister\n",dwRet); ret = CAM_ERROR; } else { m_videoMode = mode; UpdateParameters(); ret = CAM_SUCCESS; } } else { DllTrace(DLL_TRACE_ERROR,"SetVideoMode: mode %d is not supported under format %d\n",mode,m_videoFormat); ret = CAM_ERROR_INVALID_VIDEO_SETTINGS; } _exit: DllTrace(DLL_TRACE_EXIT,"EXIT SetVideoMode (%d)\n",ret); return ret; } /**\brief Set the Video Frame Rate * \ingroup camfmr * \param rate The desired frame rate in [0,7] that you wish to set * \return * - CAM_SUCCESS: All good. * - CAM_ERROR_NOT_INITIALIZED: No camera celected and/or camera not initialized * - CAM_ERROR_BUSY: The camera is actively acquiring images * - CAM_ERROR: WriteRegister has failed, use GetLastError() to find out why. * * This function is invalid for Format 7 */ int C1394Camera::SetVideoFrameRate(unsigned long rate) { DWORD dwRet; int ret = CAM_ERROR; DllTrace(DLL_TRACE_ENTER,"ENTER SetVideoFramteRate (%d)\n",rate); if (!m_pName || !m_cameraInitialized) { DllTrace(DLL_TRACE_ERROR,"SetVideoFrameRate: Camera is not initialized\n"); ret = CAM_ERROR_NOT_INITIALIZED; goto _exit; } if(m_hDeviceAcquisition != INVALID_HANDLE_VALUE) { DllTrace(DLL_TRACE_ERROR,"SetVideoFrameRate: Camera is busy\n"); ret = CAM_ERROR_BUSY; goto _exit; } if(m_videoFormat != 7) { if(this->HasVideoFrameRate(m_videoFormat,m_videoMode,rate)) { if(dwRet = WriteQuadlet(0x600, rate << 29)) { DllTrace(DLL_TRACE_ERROR,"SetVideoFrameRate: error %08x on WriteRegister\n",dwRet); ret = CAM_ERROR; } else { m_videoFrameRate = rate; UpdateParameters(); ret = CAM_SUCCESS; } } else { DllTrace(DLL_TRACE_ERROR,"SetVideoFrameRate: rate %d unsupported\n",rate); ret = CAM_ERROR_INVALID_VIDEO_SETTINGS; } } else { DllTrace(DLL_TRACE_ERROR,"SetVideoFramerate: it is not meaningful to set the framerate for format 7\n"); ret = CAM_ERROR_INVALID_VIDEO_SETTINGS; } _exit: DllTrace(DLL_TRACE_EXIT,"EXIT SetVideoFrameRate (%d)\n",ret); return ret; } /**\brief get the current video format. * \ingroup camfmr * \return The current format, -1 if none selected. */ int C1394Camera::GetVideoFormat() { return m_videoFormat; } /**\brief get the current video mode. * \ingroup camfmr * \return The current format, -1 if none selected. */ int C1394Camera::GetVideoMode() { return m_videoMode; } /**\brief get the current video format. * \ingroup camfmr * \return The current format, -1 if none selected. */ int C1394Camera::GetVideoFrameRate() { return m_videoFrameRate; } /**\brief Reads the format register and fills in m_InqVideoFormats * \ingroup camfmr * \return TRUE if the checks were successful, FALSE on a Read error */ BOOL C1394Camera::InquireVideoFormats() { DWORD dwRet; // Read video formats at 0x100 m_InqVideoFormats = 0; if(dwRet = ReadQuadlet(0x100,&m_InqVideoFormats)) { DllTrace(DLL_TRACE_ERROR,"InquireVideoFormats: Error %08x on ReadRegister(0x100)\n",dwRet); return FALSE; } else { DllTrace(DLL_TRACE_CHECK,"InquireVideoFormats: We have 0x%08x\n",m_InqVideoFormats); //return TRUE; ///AAAAAAH! } // Read the current video format at 0x608 if(dwRet = ReadQuadlet(0x608,(unsigned long *) &this->m_videoFormat)) { DllTrace(DLL_TRACE_ERROR,"InquireVideoFormats: error %08x on ReadRegister\n",dwRet); this->m_videoFormat = -1; return FALSE; } else { this->m_videoFormat >>= 29; this->m_videoFormat &= 0x7; DllTrace(DLL_TRACE_CHECK,"InquireVideoFormats: Read current format as %d\n",m_videoFormat); } return TRUE; } /**\brief Check whether the provided camera settings are valid * \ingroup camfmr * \param format The format to check * \return Whether the settings are supported by the camera */ BOOL C1394Camera::HasVideoFormat(unsigned long format) { BOOL bRet; if(format >= 8) { DllTrace(DLL_TRACE_WARNING,"HasVideoFormat: Invalid Format: %d\n",format); return FALSE; } bRet = (m_InqVideoFormats >> (31-format)) & 0x01; // QUIRK Check: All Formats must have at least one valid mode. if(bRet && ((m_InqVideoModes[format] & 0xFF000000) == 0)) { DllTrace(DLL_TRACE_ALWAYS,"HasVideoFormat: QUIRK: Format %d presence in V_FORMAT_INQ (%08x) disagrees with V_MODE_INQ_%d(%08x)\n", format,m_InqVideoFormats,format,m_InqVideoModes[format]); bRet = FALSE; } return bRet; } /**\brief Reads the mode registers and fills in m_InqVideoModes * \ingroup camfmr * \return TRUE if the checks were successful, FALSE on a Read error */ BOOL C1394Camera::InquireVideoModes() { ULONG format; DWORD dwRet; for (format=0; format<8; format++) { m_InqVideoModes[format] = 0xFF000000; if (this->HasVideoFormat(format)) { // inquire video mode for current format DllTrace(DLL_TRACE_CHECK,"InquireVideoModes: Checking Format %d\n",format); if(dwRet = ReadQuadlet(0x180+format*4,&m_InqVideoModes[format])) { DllTrace(DLL_TRACE_ERROR,"InquireVideoModes, Error %08x on ReadRegister(%03x)\n",dwRet,0x180+format*4); return FALSE; } else { DllTrace(DLL_TRACE_CHECK,"InquireVideoModes: We have %08x for format %d\n",m_InqVideoModes[format],format); } } else { m_InqVideoModes[format] = 0; } } // Read the current video mode at 0x604 if(dwRet = ReadQuadlet(0x604,(unsigned long *) &this->m_videoMode)) { DllTrace(DLL_TRACE_ERROR,"InquireVideoModes: error %08x on ReadRegister\n",dwRet); this->m_videoMode = -1; return FALSE; } else { this->m_videoMode >>= 29; this->m_videoMode &= 0x7; DllTrace(DLL_TRACE_CHECK,"InquireVideoModes: Read current Mode as %d\n",m_videoMode); } return TRUE; } /**\brief Check whether the provided camera settings are valid * \ingroup camfmr * \param format The format to check * \param mode The mode to check * \return Whether the settings are supported by the camera */ BOOL C1394Camera::HasVideoMode(unsigned long format, unsigned long mode) { BOOL bRet; if(format >= 8 || mode >= 8) { DllTrace(DLL_TRACE_WARNING,"HasVideoMode: Invalid Format,Mode: %d,%d\n",format,mode); return FALSE; } bRet = (m_InqVideoModes[format] >> (31-mode)) & 0x01; // QUIRK Check: All Modes must have at least one valid framerate. if(format < 3 && bRet && ((m_InqVideoRates[format][mode] & 0xFF000000) == 0)) { DllTrace(DLL_TRACE_ALWAYS, "HasVideoFormat: QUIRK: Mode %d:%d presence in V_MODE_INQ_%d(%08x) disagrees with V_RATE_INQ_%d_%d = %08x\n", format,mode,format,m_InqVideoModes[format],format,mode,m_InqVideoRates[format][mode]); bRet = FALSE; } return bRet; } /**\brief Reads the rate registers and fills in m_InqVideoRates * \ingroup camfmr * \return TRUE if the checks were successful, FALSE on a Read error */ BOOL C1394Camera::InquireVideoRates() { ULONG format, mode; DWORD dwRet; for (format=0; format<8; format++) { for (mode=0; mode<8; mode++) { m_InqVideoRates[format][mode] = 0xFF000000; if(this->HasVideoMode(format,mode)) { // inquire video mode for current format if(dwRet = ReadQuadlet(0x200+format*32+mode*4,&m_InqVideoRates[format][mode])) { DllTrace(DLL_TRACE_ERROR,"InquireVideoRates, Error %08x on ReadRegister(%03x)\n",dwRet,0x200+format*32+mode*4); return FALSE; } else { DllTrace(DLL_TRACE_CHECK,"InquireVideoRates: We have %08x for %d,%d\n",m_InqVideoRates[format][mode],format,mode); if(format <= 2) { // Quirk-Check the rates against m_maxSpeed; ULONG rate; ULONG isomaxBPF= 1000 * m_maxSpeed; ULONG absmaxBPF= 1250 * m_maxSpeed; for(rate=0; rate<8; rate++) { if(this->HasVideoFrameRate(format,mode,rate)) { ULONG BPF = 4 * dc1394GetQuadletsPerPacket(format,mode,rate); if(BPF > isomaxBPF) { if(BPF < absmaxBPF) { DllTrace(DLL_TRACE_ALWAYS,"QUIRK: Camera reports supported mode %d,%d,%d which may work at but otherwise exceeds strict 1394 bus spec at %d00mbps\n", format,mode,rate,m_maxSpeed); } DllTrace(DLL_TRACE_WARNING,"InquireVideoRates: Warning: disabling mode %d,%d,%d which exceeds available bandwidth at %d00mbps\n"); m_InqVideoRates[format][mode] &= ~(0x80000000 >> rate); } } } } } } else { m_InqVideoRates[format][mode] = 0; } } } // Read the current video rate at 0x600 if(dwRet = ReadQuadlet(0x600,(unsigned long *) &this->m_videoFrameRate)) { DllTrace(DLL_TRACE_ERROR,"InquireVideoFrameRates: error %08x on ReadRegister\n",dwRet); this->m_videoFrameRate = -1; return FALSE; } else { this->m_videoFrameRate >>= 29; this->m_videoFrameRate &= 0x7; DllTrace(DLL_TRACE_CHECK,"InquireVideoFrameRates: Read current FrameRate as %d\n",m_videoFrameRate); } return TRUE; } /**\brief Check whether the provided camera settings are valid * \ingroup camfmr * \param format The format to check * \param mode The mode to check * \param rate The rate to check * \return Whether the settings are supported by the camera * * The notion of video frame rate does not apply to any but the first three video formats */ BOOL C1394Camera::HasVideoFrameRate(unsigned long format, unsigned long mode, unsigned long rate) { if(format >= 3 || mode >= 8 || rate >= 8) { DllTrace(DLL_TRACE_WARNING,"HasVideoFrameRate: Invalid Format,Mode,Rate: %d,%d,%d\n",format,mode,rate); return FALSE; } return (m_InqVideoRates[format][mode] >> (31-rate)) & 0x01; } /**\brief Retrieve the width and height of the currently configured video mode * \ingroup camfmr * \param pWidth Receives the width, in pixels, of the current video mode, zero if none selected * \param pHeight Receives the height, in pixels, of the current video mode, zero if none selected */ void C1394Camera::GetVideoFrameDimensions(unsigned long *pWidth, unsigned long *pHeight) { if(!pWidth || !pHeight) { DllTrace(DLL_TRACE_ERROR,"GetVideoFrameDimensions: Invalid Argument(s) %08x %08x\n",pWidth,pHeight); } else { *pWidth = m_width; *pHeight = m_height; } } /**\brief retrieve the effective data depth, in bits of the current video mode * \param depth Where to put it * * For IIDC 1.31 cameras, this tells us basically how many bits per channel * in the image data are actually representative of the image. For instance, * many 16-bit formats actually produce 12-bit data */ void C1394Camera::GetVideoDataDepth(unsigned short *depth) { if(depth == NULL) return; switch(this->m_videoFormat) { case 0: case 1: case 2: if(this->m_StatusVideoDepth != 0) { *depth = (unsigned short)((this->m_StatusVideoDepth >> 24) & 0x00FF); } else { if( this->m_colorCode == COLOR_CODE_Y16 || this->m_colorCode == COLOR_CODE_RGB16 || this->m_colorCode == COLOR_CODE_RAW16 || this->m_colorCode == COLOR_CODE_Y16_SIGNED || this->m_colorCode == COLOR_CODE_RGB16_SIGNED) *depth = 16; else *depth = 8; } break; case 7: this->m_pControlSize->GetDataDepth(depth); break; default: *depth = 0; } } /**\brief Maintains internal consistency of variables surrounding current video settings * \param UpdateOnly If TRUE, then no active changes are made to the settings, values are simply * retrieved. Default is FALSE, causing a full sanity enforcement. * \ingroup camfmr * * This ensures that a valid combination of format,mode,and rate are selected and * populates m_width, m_height, m_maxBytes, m_maxBufferSize accordingly. Since this both * calls and is called by the various SetVideoBlah functions and the ControlSize class, care * must be take to avoid recursive stupidity. */ void C1394Camera::UpdateParameters(BOOL UpdateOnly) { VIDEO_MODE_DESCRIPTOR desc; ULONG qpp; if(!UpdateOnly && !CheckVideoSettings()) { int i; DllTrace(DLL_TRACE_WARNING, "UpdateParameters: Video settings (%d,%d,%d) are invalid, seeking nearest neighbor\n", m_videoFormat, m_videoMode, m_videoFrameRate); if(!this->HasVideoFormat(m_videoFormat)) { for(i=0; i<8; i++) { if(i != 6 && this->HasVideoFormat(i)) { this->SetVideoFormat(i); break; } } return; } if(!this->HasVideoMode(m_videoFormat,m_videoMode)) { for(i=0; i<8; i++) { if(this->HasVideoMode(m_videoFormat,i)) { this->SetVideoMode(i); break; } } return; } if(m_videoFormat != 7) { if(!this->HasVideoFrameRate(m_videoFormat,m_videoMode,m_videoFrameRate)) { for(i=0; i<8; i++) { if(this->HasVideoFrameRate(m_videoFormat,m_videoMode,i)) { this->SetVideoFrameRate(i); break; } } return; } } else { m_videoFrameRate = -1; } if(!CheckVideoSettings()) { DllTrace(DLL_TRACE_ERROR,"UpdateParameters: Unable to select a valid format!\n"); return; } DllTrace(DLL_TRACE_CHECK,"UpdateParameters: Auto-selected %d,%d,%d\n", m_videoFormat,m_videoMode,m_videoFrameRate); } // now update the critical members if (m_videoFormat != 7) { if(dc1394GetModeDescriptor(m_videoFormat,m_videoMode,&desc) < 0) m_width = m_height = 0; m_width = desc.width; m_height = desc.height; m_colorCode = desc.colorcode; m_maxBufferSize = dc1394GetBufferSize(m_videoFormat, m_videoMode); qpp = dc1394GetQuadletsPerPacket(m_videoFormat,m_videoMode,m_videoFrameRate); m_maxBytes = 4 * qpp; // update the video depth register this->m_StatusVideoDepth = 0; this->ReadQuadlet(0x0630,&this->m_StatusVideoDepth); } else { unsigned short w,h,bpp; unsigned long ppf,bpf,n; unsigned long offset = this->m_InqVideoRates[this->m_videoFormat][this->m_videoMode]; offset <<= 2; offset |= 0xf0000000; if(!UpdateOnly && m_pControlSize->SetOffset(offset) != CAM_SUCCESS) { DllTrace(DLL_TRACE_ERROR,"UpdateParameters: Error on ControlSize::SetOffset"); ///\todo: something smarter in UpdateParameters when ControlSize::SetOffset fails return; } this->m_pControlSize->GetSize(&w,&h); this->m_pControlSize->GetBytesPerPacket(&bpp); this->m_pControlSize->GetPacketsPerFrame(&ppf); this->m_pControlSize->GetBytesPerFrame(&bpf,NULL); // what if we have images > 4GB? this->m_pControlSize->GetColorCode(&this->m_colorCode); // now for a little sanity checking for quirky cameras n = dc1394GetBitsPerPixel(this->m_colorCode); n *= w * h; n /= 8; if(bpf < n) { DllTrace(DLL_TRACE_ALWAYS, "QUIRK: format 7 reported bytes per frame (%d) is less than computed bytes per frame (%d)\n", bpf,n); bpf = n; } n = (bpf + bpp - 1)/bpp; if(ppf != n) { DllTrace(DLL_TRACE_ALWAYS, "QUIRK: format 7 reported packets per frame (%d) is incorrect (should be %d)\n", ppf,n); ppf = n; } m_maxBytes = bpp; m_width = w; m_height = h; m_maxBufferSize = bpp * ppf; DllTrace(DLL_TRACE_CHECK,"UpdateParameters: Format 7 (%dx%d,%d:%d)\n", w,h,bpp * ppf, bpp); } DllTrace(DLL_TRACE_CHECK,"UpdateParameters: Using %dx%d, %d:%d\n", m_width,m_height,m_maxBufferSize,m_maxBytes); } /** \brief Check to make sure the selected video settings are valid * \return boolean true if things are okay */ bool C1394Camera::CheckVideoSettings() { bool bRet = false; if(m_cameraInitialized) { if(m_videoFormat != 7) bRet = (this->HasVideoFrameRate(m_videoFormat,m_videoMode,m_videoFrameRate) == TRUE); else bRet = (this->HasVideoMode(m_videoFormat,m_videoMode) == TRUE); // check the status register for the hell of it if(StatusVideoErrors(TRUE) && bRet) { DllTrace(DLL_TRACE_WARNING,"CheckVideoSettings: WARNING: Camera is angry about %d,%d,%d, but video flags disagree\n", m_videoFormat, m_videoMode, m_videoFrameRate); } } return bRet; } /**\brief Return whether there are video errors according to the error register * \param Refresh Boolean whether to re-read the registers or simply probe the bits * \return boolean state of the Video Error Register, if Valid */ bool C1394Camera::StatusVideoErrors(BOOL Refresh) { if(!this->m_cameraInitialized || (this->m_InqBasicFunc & 0x40000000) == 0) return false; if(Refresh == TRUE) { if(this->ReadQuadlet(0x628,&this->m_StatusVideoError) != CAM_SUCCESS) return false; } return (m_StatusVideoError & 0x80000000) != 0; }
[ "yangchuck@gmail.com" ]
yangchuck@gmail.com
46b7fc5ae6a4000d2c5040e174a45462fa3c98cc
1c711f642328e5195cbbb61760a83f4a8ff6977a
/assets/src/AtCoder/238/c.cpp
723b81498cd4ecab58366118d69ed5d7e5bc9a6f
[]
no_license
liuxueyang/liuxueyang.github.io
29d85b989e5938e964b70c9616a418e13003212e
86e10cb6137d930c2ac81f2ae20318eb1354f2b5
refs/heads/master
2023-03-07T13:06:17.366563
2023-03-01T14:41:41
2023-03-01T14:41:41
17,851,538
2
0
null
2023-01-31T04:00:56
2014-03-18T02:46:21
C++
UTF-8
C++
false
false
1,864
cpp
// Date: Sat Feb 12 15:25:13 2022 #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <climits> #include <iostream> #include <sstream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <algorithm> #include <utility> #include <functional> using namespace std; const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const double eps = 1e-8; const int dir[8][2] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}, }; typedef long long ll; typedef unsigned long long ull; typedef vector<int> VI; typedef pair<int, int> PII; const ull Pr = 131; #define LN ListNode #define LNP ListNode* #define TN TreeNode #define TNP TreeNode* #ifdef _DEBUG struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int val) : val(val), next(nullptr) {} ListNode(int val, ListNode *next) : val(val), next(next) {} }; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode() : val(0), left(nullptr), right(nullptr) {} TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} }; #endif const ull M = 998244353; ull get(ull n, ull a0) { ull res = 0; res = (n % M) * (a0 % M) % M; if (n & 1) { res += ((n - 1) / 2 % M) * (n % M) % M; } else { res += (n / 2 % M) * ((n - 1) % M) % M; } return res % M; } int main(void) { #ifdef _DEBUG freopen("c.in", "r", stdin); #endif std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ull n; while (cin >> n) { ull k = 10, k1 = 1, res = 0; while (k <= n) { res = (res + get(k - k1, 1)) % M; k1 = k; k *= 10; } res = (res + get(n - k1 + 1, 1)) % M; cout << res << endl; } return 0; }
[ "liuxueyang457@gmail.com" ]
liuxueyang457@gmail.com
d9d6fcd14d18d5eec925c1edfc6a86d3b4360de8
e0d50712461f60626ab6600a230e5b5f475c636c
/sfx/sfx_source_point.h
0761e34c3ea7476d0c6367db16dc771db93d54d9
[ "MIT" ]
permissive
astrellon/Rouge
a4939c519da900d0a42d10ae0bff427ac4c2aa56
088f55b331284238e807e0562b9cbbed6428c20f
refs/heads/master
2021-01-23T08:39:52.749013
2018-08-31T07:33:38
2018-08-31T07:33:38
11,255,211
0
0
null
null
null
null
UTF-8
C++
false
false
434
h
#pragma once #include <sfx/sfx_isource.h> namespace am { namespace sfx { class ISound; class SourcePoint : public ISource { public: SourcePoint(); SourcePoint(ISound *sound); ~SourcePoint(); void setSourceRelative(bool value); bool isSourceRelative() const; virtual float calcGain() const; virtual bool isOutOfRange() const; protected: bool mSourceRelative; virtual void applyToSource(); }; } }
[ "sovereign250@gmail.com" ]
sovereign250@gmail.com
80d9de982d5d687da3c19111e38b1e1514927e73
9fc919b7e778361bc81137f6a0a1abe6acbc74bc
/onerut_normal_operator/src/domain_oscillator.cpp
d7b5d2381e3f39af28ff9bdddc80a6eb963bfb92
[]
no_license
MateuszSnamina/onerut
315f712d36d2ebc797e0292b9d78b7629d81df2c
a38b3790f995aac1a89f415c47f27f7b63bf8c0d
refs/heads/master
2020-04-16T10:41:44.417458
2019-06-02T21:49:07
2019-06-02T21:49:07
165,513,612
0
0
null
null
null
null
UTF-8
C++
false
false
529
cpp
#include<cassert> #include<onerut_normal_operator/domain_oscillator.hpp> namespace onerut_normal_operator { OscillatorDomain::OscillatorDomain(uint32_t n_max_stars) : n_max_stars(n_max_stars) { } uint32_t OscillatorDomain::size() const { return n_max_stars; } std::string OscillatorDomain::state_name(uint32_t index) const { assert(index < size()); const auto & n_stars = index; const std::string name = "nu_" + std::to_string(n_stars); return name; } }
[ "mateusz.snamina@gmail.com" ]
mateusz.snamina@gmail.com
4bc98fe098a90d4dde61f6c653cb787cb4567e5a
4436cff177e22f2f7bef995e9ac5bd1c1cbd17d0
/ProjectKatamari/PKCameraManager.h
d598fe41aaba701f0eee6d2cf554d98c15b126af
[]
no_license
zrma/ComputerGraphics
3f969bc24e599005e32545ea661b9de98b5f920a
cb3f9efdb504d3688aa5483b99a0b21eed4d7fa6
refs/heads/master
2016-09-06T17:11:53.263294
2014-02-25T07:10:57
2014-02-25T07:10:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
578
h
#pragma once #include "PKDefine.h" #include "PKEnumSet.h" typedef array2d_<GLfloat, MATRIX_3D_ROW, MATRIX_3D_COL>::type GLmatrix; class CPKCameraManager { SINGLETON(CPKCameraManager); private: CPKCameraManager(void); ~CPKCameraManager(void); public: void Init(); void Update(); GLmatrix GetMatrix() { return m_Matrix; } void MatrixInverse(GLfloat *OpenGLmatIn, GLfloat *matOut); void SetFocus( int x, int y ) { m_FocusX = x; m_FocusY = y; } private: void CalcMatrix( TransType trans, int sign ); int m_FocusX; int m_FocusY; GLmatrix m_Matrix; };
[ "bulbitain@nhnnext.org" ]
bulbitain@nhnnext.org
f4ed8d15020018036765ada5b58cc7176fb344ee
cfb800c5125eab02977d786ff2a9d352ed7f8975
/Tron3k/Project/Core/Game/Role/Weapon/WeaponTypes/Mobility/Melee.cpp
5c424a5a6d55aa76d73dd6ef35c10559eed2f77d
[]
no_license
Pristin/Tron3k
8e83b09b16731f7b9d305ce3f125965dc14687bd
57d267eccbcdf1185df54290620d5a67acca0969
refs/heads/master
2020-05-23T10:20:42.033667
2017-01-30T13:26:39
2017-01-30T13:26:39
80,422,879
0
0
null
null
null
null
UTF-8
C++
false
false
555
cpp
#include"Melee.h" Melee::Melee() { } Melee::~Melee() { } bool Melee::shoot() { bool ableToShoot = false; if (firingSpeedCurrentDelay < FLT_EPSILON) { firingSpeedCurrentDelay = firingSpeed; ableToShoot = true; } return ableToShoot; } void Melee::init() { weaponType = WEAPON_TYPE::MELEE; maxClipSize = 1; currentClipAmmo = maxClipSize; currentBulletId = 0; firingSpeed = 1.0f; firingSpeedCurrentDelay = 0; reloadTime = 0.0f; rldTimer = 0; } int Melee::update(float deltaTime) { countDownFiringSpeed(deltaTime); return 0; }
[ "martin_nygren9405@hotmail.com" ]
martin_nygren9405@hotmail.com
c3fd38299e85c4279f858013701ac8d41c9c353d
3053e477f91dcfa12fcfe094408b0fbf8fa14de6
/Resources/Utils/calculateEM/source/main.cpp
2afe609802b9db9d2acd6e7cb0818cc79fd660cf
[ "MIT" ]
permissive
sjbradshaw/HYDRAD
eb19013f3869601bcc6754a9a58f6c2acfae8616
4d5eb698570d8a631995be8bff52138dd4f4ef5e
refs/heads/master
2023-04-18T03:48:30.574642
2021-05-05T14:44:56
2021-05-05T14:44:56
109,440,613
0
0
null
null
null
null
UTF-8
C++
false
false
2,982
cpp
// **** // * // * A routine to calculate the emission measure and the differential emission measure // * from spatially averaged electron densities and temperatures // * // * (c) Dr. Stephen J. Bradshaw // * // * Date last modified: 11/11/2015 // * // **** #include <stdio.h> #include <stdlib.h> #include <math.h> #include "../../../source/file.h" int main(void) { FILE *pCONFIGFile, *pINPUTFile, *pOUTPUTFile; char szINPUTFilename[256], szOUTPUTFilename[256]; char szBuffer[256]; double *pfEM; double fdR, fLogTmax, fLogTmin, fdexStep; double fTimeStamp, fn, fTe, fTH; double fLogTe, fEM_T, fDEM_T; int iNumElements, iNumFiles, iNumRows, iBin; int i, j; // Open the configuration file pCONFIGFile = fopen( "config.cfg", "r" ); // Get the line-of-sight depth ReadDouble( pCONFIGFile, &fdR ); fscanf( pCONFIGFile, "%s", szBuffer ); // Get the temperature range of the emission measure ReadDouble( pCONFIGFile, &fLogTmin ); fscanf( pCONFIGFile, "%s", szBuffer ); ReadDouble( pCONFIGFile, &fLogTmax ); fscanf( pCONFIGFile, "%s", szBuffer ); ReadDouble( pCONFIGFile, &fdexStep ); fscanf( pCONFIGFile, "%s", szBuffer ); iNumElements = ( fLogTmax - fLogTmin ) / fdexStep; pfEM = (double*)malloc( sizeof(double) * iNumElements ); // Get the number of input files fscanf( pCONFIGFile, "%i", &iNumFiles ); fscanf( pCONFIGFile, "%s", szBuffer ); for( i=0; i<iNumFiles; i++ ) { // Reset the emission measure for( j=0; j<iNumElements; j++ ) pfEM[j] = 0.0; // Get the filename of the input file fscanf( pCONFIGFile, "%s", szINPUTFilename ); fscanf( pCONFIGFile, "%s", szBuffer ); // Open the input file pINPUTFile = fopen( szINPUTFilename, "r" ); // Get the number of rows from the input file fscanf( pINPUTFile, "%i", &iNumRows ); for( j=0; j<iNumRows; j++ ) { // Get the timestamp ReadDouble( pINPUTFile, &fTimeStamp ); // Get the number density ReadDouble( pINPUTFile, &fn ); // Get the electron temperature ReadDouble( pINPUTFile, &fTe ); // Get the hydrogen temperature ReadDouble( pINPUTFile, &fTH ); // Find the temperature bin to fill with the emission measure fLogTe = log10( fTe ); iBin = ( fLogTe - fLogTmin ) / fdexStep; if( iBin >= 0 && iBin < iNumElements ) pfEM[iBin] += fn * fn; } fclose( pINPUTFile ); // Get the filename of the output file fscanf( pCONFIGFile, "%s", szOUTPUTFilename ); fscanf( pCONFIGFile, "%s", szBuffer ); // Open the output file pOUTPUTFile = fopen( szOUTPUTFilename, "w" ); fLogTe = fLogTmin + (fdexStep/2.0); for( j=0; j<iNumElements; j++ ) { fEM_T = ((fdR*pfEM[j])/(double)iNumRows)/fdexStep; fDEM_T = fEM_T / ( log(10) * pow(10.0,fLogTe) ); fprintf( pOUTPUTFile, "%.4g\t%.4g\t%.4g\n", fLogTe, fEM_T, fDEM_T ); fLogTe += fdexStep; } fclose( pOUTPUTFile ); } free( pfEM ); fclose( pCONFIGFile ); return 0; }
[ "wtb2@rice.edu" ]
wtb2@rice.edu
9aaf6bb199232a71111cb9f9c206ef7095f56fc1
3553b623f019c4914f99ade83754c289a11338a8
/dodo/dodo/boj17825.cpp
5b6edd1464b1c6fafc5051185281030d8009da42
[]
no_license
WonJin4631/AlgorithmStudy
752e6dd9e71177a9098acc149f4d40778bf4c294
28e036f54dd6dd4553c1e6ac82fed509609c325b
refs/heads/master
2023-01-07T03:32:45.185292
2020-11-01T03:55:33
2020-11-02T07:51:28
168,090,955
0
0
null
null
null
null
UHC
C++
false
false
2,115
cpp
#include<iostream> #include<vector> using namespace std; /* 4개 말 10개 주사위 수 말이 이동 멈출때 위치 점수 추가 같은자리에 이동 불가 종료위치 이상 갈때 종료위치 종료위치 말 이동 안됨 */ int move_list[11]; int map[] = { 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,0/*여기까지21*/,10,13,16,19,25/*오른쪽 26*/,20,22,24,25,30,35,40/*위로 33*/,30,28,27,26,25 /*왼쪽 38*/}; int mal[5] = { 0 }; int summal[5] = { 0 }; int visit[47]; bool fin[5] = { false }; int ans = 0; int change(int cur,int num) { int n_pos =num + cur; if (cur >= 0 && cur <= 20) { if (n_pos == 5) return 22; if (n_pos == 10) return 27; if (n_pos == 15) return 34; if (n_pos > 20) return 21; } else if (cur >= 22 && cur <= 26) { if (n_pos >= 30) return 21; if (n_pos == 29) return 20; else if (n_pos == 26) return 30; else if (n_pos > 26) return 30 - (26 - cur) + num; } else if (cur >= 27 && cur <= 33) { if (n_pos == 33) return 20; if (n_pos > 33) return 21; } else if (cur >= 34 && cur <= 38) { if (n_pos >= 42) return 21; if (n_pos == 41) return 20; else if (n_pos == 38) return 30; else if(n_pos>38) return 30 - (38 - cur) + num; } return n_pos; } void solve(int cnt,int sum) { if (cnt == 10) { if (ans < sum) { ans = sum; } return; } for (int i = 0; i < 4; i++) { //종료 위치에 있는말 이동안함 if (mal[i] == 21) continue; int curpos = mal[i]; int nextpos = change(curpos, move_list[cnt]); //다음 자리에 말이 위치하면 안움직임 if (visit[nextpos] == 1) continue; //말이 종료시에 if (nextpos == 21) { visit[curpos] = 0; mal[i] = nextpos; solve(cnt + 1, sum); mal[i] = curpos; visit[curpos] = 1; } //아닐시 else { visit[curpos] = 0; visit[nextpos] = 1; mal[i] = nextpos; solve(cnt + 1, sum+map[mal[i]]); mal[i] = curpos; visit[curpos] = 1; visit[nextpos] = 0; } } } int main() { for (int i = 0; i < 10; i++) { cin >> move_list[i]; } solve(0,0); cout << ans << '\n'; }
[ "pwj4119@gmail.com" ]
pwj4119@gmail.com
a144e44e03e0f60f75206ce23d030f2b812bbe72
7ed7151f5523aba4d747a69920ebd193d6ac891b
/平成26年/数位DP/HDU3943.cpp
943cb7f73643822a6556eefa9d94d5c9680da0f1
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
zjkmxy/algo-problems
5965db9969855f208ae839d42a32a9b55781b590
7f2019a2ba650370e1e7af8ee96e6bfa5b4e3f87
refs/heads/master
2020-08-16T09:30:00.026431
2019-10-22T05:07:07
2019-10-22T05:07:07
215,485,779
0
0
null
null
null
null
GB18030
C++
false
false
1,982
cpp
//区间(P,Q]之间第K_i大的Nya数(含X个4和Y个7的数)。 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<queue> using namespace std; typedef signed long long LL; LL dp[30][10][21][21]; //位数,元素,4,7 void dp_calc() { int i, j, k, l, x; for(i=0;i<=9;i++) { dp[0][i][0][0] = 1; } dp[0][4][0][0] = 0; dp[0][4][1][0] = 1; dp[0][7][0][0] = 0; dp[0][7][0][1] = 1; for(i=1;i<30;i++) { for(j=0;j<10;j++) { for(k=0;k<=20;k++) { for(l=0;l<=20;l++) { for(x=0;x<10;x++) { switch(j) { case 4: if(k > 0) dp[i][j][k][l] += dp[i-1][x][k-1][l];//这里坑了我很久,因为k-1是负数的时候会得到错误的结果 break; case 7: if(l > 0) dp[i][j][k][l] += dp[i-1][x][k][l-1]; break; default: dp[i][j][k][l] += dp[i-1][x][k][l]; break; } } } } } } } LL calc(LL ans, int x, int y) { int i = 0, j, k; int dig[30]; LL ret = 0; while(ans > 0) { dig[i] = ans % 10; ans /= 10; i++; } dig[i] = 0; for(j=i-1;j>=0;j--) { for(k=0;k<dig[j];k++) { ret += dp[j][k][x][y]; } if(dig[j] == 4) { x--; } if(dig[j] == 7) { y--; } if(x < 0 || y < 0) break; } if(x == 0 && y == 0) ret++; return ret; } LL bisearch(LL p, LL q, int x, int y, LL k) { LL equ, mid, cur; equ = calc(p, x, y) + k; if(equ > calc(q, x, y)) return -1; //答案在(p,q]区间内 while(q > p + 1) { mid = (p + q) >> 1; cur = calc(mid, x, y); if(cur >= equ) { q = mid; }else{ p = mid; } } return q; } int main() { int t, x, y, n, i; LL ans, p, k, q; dp_calc(); scanf("%d",&t); for(i=1;i<=t;i++) { printf("Case #%d:\n",i); scanf("%I64d%I64d%d%d%d",&p,&q,&x,&y,&n); while(n--) { scanf("%I64d",&k); ans = bisearch(p, q, x, y, k); if(ans >= 0) printf("%I64d\n",ans); else printf("Nya!\n"); } } return 0; }
[ "bitmxy@gmail.com" ]
bitmxy@gmail.com
0300f9f9bd50918ac6ea91919c29384d55f8be60
a02efe134cb6e0c0acfee5349e8a88fb844114b3
/Lab/GradeIndependentIf/main.cpp
35287a1fd5910b7af89d472a97495d51a3aa102c
[]
no_license
zmiller928/MillerZachary_CSC5_Spring2017
051c2c5c22d7846b6b5e17db50fbc4f3e1e7bec6
62624d1e5896a0a4550fd5ae73d4c5b1545dd595
refs/heads/master
2020-05-18T13:03:50.073784
2017-04-18T04:27:55
2017-04-18T04:27:55
84,238,016
0
0
null
null
null
null
UTF-8
C++
false
false
1,054
cpp
/* * File: main.cpp * Author: Zachary Miller * Purpose: Grade branching exercise * Created on March 16, 2017, 11:23 AM */ #include <iostream> using namespace std; int main(int argc, char** argv) { unsigned short score; //Integer scores valid from 0-100 char grade; cout << "The program produces a grade from a score input" << endl; cout << "The date type used is an integer (0-100)" << endl; cout << "Type in the score:" << endl; cin >> score; if (!(score >= 0 && score <=100)) { cout << "You failed to type an integer between 0 and 100" << endl; return 1; //Use DeMorgans Law to make clearer } if (score >= 90 && score <= 100) grade = 'A'; if (score >= 80 && score < 90) grade = 'B'; if (score >= 70 && score < 80) grade = 'C'; if (score >= 60 && score < 70) grade = 'D'; if (score < 60) grade = 'F'; cout << "For a score = " << score << " your grade is an " << grade << "." << endl; return 0; }
[ "zackyftw@gmail.com" ]
zackyftw@gmail.com
e835fc1cbd56a873a983ff7715e0ac6326a679a5
c61c802fea3e3ccca3f611f8a3d9fe72a8053504
/src/modules.cpp
93fb208a1cc1297adde0ca62e2a19ae37a064269
[]
no_license
Johncorex/perfect-source
fce01617061641d04f9c36d4696b34fc219dae38
2d37b382ecf25364388ed4a8e390c3fb6e1577b9
refs/heads/master
2020-07-25T14:41:15.983264
2019-09-13T19:50:23
2019-09-13T19:50:23
208,326,464
0
0
null
null
null
null
UTF-8
C++
false
false
5,306
cpp
/** * The Forgotten Server - a free and open-source MMORPG server emulator * Copyright (C) 2019 Mark Samman <mark.samman@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "otpch.h" #include "modules.h" #include "player.h" Modules::Modules() : scriptInterface("Modules Interface") { scriptInterface.initState(); } void Modules::clear() { //clear recvbyte list for (auto& it : recvbyteList) { it.second.clearEvent(); } //clear lua state scriptInterface.reInitState(); } LuaScriptInterface& Modules::getScriptInterface() { return scriptInterface; } std::string Modules::getScriptBaseName() const { return "modules"; } Event_ptr Modules::getEvent(const std::string& nodeName) { if (strcasecmp(nodeName.c_str(), "module") != 0) { return nullptr; } return Event_ptr(new Module(&scriptInterface)); } bool Modules::registerEvent(Event_ptr event, const pugi::xml_node&) { Module_ptr module {static_cast<Module*>(event.release())}; if (module->getEventType() == MODULE_TYPE_NONE) { std::cout << "Error: [Modules::registerEvent] Trying to register event without type!" << std::endl; return false; } Module* oldModule = getEventByRecvbyte(module->getRecvbyte(), false); if (oldModule) { if (!oldModule->isLoaded() && oldModule->getEventType() == module->getEventType()) { oldModule->copyEvent(module.get()); } return false; } else { auto it = recvbyteList.find(module->getRecvbyte()); if (it != recvbyteList.end()) { it->second = *module; } else { recvbyteList.emplace(module->getRecvbyte(), std::move(*module)); } return true; } } Module* Modules::getEventByRecvbyte(uint8_t recvbyte, bool force) { ModulesList::iterator it = recvbyteList.find(recvbyte); if (it != recvbyteList.end()) { if (!force || it->second.isLoaded()) { return &it->second; } } return nullptr; } void Modules::executeOnRecvbyte(Player* player, NetworkMessage& msg, uint8_t byte) const { for (auto& it : recvbyteList) { Module module = it.second; if (module.getEventType() == MODULE_TYPE_RECVBYTE && module.getRecvbyte() == byte && player->canRunModule(module.getRecvbyte())) { player->setModuleDelay(module.getRecvbyte(), module.getDelay()); module.executeOnRecvbyte(player, msg); return; } } } ///////////////////////////////////// Module::Module(LuaScriptInterface* interface) : Event(interface), type(MODULE_TYPE_NONE), loaded(false) {} bool Module::configureEvent(const pugi::xml_node& node) { delay = 0; pugi::xml_attribute typeAttribute = node.attribute("type"); if (!typeAttribute) { std::cout << "[Error - Modules::configureEvent] Missing type for module." << std::endl; return false; } std::string tmpStr = asLowerCaseString(typeAttribute.as_string()); if (tmpStr == "recvbyte") { pugi::xml_attribute byteAttribute = node.attribute("byte"); if (!byteAttribute) { std::cout << "[Error - Modules::configureEvent] Missing byte for module typed recvbyte." << std::endl; return false; } recvbyte = static_cast<uint8_t>(byteAttribute.as_int()); type = MODULE_TYPE_RECVBYTE; } else { std::cout << "[Error - Modules::configureEvent] Invalid type for module." << std::endl; return false; } pugi::xml_attribute delayAttribute = node.attribute("delay"); if (delayAttribute) { delay = static_cast<uint16_t>(delayAttribute.as_uint()); } loaded = true; return true; } std::string Module::getScriptEventName() const { switch (type) { case MODULE_TYPE_RECVBYTE: return "onRecvbyte"; default: return std::string(); } } void Module::copyEvent(Module* module) { scriptId = module->scriptId; scriptInterface = module->scriptInterface; scripted = module->scripted; loaded = module->loaded; } void Module::clearEvent() { scriptId = 0; scriptInterface = nullptr; scripted = false; loaded = false; } void Module::executeOnRecvbyte(Player* player, NetworkMessage& msg) { //onAdvance(player, skill, oldLevel, newLevel) if (!scriptInterface->reserveScriptEnv()) { std::cout << "[Error - CreatureEvent::executeAdvance] Call stack overflow" << std::endl; return; } ScriptEnvironment* env = scriptInterface->getScriptEnv(); env->setScriptId(scriptId, scriptInterface); lua_State* L = scriptInterface->getLuaState(); scriptInterface->pushFunction(scriptId); LuaScriptInterface::pushUserdata<Player>(L, player); LuaScriptInterface::setMetatable(L, -1, "Player"); LuaScriptInterface::pushUserdata<NetworkMessage>(L, const_cast<NetworkMessage*>(&msg)); LuaScriptInterface::setWeakMetatable(L, -1, "NetworkMessage"); lua_pushnumber(L, recvbyte); scriptInterface->callVoidFunction(3); }
[ "gjohnes2018@gmail.com" ]
gjohnes2018@gmail.com
e35a9906361ca7f52b6816f3b3e0291423ca1c57
a0423109d0dd871a0e5ae7be64c57afd062c3375
/Aplicacion Movil/generated/bundles/login-transition/build/Android/Preview/app/src/main/include/Uno.ArgumentNullException.h
370ddf470bdaf697a9d19fbb38a4a13acd8a1349
[ "Apache-2.0" ]
permissive
marferfer/SpinOff-LoL
1c8a823302dac86133aa579d26ff90698bfc1ad6
a9dba8ac9dd476ec1ef94712d9a8e76d3b45aca8
refs/heads/master
2020-03-29T20:09:20.322768
2018-10-09T10:19:33
2018-10-09T10:19:33
150,298,258
0
0
null
null
null
null
UTF-8
C++
false
false
828
h
// This file was generated based on C:/Users/JuanJose/AppData/Local/Fusetools/Packages/UnoCore/1.9.0/Source/Uno/Exceptions/ArgumentNullException.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.ArgumentException.h> namespace g{namespace Uno{struct ArgumentNullException;}} namespace g{ namespace Uno{ // public sealed class ArgumentNullException :6 // { ::g::Uno::Exception_type* ArgumentNullException_typeof(); void ArgumentNullException__ctor_5_fn(ArgumentNullException* __this, uString* paramName); void ArgumentNullException__New6_fn(uString* paramName, ArgumentNullException** __retval); struct ArgumentNullException : ::g::Uno::ArgumentException { void ctor_5(uString* paramName); static ArgumentNullException* New6(uString* paramName); }; // } }} // ::g::Uno
[ "mariofdezfdez@hotmail.com" ]
mariofdezfdez@hotmail.com
f9e0da01fa6e8ace380b7e1e9e5ec78cc27cf4f5
33035c05aad9bca0b0cefd67529bdd70399a9e04
/src/boost_hana_fwd_monadic_fold_right.hpp
cfe6d18add04907e69c4765f63d70ab7c43e86df
[ "LicenseRef-scancode-unknown-license-reference", "BSL-1.0" ]
permissive
elvisbugs/BoostForArduino
7e2427ded5fd030231918524f6a91554085a8e64
b8c912bf671868e2182aa703ed34076c59acf474
refs/heads/master
2023-03-25T13:11:58.527671
2021-03-27T02:37:29
2021-03-27T02:37:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
49
hpp
#include <boost/hana/fwd/monadic_fold_right.hpp>
[ "k@kekyo.net" ]
k@kekyo.net
3b9cba10b738acbc07edf04fb92ac8642b680801
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14303/function14303_schedule_12/function14303_schedule_12.cpp
32a28b332f3bf9d4aa0428f21ef70fac1c9bb2c3
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C++
false
false
716
cpp
#include <tiramisu/tiramisu.h> using namespace tiramisu; int main(int argc, char **argv){ tiramisu::init("function14303_schedule_12"); constant c0("c0", 64), c1("c1", 64), c2("c2", 64), c3("c3", 128); var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i3("i3", 0, c3), i01("i01"), i02("i02"), i03("i03"), i04("i04"); computation comp0("comp0", {i0, i1, i2, i3}, 7 * 6); comp0.tile(i2, i3, 64, 64, i01, i02, i03, i04); comp0.parallelize(i0); buffer buf0("buf0", {64, 64, 64, 128}, p_int32, a_output); comp0.store_in(&buf0); tiramisu::codegen({&buf0}, "../data/programs/function14303/function14303_schedule_12/function14303_schedule_12.o"); return 0; }
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
fd4ac2103f34ede5a20be5e98fcb1fe8d636217f
f859143b4f2fafc5619b822618339167556f3174
/CaSh/FastApp/DeferredShadingFastApp.h
67c60b643e06df03773a66c35fa6af6ad81568fa
[]
no_license
BentleyBlanks/SKTRenderer
ef8ee1d2e36259dd30becf9f3b48677da0472210
2f3cf944e2872920c21764c27ee8b10d4d9ad500
refs/heads/master
2021-04-15T17:19:27.654944
2018-03-06T08:32:48
2018-03-06T08:32:48
126,149,197
8
0
null
null
null
null
UTF-8
C++
false
false
4,227
h
#pragma once #include "FastApp.h" #include "d3d11.h" #include "D3DCompiler.h" #include <vector> #include "Vector3.h" #include "Vector2.h" #include "Matrix.h" using std::vector; #define PAD16(x) (((x)+15)/16*16) class DefferedShadingFastApp : public FastApp { public: struct Vertex_PNT { RBVector3 pos; RBVector3 normal; RBVector2 texcoord; }; struct Vertex_PNTT { RBVector3 pos; RBVector3 normal; RBVector2 texcoord; RBVector3 tangent; }; struct Vertex_PT { RBVector3 pos; RBVector2 texcoord; }; struct MatrixBuffer { RBMatrix m; RBMatrix v; RBMatrix p; }; struct ScreenSize { uint32 w; uint32 h; f32 hipow; float factor_l; RBMatrix inv_projection; RBMatrix mv; float metallic; int shading_model; }; virtual bool preinit() override; virtual bool init() override; virtual void update(f32 dt) override; virtual void draw() override; virtual void ter() override; virtual void postter() override; DefferedShadingFastApp(class AppBase* app); virtual ~DefferedShadingFastApp(); DefferedShadingFastApp(const DefferedShadingFastApp& o) = delete; DefferedShadingFastApp& operator=(const DefferedShadingFastApp& o) = delete; protected: void load_models_generate_buffer(const char* filename); void load_assets(); void create_rhires(); void set_matrix(const RBMatrix& m,const RBMatrix& v,const RBMatrix& p); void set_screen_size(); void set_gpass_vbuffer(); void handle_input(f32 dt); private: void show_error_message(ID3D10Blob* error, const char* filename); ID3D11Texture2D* _bufferA; ID3D11RenderTargetView* _bufferA_target_view; ID3D11ShaderResourceView* _bufferA_shader_view; ID3D11Texture2D* _bufferB; ID3D11RenderTargetView* _bufferB_target_view; ID3D11ShaderResourceView* _bufferB_shader_view; ID3D11Texture2D* _bufferC; ID3D11RenderTargetView* _bufferC_target_view; ID3D11ShaderResourceView* _bufferC_shader_view; ID3D11Texture2D* _bufferDepth; ID3D11RenderTargetView* _bufferDepth_target_view; ID3D11ShaderResourceView* _bufferDepth_shader_view; ID3D11Texture2D* _buffer_lighting; ID3D11RenderTargetView* _buffer_lighting_target_view; ID3D11ShaderResourceView* _buffer_lighting_shader_view; ID3D11Texture2D* _buffer_depth_stencil; ID3D11ShaderResourceView* _buffer_depth_stencil_shader_view; ID3D11DepthStencilView* _buffer_depth_stencil_ds_view; ID3D11Texture2D* _env_texture; ID3D11ShaderResourceView* _env_texture_shader_view; ID3D11Texture2D* _mat_texture; ID3D11ShaderResourceView* _mat_texture_shader_view; ID3D11Texture2D* _normal_texture; ID3D11ShaderResourceView* _normal_texture_shader_view; ID3D11Texture2D* _env_texture_single; ID3D11ShaderResourceView* _env_texture_single_shader_view; ID3D11Texture2D* _env_texture_hdr; ID3D11ShaderResourceView* _env_texture_hdr_shader_view; /** models */ ID3D11Buffer* _index_buffer; ID3D11Buffer* _vertex_buffer; ID3D11Texture2D* _texture1; ID3D11ShaderResourceView* _texture1_sview; ID3D11Buffer* _index_buffer_lighting; ID3D11Buffer* _vertex_buffer_lighting; ID3D11VertexShader* _def_vertex_shader; ID3D11GeometryShader* _def_geometry_shader; ID3D11PixelShader* _def_pixel_shader; ID3D11VertexShader* _def_vertex_shader_light; ID3D11PixelShader* _def_pixel_shader_light; ID3D11DepthStencilState* _depth_stencil_state; ID3D11DepthStencilState* _depth_stencil_state_disable; ID3D11BlendState* _blending_state; ID3D11BlendState* _blending_state_disable; ID3D11Buffer* _matrix_buffer; ID3D11Buffer* _screen_size_buffer; ID3D11Buffer* _dv_cbuffer; ID3D11InputLayout* _layout; ID3D11InputLayout* _layout_lighting; ID3D11SamplerState* _sample_state; ID3D11RasterizerState* _raster_state; ID3D11Device* _device; ID3D11DeviceContext* _context; IDXGIFactory1* _gi_factory; std::vector<Vertex_PNTT> _vecs; std::vector<u32> _idxs; Vertex_PT quad[4]; uint16 quad_idx[6]; class RBCamera* _cam; RBVector2 _cam_move_speed; RBVector2 _cam_rotate_speed; int old_x, old_y; float _high_light; float _factor_l; float _metallic; int _shading_model; float _zplus; pD3DCompile compile_shader; HMODULE CompilerDLL; };
[ "wubuguiqazwsxmail@gmail.com" ]
wubuguiqazwsxmail@gmail.com
d7ccb6631c561457e19bc4a3bde074885fb461df
d05174cfc67cdf43d085ed631a3ef239766b3eec
/person_profiler/common/split.hpp
6768c4401d5ef1e1461969716594a81088ca9cd8
[]
no_license
crastinus/person_profiler
483a62c3d7e3349bab6393631aad5c87d12b8af6
01392591d041a4563f0d75a450b8ebdf8fa2632d
refs/heads/master
2020-04-08T02:10:41.324457
2019-01-14T04:48:02
2019-01-14T04:48:02
158,925,471
0
0
null
null
null
null
UTF-8
C++
false
false
364
hpp
#pragma once #include <vector> #include <string> enum class split_opts { allow_blank = 0, skip_blank = 1 }; std::vector<std::string> split_any(std::string const& source_str, char const* separators, split_opts options = split_opts::allow_blank); template<typename Type> std::vector<Type> split_to(std::string const& source_str, char const* separators);
[ "crastin@yandex.ru" ]
crastin@yandex.ru
f8437976bec80df5972f1e2d06fed314ff8b0d81
eaae950ea581cf441ebaaeaa584d15f22a235f65
/tests/sqlite/localURIDatabase/src/testCode/testRequestReply/requesterProcess/main.cpp
9ac798dba34e2fe9214cc9b7a70e7a591516ad13
[]
no_license
charlesrwest/societyOfMachines
ab4f95ae6fdf0a9e470d962185fd76e737167aae
1d8091d2d0e990b20597110a564a0fdd89b08039
refs/heads/master
2020-12-24T16:49:19.085136
2015-03-01T00:26:51
2015-03-01T00:26:51
22,320,803
0
0
null
null
null
null
UTF-8
C++
false
false
2,150
cpp
#include<stdio.h> #include "localURIDatabase.h" #include "utilityFunctions.h" #include<vector> #include<string> #include<exception> #include<unistd.h> #include "localURIEngine.hpp" #include "SOMScopeGuard.hpp" #include "localReplier.hpp" #include "localRequester.hpp" #include "SOMException.hpp" /* This program is meant to be used with replierProcess. It seaches for repliers that have tag "tag4" and sends requests to the first one it finds. */ int main(int argc, char **argv) { try { //Start the URI engine localURIEngine::startEngine("../IPCDirectory/"); //Construct the query to find repliers with the "tag4" tag localURIQuery myQuery1; myQuery1.add_requiredtags("tag4"); //Send the query std::vector<localURI> queryResults1; queryResults1 = localURIEngine::getRepliers(myQuery1); //Thread-safe //Print out the URIs that were found printf("Matching URIs:\n"); for(int i=0; i<queryResults1.size(); i++) { printf("%s\n", uriToString(queryResults1[i]).c_str()); } //Check to make sure at least one match was found if(queryResults1.size() == 0) { fprintf(stderr, "Error, no repliers match required criteria\n"); return 1; } //Build a requester with the first matching URI localRequester myRequester(queryResults1[0]); //Send over 9000 requests zmq::message_t messageBuffer; for(int i=0; i<9001; i++) { //Build the request string std::string requestString = "Request number " + std::to_string(i); //Send request printf("Sending request %s\n", requestString.c_str()); if(myRequester.sendRequest(requestString.c_str(), requestString.size()) != 1) { throw SOMException("Requester had a spot of trouble sending request\n", UNKNOWN, __FILE__, __LINE__); } //Restore the message buffer to a blank slate messageBuffer.rebuild(); //Get the reply if(myRequester.getReply(&messageBuffer) != 1) { throw SOMException("Requester had a spot of trouble getting reply\n", UNKNOWN, __FILE__, __LINE__); } //Print out what the replier sent printf("Received: "); fwrite(messageBuffer.data(), 1, messageBuffer.size(), stdout); printf("\n"); } } catch(const std::exception &inputException) { fprintf(stderr, "%s", inputException.what()); } return 0; }
[ "crwest@ncsu.edu" ]
crwest@ncsu.edu
b7bfd095085da0931384af482c7115d2f8df47ca
2fd1f7cb28d069d38391496946a18df0b9736cf7
/20190716/20190716_p2.cpp
b04ef328934d9c81e866de48f737f3148891173e
[]
no_license
jyb2605/SW-Algorithm
c268bb5186b70a95bf5aefeb8dd3a236c04ced94
51f39694fad2752a3383381f6f514d6e0d9b275d
refs/heads/master
2020-06-21T09:03:03.335460
2019-07-17T15:15:55
2019-07-17T15:15:55
197,402,426
0
0
null
null
null
null
UTF-8
C++
false
false
801
cpp
/* * D2 * 1945. 간단한 소인수분해 */ #include <iostream> #include <vector> using namespace std; int main() { int testcase; cin >> testcase; for (int _case = 1; _case <= testcase; _case++) { int number; cin >> number; cout << '#' << _case << ' '; int count = 0; while ((number % 2) == 0) { number /= 2; count++; } cout << count << ' '; count = 0; while ((number % 3) == 0) { number /= 3; count++; } cout << count << ' '; count = 0; while ((number % 5) == 0) { number /= 5; count++; } cout << count << ' '; count = 0; while ((number % 7) == 0) { number /= 7; count++; } cout << count << ' '; count = 0; while ((number % 11) == 0) { number /= 11; count++; } cout << count<<'\n'; } return 0; }
[ "jyb2605@gmail.com" ]
jyb2605@gmail.com
79a6a4207eab38df5f291adee9c4a0acaf465d1e
3dfb9dec1846d2faafa32bf8cb064d53ca25cba4
/CMPE243/HW/Unit testing/sensor.cpp
cafd045ff29097e2c2087b23098bced4088dc904
[]
no_license
ychen928/my_SJSU_projects
3fcb80eaeb50f1f949ec2cc36d5729b4d16a4634
6454367d793e70bc96122deb20d15e11bb717e2a
refs/heads/master
2021-08-28T06:23:53.741225
2017-12-11T11:53:33
2017-12-11T11:53:33
107,641,465
0
0
null
null
null
null
UTF-8
C++
false
false
68
cpp
int read_sensor_value(int sensor_value) { return sensor_value; }
[ "ychen2809@gmail.com" ]
ychen2809@gmail.com
f804449b1910d29848eed9d239b39c187817ac14
5dc072fc293a960fa5614b545b26c2eeea330f44
/src/hypercube.hpp
330759b051cc08bfa053ac097e90f3eb5a2d33f9
[]
no_license
Ahajha/snake-in-a-box
efd576f36745e47ba679af6a78dc931409e135a2
452acedc2162f9672c4aef2c902f7cd95737c1de
refs/heads/master
2023-01-22T10:47:18.490019
2020-11-15T06:27:50
2020-11-15T06:27:50
297,303,166
2
0
null
null
null
null
UTF-8
C++
false
false
1,229
hpp
#ifndef HYPERCUBE_HPP #define HYPERCUBE_HPP #include <array> #include <iostream> // Hypercube graph capable of keeping track of // induced vertices and degrees of vertices // with respect to how many induced neighbors // vertices have. template <unsigned N> struct hypercube { constexpr static unsigned numVertices = 1 << N; private: constexpr static std::array<std::array<unsigned, N>, numVertices> makeAdjLists(); public: // Format of array is [i] gives the adjacency list of vertex i, and // [i][j] gives the vertex obtained by starting from vertex i and // moving across dimension j. constexpr static auto adjLists = makeAdjLists(); struct vertex { bool induced; uint8_t effectiveDegree; vertex() : induced(false), effectiveDegree(0) {} }; std::array<vertex,numVertices> vertices; unsigned numInduced; hypercube(); // Reduce is the inverse of induce. void induce(unsigned); void reduce(unsigned); bool operator==(const hypercube& other) const; // Prints which vertices are induced as Xs, and those that are not // as _s, all on one line. template<unsigned M> friend std::ostream& operator<<(std::ostream& stream, const hypercube<M>& h); }; #include "hypercube.tpp" #endif
[ "ahajha@gmail.com" ]
ahajha@gmail.com
2ed35f7d7dbcdbb4d0758dc86d90b3653ded34dd
b33a9177edaaf6bf185ef20bf87d36eada719d4f
/qtbase/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp
e6267e8b6c0e2da4f866d7c3d187efb1b1f3499b
[ "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-commercial-license", "LGPL-2.0-or-later", "LGPL-2.1-only", "GFDL-1.3-only", "LicenseRef-scancode-qt-commercial-1.1", "LGPL-3.0-only", "LicenseRef-scancode-qt-company-exception-lgpl-2.1", ...
permissive
wgnet/wds_qt
ab8c093b8c6eead9adf4057d843e00f04915d987
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
refs/heads/master
2021-04-02T11:07:10.181067
2020-06-02T10:29:03
2020-06-02T10:34:19
248,267,925
1
0
Apache-2.0
2020-04-30T12:16:53
2020-03-18T15:20:38
null
UTF-8
C++
false
false
3,228
cpp
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <qtest.h> #include <QtCore/qvariant.h> #define ITERATION_COUNT 1e5 class tst_QGuiVariant : public QObject { Q_OBJECT public: tst_QGuiVariant(); virtual ~tst_QGuiVariant(); private slots: void createGuiType_data(); void createGuiType(); void createGuiTypeCopy_data(); void createGuiTypeCopy(); }; tst_QGuiVariant::tst_QGuiVariant() { } tst_QGuiVariant::~tst_QGuiVariant() { } void tst_QGuiVariant::createGuiType_data() { QTest::addColumn<int>("typeId"); for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i) QTest::newRow(QMetaType::typeName(i)) << i; } // Tests how fast a Qt GUI type can be default-constructed by a // QVariant. The purpose of this benchmark is to measure the overhead // of creating (and destroying) a QVariant compared to creating the // type directly. void tst_QGuiVariant::createGuiType() { QFETCH(int, typeId); QBENCHMARK { for (int i = 0; i < ITERATION_COUNT; ++i) QVariant(typeId, (void *)0); } } void tst_QGuiVariant::createGuiTypeCopy_data() { createGuiType_data(); } // Tests how fast a Qt GUI type can be copy-constructed by a // QVariant. The purpose of this benchmark is to measure the overhead // of creating (and destroying) a QVariant compared to creating the // type directly. void tst_QGuiVariant::createGuiTypeCopy() { QFETCH(int, typeId); QVariant other(typeId, (void *)0); const void *copy = other.constData(); QBENCHMARK { for (int i = 0; i < ITERATION_COUNT; ++i) QVariant(typeId, copy); } } QTEST_MAIN(tst_QGuiVariant) #include "tst_qguivariant.moc"
[ "p_pavlov@wargaming.net" ]
p_pavlov@wargaming.net
114e23d84315ba7f524cda36914441542a8fe03e
91b66eaad3fa6821075abfe54b6fa89b73a89af7
/branches/sandbox/cardboard/src/detection.cpp
52a39815485eb213ac8b8536daace094a7ccc995
[]
no_license
yutakage/mit-ros-pkg
635acf0783763affbc3d1b7280d19f70d12c5b95
05508bb956819eeff71c26ac9ecf62d3d3aab5db
refs/heads/master
2023-03-19T06:21:45.511617
2019-02-05T20:53:10
2019-02-05T20:53:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
41,704
cpp
#include <cardboard/detection.h> #include <cardboard/models.h> #include <cardboard/optimization.h> #include <cardboard/ply.h> #include <cardboard/util.h> #include "fitness.h" #include <cardboard/common.h> #include <cardboard/testing.h> #include <cardboard/SceneHypothesis.h> #include <cardboard/DetectModels.h> #include <cardboard/AlignModels.h> #include <pthread.h> #include <sensor_msgs/PointCloud.h> #include <sensor_msgs/PointCloud2.h> #include <sensor_msgs/point_cloud_conversion.h> #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/kdtree/kdtree_flann.h> #include <pcl/features/normal_3d.h> #include <pcl/surface/gp3.h> namespace cardboard { //------------------ INTERNAL CLASSES -------------------// class ModelPoseOptimizer : public GradientFreeRandomizedGradientOptimizer { private: ModelTester *model_tester_; const Model &model_; Matrix4f initial_pose_; public: ModelPoseOptimizer(ModelTester *T, const Model &model); float evaluate(VectorXf x); Matrix4f x2affine(VectorXf x); Matrix4f optimizeAffine(const Matrix4f &initial_pose); }; //--------------------- ModelPoseOptimizer class --------------------// ModelPoseOptimizer::ModelPoseOptimizer(ModelTester *T, const Model &model) : GradientFreeRandomizedGradientOptimizer(.07, Vector4f(.004, .004, 0, .03), 3.0), // TODO: clean this up model_tester_(T), model_(model) { } Matrix4f ModelPoseOptimizer::x2affine(VectorXf x) { Matrix4f A_shift = Matrix4f::Identity(); // shift to origin Vector3f t = initial_pose_.topRightCorner(3,1); A_shift.col(3) << -t, 1; A_shift(3,3) = 1; t += x.topRows(3); float theta = x(3); Quaternionf q(cos(theta/2.0), 0, 0, sin(theta/2.0)); Matrix4f A = pose_to_affine_matrix(t, q); // rotate, then unshift and translate by x(0:2) return A * A_shift * initial_pose_; } float ModelPoseOptimizer::evaluate(VectorXf x) { Matrix4f A = x2affine(x); return model_tester_->testHypothesis(model_, A); } Matrix4f ModelPoseOptimizer::optimizeAffine(const Matrix4f &initial_pose) { initial_pose_ = initial_pose; VectorXf x0 = VectorXf::Zero(4); VectorXf x = optimize(x0); return x2affine(x); } //------------Helper Functions --------------------------// double square(double num){ return num*num; } int findClosestPoseIndex(geometry_msgs::Pose initPose, vector<geometry_msgs::Pose> cluster_poses){ double smallestDist = -1; int smallestIndex = 0; for (uint i = 0; i < cluster_poses.size(); i++){ geometry_msgs::Pose clusterPose = cluster_poses[i]; double xDist = clusterPose.position.x - initPose.position.x; double yDist = clusterPose.position.y - initPose.position.y; double zDist = clusterPose.position.z - initPose.position.z; double eucDist = sqrt(square(xDist)+square(yDist)+square(zDist)); if (smallestDist == -1) smallestDist = eucDist; if (eucDist < smallestDist){ smallestDist = eucDist; smallestIndex = i; } } return smallestIndex; } // dbug -- move this to table_tracker static double adjust_table_height(const PointCloudXYZ &cloud, double table_height_init) { cardboard::init_rand(); int i, j, iter = 100, n = cloud.points.size(); double thresh = .01; double zmin = table_height_init, dmin = 1000*n; for (i = 0; i < iter; i++) { int j = rand() % n; double z = cloud.points[j].z; //printf("j = %d, z = %.2f\n", j, z); if (fabs(z - table_height_init) > .1) continue; double d = 0.0; for (j = 0; j < n; j += 10) { double dz = fabs(z - cloud.points[j].z); if (dz > thresh) dz = thresh; d += dz; } if (d < dmin) { dmin = d; zmin = z; } } return zmin; } /* convert a tf transform to an eigen transform */ void transformTFToEigen(const tf::Transform &t, Affine3f &k) { for(int i=0; i<3; i++) { k.matrix()(i,3) = t.getOrigin()[i]; for(int j=0; j<3; j++) { k.matrix()(i,j) = t.getBasis()[i][j]; } } // Fill in identity in last row for (int col = 0 ; col < 3; col ++) k.matrix()(3, col) = 0; k.matrix()(3,3) = 1; } /* project a point cloud into the XY plane */ void flatten_point_cloud(const PointCloudXYZ &cloud_in, PointCloudXYZ &cloud_out) { cloud_out = cloud_in; for (size_t i = 0; i < cloud_out.points.size(); i++) cloud_out.points[i].z = 0; } /** \brief Check if a 2d point (X and Y coordinates considered only!) is inside or outside a given polygon. This * method assumes that both the point and the polygon are projected onto the XY plane. * \note (This is highly optimized code taken from http://www.visibone.com/inpoly/) * Copyright (c) 1995-1996 Galacticomm, Inc. Freeware source code. * \param point a 3D point projected onto the same plane as the polygon * \param polygon a polygon */ static bool isXYPointIn2DXYPolygon (const pcl::PointXYZ &point, const geometry_msgs::Polygon &polygon) { bool in_poly = false; double x1, x2, y1, y2; int nr_poly_points = polygon.points.size (); double xold = polygon.points[nr_poly_points - 1].x; double yold = polygon.points[nr_poly_points - 1].y; for (int i = 0; i < nr_poly_points; i++) { double xnew = polygon.points[i].x; double ynew = polygon.points[i].y; if (xnew > xold) { x1 = xold; x2 = xnew; y1 = yold; y2 = ynew; } else { x1 = xnew; x2 = xold; y1 = ynew; y2 = yold; } if ( (xnew < point.x) == (point.x <= xold) && (point.y - y1) * (x2 - x1) < (y2 - y1) * (point.x - x1) ) { in_poly = !in_poly; } xold = xnew; yold = ynew; } return (in_poly); } /* filter a point cloud based on a polygon in the XY plane */ static void polygon_filter(const geometry_msgs::Polygon &polygon, const PointCloudXYZ &cloud_in, PointCloudXYZ &cloud_out) { cloud_out.height = 1; cloud_out.is_dense = false; cloud_out.points.resize(0); for (size_t i = 0; i < cloud_in.points.size(); i++) { if (isXYPointIn2DXYPolygon(cloud_in.points[i], polygon)) cloud_out.push_back(cloud_in.points[i]); } cloud_out.width = cloud_out.points.size(); } static void crossproduct(double vector1[],double vector2[], double Xproduct[]) { //initialize the cross product vector //calculate the i,j,k coefficients of the cross product Xproduct[0]=vector1[1]*vector2[2]-vector2[1]*vector1[2]; Xproduct[1]=vector1[0]*vector2[2]-vector2[0]*vector1[2]; Xproduct[2]=vector1[0]*vector2[1]-vector2[0]*vector1[1]; } static double dotProduct(double v1[], double v2[]) { double dp = v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; return dp; } static vector<geometry_msgs::Polygon> find_horizontal_surfaces(const vector<geometry_msgs::Polygon> &surface_polygons) { printf("break 1\n"); vector<geometry_msgs::Polygon> horizontal_surfaces; vector<geometry_msgs::Polygon> horizontal_surfaces_sorted; //TODO: Sort by height for (int i = 0; i < surface_polygons.size(); i++) { geometry_msgs::Polygon current = surface_polygons[i]; geometry_msgs::Point32 p1, p2, p3; p1 = current.points[0]; p2 = current.points[1]; p3 = current.points[2]; double v1[3] = {p1.x - p2.x, p1.y - p2.y, p1.z - p2.z}; double v2[3] = {p3.x - p2.x, p3.y - p2.y, p3.z - p2.z}; double normal[3]; crossproduct(v1, v2, normal); double mag = sqrt((normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2])); if (fabs(normal[2]/mag) > .9) { horizontal_surfaces.push_back(current); printf("horizontal normal is (%f, %f, %f)\n", normal[0]/mag, normal[1]/mag, normal[2]/mag); } } printf("break 2\n"); double lowestValBigger = 0; for (int j = 0; j < horizontal_surfaces.size(); j++) { double currentMin = 1000; //FIND OUT HOW SCALED geometry_msgs::Polygon currentMinPlane; for (int k = 0; k < horizontal_surfaces.size(); k++) { if (horizontal_surfaces[k].points[0].z > lowestValBigger) { if (horizontal_surfaces[k].points[0].z < currentMin) { currentMin = horizontal_surfaces[k].points[0].z; currentMinPlane = horizontal_surfaces[k]; } } } lowestValBigger = currentMin; horizontal_surfaces_sorted.push_back(currentMinPlane); } printf("break 3\n"); return horizontal_surfaces_sorted; } static vector<geometry_msgs::Polygon> find_nonhorizontal_surfaces(const vector<geometry_msgs::Polygon> &surface_polygons) { printf("break 1\n"); vector<geometry_msgs::Polygon> nonhorizontal_surfaces; for (int i = 0; i < surface_polygons.size(); i++) { geometry_msgs::Polygon current = surface_polygons[i]; geometry_msgs::Point32 p1, p2, p3; p1 = current.points[0]; p2 = current.points[1]; p3 = current.points[2]; double v1[3] = {p1.x - p2.x, p1.y - p2.y, p1.z - p2.z}; double v2[3] = {p3.x - p2.x, p3.y - p2.y, p3.z - p2.z}; double normal[3]; crossproduct(v1, v2, normal); double mag = sqrt((normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2])); if (fabs(normal[2]/mag) <= .9) { nonhorizontal_surfaces.push_back(current); printf("non-horizontal normal is (%f, %f, %f)\n", normal[0]/mag, normal[1]/mag, normal[2]/mag); } } printf("break 2\n"); return nonhorizontal_surfaces; } static void remove_plane_points(const vector<geometry_msgs::Polygon> &plane_polygons, const PointCloudXYZ &cloud_in, PointCloudXYZ &cloud_out) { printf("break 1\n"); // TODO: remove points near planes (optional: only remove points within polygon) bool inNewCloud[cloud_in.points.size()]; for (int k = 0; k < cloud_in.points.size(); k++) { inNewCloud[k] = true; } printf("break 2\n"); for (int i = 0; i < plane_polygons.size(); i++) { geometry_msgs::Point32 p1, p2, p3; p1 = plane_polygons[i].points[0]; p2 = plane_polygons[i].points[1]; p3 = plane_polygons[i].points[2]; double v1[] = {p1.x - p2.x, p1.y - p2.y, p1.z - p2.z}; double v2[] = {p3.x - p2.x, p3.y - p2.y, p3.z - p2.z}; double normal[3]; crossproduct(v1, v2, normal); double mag = sqrt((normal[0]*normal[0]+ normal[1]*normal[1] + normal[2]*normal[2])); normal[0] = normal[0]/mag; normal[1] = normal[1]/mag; normal[2] = normal[2]/mag; for (int j = 0; j < cloud_in.points.size(); j++) { pcl::PointXYZ cloudPoint = cloud_in.points[j]; double planeToPoint[] = {cloudPoint.x - p1.x, cloudPoint.y - p1.y, cloudPoint.z - p1.z}; double distFromPlane = fabs(dotProduct(planeToPoint, normal)); if (distFromPlane < .06) { //FIND OUT HOW THIS IS SCALED!!!! inNewCloud[j] = false; } } } printf("break 3\n"); cloud_out.points.resize(0); for (int n = 0; n < cloud_in.points.size(); n++) { if (inNewCloud[n]) { cloud_out.points.push_back(cloud_in.points[n]); } } printf("break 4\n"); } //--------------------- EXTERNAL API --------------------// SceneHypothesis *detect_models(sensor_msgs::PointCloud2 &msg, string target_frame, vector<geometry_msgs::Polygon> surface_polygons, tf::TransformListener *tf_listener, double table_filter_thresh, ModelManager *model_manager, std::vector<string> models, ros::Publisher &debug_pub) //dbug { // get the cloud in PCL format in the right coordinate frame PointCloudXYZ cloud, cloud2, full_cloud; pcl::fromROSMsg(msg, cloud); if (!pcl_ros::transformPointCloud(target_frame, cloud, cloud2, *tf_listener)) { ROS_WARN("Can't transform point cloud; aborting object detection."); return NULL; } full_cloud = cloud2; // lookup the transform from target frame to sensor tf::StampedTransform tf_transform; Eigen::Affine3f sensor_pose; try { //tf_listener->lookupTransform(msg.header.frame_id, target_frame, msg.header.stamp, tf_transform); tf_listener->lookupTransform(target_frame, msg.header.frame_id, msg.header.stamp, tf_transform); transformTFToEigen(tf_transform, sensor_pose); } catch (tf::TransformException& ex) { ROS_WARN("[point_cloud_callback] TF exception:\n%s", ex.what()); return NULL; } //pcl::RangeImage full_range_image; //pcl::RangeImage::CoordinateFrame frame = pcl::RangeImage::CAMERA_FRAME; //full_range_image.createFromPointCloud(full_cloud, .2*M_PI/180, 2*M_PI, M_PI, sensor_pose, frame, 0, 0, 0); //ROS_INFO("Got PointCloud2 msg with %lu points\n", cloud2.points.size()); //if (!have_table) // return NULL; // find horizontal planes using normals, and sort by height vector<geometry_msgs::Polygon> shelves = find_horizontal_surfaces(surface_polygons); // remove points near vertical planes vector<geometry_msgs::Polygon> walls = find_nonhorizontal_surfaces(surface_polygons); remove_plane_points(walls, full_cloud, cloud2); full_cloud = cloud2; SceneHypothesis *detected_objects = new SceneHypothesis(); // loop over flat surfaces, removing everything above the next shelf for (int i = 0; i < shelves.size(); i++) { // filter out points outside of the attention area, and only keep points above the table //ROS_INFO("Have table, filtering points on table..."); //polygon_filter(table_polygon, cloud2, cloud); ROS_INFO("Found flat surface, filtering points on shelf..."); polygon_filter(shelves[i], full_cloud, cloud); if (cloud.points.size() < 100) { ROS_WARN("Not enough points in table region; aborting object detection."); //return NULL; continue; } float table_height = adjust_table_height(cloud, shelves[i].points[0].z); printf("shelf_height = %.3f, table_height = %.3f\n", shelves[i].points[0].z, table_height); // remove everything above and below current shelf pcl::PassThrough<pcl::PointXYZ> pass; pass.setInputCloud(cloud.makeShared()); pass.setFilterFieldName("z"); double min_z = table_height + table_filter_thresh; double max_z = (i+1 < shelves.size() ? shelves[i+1].points[0].z - 2*table_filter_thresh : 1000.0); pass.setFilterLimits(min_z, max_z); pass.filter(cloud2); ROS_INFO("Removed shelves."); //dbug if (i==0) { sensor_msgs::PointCloud2 dbug_msg; pcl::toROSMsg(cloud2, dbug_msg); dbug_msg.header = msg.header; dbug_msg.header.frame_id = target_frame; debug_pub.publish(dbug_msg); } if (cloud2.points.size() < 100) { ROS_WARN("Not enough points above table; aborting object detection."); //return NULL; continue; } ROS_INFO("Downsampling point cloud with %lu points", cloud2.points.size()); pcl::VoxelGrid<pcl::PointXYZ> grid; //grid.setFilterFieldName ("z"); grid.setLeafSize (0.006, 0.006, 0.006); //grid.setFilterLimits (0.4, 1.1); //assuming there might be very low and very high tables grid.setInputCloud(cloud2.makeShared()); grid.filter(cloud); ROS_INFO("Clustering remaining %lu points", cloud.points.size()); // cluster groups of points (in the XY plane?) //flatten_point_cloud(cloud, cloud2); //dbug pcl::EuclideanClusterExtraction<pcl::PointXYZ> cluster; //KdTreeXYZ::Ptr clusters_tree = boost::make_shared< pcl::KdTreeFLANN<pcl::PointXYZ> > (); pcl::search::KdTree<pcl::PointXYZ>::Ptr clusters_tree (new pcl::search::KdTree<pcl::PointXYZ> ()); clusters_tree->setEpsilon (.0001); cluster.setClusterTolerance (0.02); cluster.setMinClusterSize (100); cluster.setSearchMethod (clusters_tree); vector<pcl::PointIndices> cluster_indices; cluster.setInputCloud (cloud.makeShared()); //cloud2 cluster.extract(cluster_indices); ROS_INFO("Found %lu clusters.", cluster_indices.size()); for (size_t i = 0; i < cluster_indices.size(); i++) { PointCloudXYZ cluster; pcl::copyPointCloud (cloud, cluster_indices[i], cluster); // compute cluster centroid Vector4f centroid; pcl::compute3DCentroid(cluster, centroid); geometry_msgs::Pose init_pose; init_pose.position.x = centroid(0); init_pose.position.y = centroid(1); init_pose.position.z = centroid(2); ROS_INFO("Cluster has %lu points with centroid (%.2f, %.2f, %.2f)\n", cluster.points.size(), centroid(0), centroid(1), centroid(2)); // create range image for point cluster pcl::RangeImage range_image0; pcl::RangeImage::CoordinateFrame frame = pcl::RangeImage::CAMERA_FRAME; range_image0.createFromPointCloud(cluster, .2*M_PI/180, 2*M_PI, M_PI, sensor_pose, frame, 0, 0, 0); //range_image0.createFromPointCloud(cluster, .3*M_PI/180, 2*M_PI, M_PI, sensor_pose, frame, 0, 0, 0); // dilate range image pcl::RangeImage range_image; cardboard::dilate_range_image(range_image0, range_image); // add background points from full point cloud to cluster range image for (size_t j = 0; j < cloud.points.size(); j++) { Vector3f p(cloud.points[j].x, cloud.points[j].y, cloud.points[j].z); int xi, yi; float r; range_image.getImagePoint(p, xi, yi, r); if (range_image.isInImage(xi, yi) && isinf(r)) range_image.getPoint(xi,yi).range = INFINITY; } // compute cluster normals // PointCloudXYZN cluster_normals; // cardboard::compute_normals(cluster, cluster_normals, .03); // compute range image with normals // pcl::RangeImage range_image_normals; // cardboard::compute_range_image_normals(range_image, cluster_normals, range_image_normals); // fit an object model to the cluster cardboard::RangeImageTester T1(range_image); cardboard::PointCloudDistanceTester T2(cluster); // cardboard::RangeImageNormalTester T3(range_image_normals); cardboard::CompositeTester model_tester(&T1,&T2);//,&T3); cardboard::ObjectHypothesis obj = fit_object(*model_manager, &model_tester, init_pose, table_height, tf_listener, models); T1.testHypothesis(model_manager->get_model(obj.name), cardboard::pose_to_affine_matrix(obj.pose), true); //if (obj.fitness_score < 1.6) // 1.6 sigma (less that 5% false negative) detected_objects->objects.push_back(obj); //else { //ROS_INFO("Current object is unidentifiable"); // compute PolygonMesh from cluster, add it to junk // Normal estimation* // Normal estimation* // pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (cluster); // pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> n; // pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); // pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr tree (new pcl::KdTreeFLANN<pcl::PointXYZ>); // tree->setInputCloud (cloud); // n.setInputCloud (cloud); // n.setSearchMethod (tree); // n.setKSearch (20); // n.compute (*normals); //* normals should not contain the point normals + surface curvatures // Concatenate the XYZ and normal fields* // pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals (new pcl::PointCloud<pcl::PointNormal>); // pcl::concatenateFields (*cloud, *normals, *cloud_with_normals); // //* cloud_with_normals = cloud + normals // // Create search tree* // pcl::KdTreeFLANN<pcl::PointNormal>::Ptr tree2 (new pcl::KdTreeFLANN<pcl::PointNormal>); // tree2->setInputCloud (cloud_with_normals); // Initialize objects // pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; // pcl::PolygonMesh triangles; // // Set the maximum distance between connected points (maximum edge length) // gp3.setSearchRadius (0.025); // // Set typical values for the parameters // gp3.setMu (2.5); // gp3.setMaximumNearestNeighbors (100); // gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees // gp3.setMinimumAngle(M_PI/18); // 10 degrees // gp3.setMaximumAngle(2*M_PI/3); // 120 degrees // gp3.setNormalConsistency(false); // Get result // gp3.setInputCloud (cloud_with_normals); // gp3.setSearchMethod (tree2); // gp3.reconstruct (triangles); // cardboard::Unidentifiable junk; // junk.mesh = triangles; // detected_objects->junk.push_back(junk); // } } } detected_objects->header.stamp = msg.header.stamp; detected_objects->header.frame_id = target_frame; //publish_scene_hypothesis(detected_objects, target_frame, msg.header.stamp); return detected_objects; } //-----------------------------------------------------------------------------------------------// ObjectHypothesis fit_object(const ModelManager &model_manager, ModelTester *model_tester, geometry_msgs::Pose init_pose, float table_height, tf::TransformListener *tf_listener, std::vector<string> models) { Matrix4f A0 = pose_to_affine_matrix(init_pose); ObjectHypothesis fit_model; // try fitting each model to the point cloud at several orientations fit_model.fitness_score = std::numeric_limits<float>::max(); //--- Create vector housing orientation rotations ----// std::vector<Quaternionf> orientations; orientations.push_back(Quaternionf(1,0,0,0)); orientations.push_back(Quaternionf(sqrt(2)/2,sqrt(2)/2,0,0)); orientations.push_back(Quaternionf(sqrt(2)/2, -1*sqrt(2)/2,0,0)); orientations.push_back(Quaternionf(0,1,0,0)); orientations.push_back(Quaternionf(sqrt(2)/2,0,sqrt(2)/2,0)); orientations.push_back(Quaternionf(sqrt(2)/2,0,-1*sqrt(2)/2,0)); for (uint i = 0; i < model_manager.models.size(); i++) { bool include_model = false; if (models.size() == 0) include_model = true; else { for (uint j = 0; j < models.size(); j++) { if (models[j].compare(model_manager.models[i].name) == 0) { include_model = true; break; } } } if (!include_model) continue; float min_score = std::numeric_limits<float>::max(); double t1, t2; t1 = get_time_ms(); // change to loop through 6 orientation Quaternions # pragma omp parallel for for (uint j = 0; j < orientations.size(); j++) { //dbug // rotate model onto a face of its convex hull Quaternionf q1 = orientations[j]; Vector3f t = Vector3f::Zero(); Matrix4f A_face = pose_to_affine_matrix(t, q1); # pragma omp parallel for for (uint k = 0 /*cnt*/; k < 5; k++) { //dbug // rotate model incrementally about the z-axis double a = 2*M_PI*(k/5.0); //dbug Quaternionf q2 = Quaternionf(cos(a/2), 0, 0, sin(a/2)); Matrix4f A_zrot = pose_to_affine_matrix(t, q2); Matrix4f A = A0 * A_zrot * A_face; pcl::PointCloud<pcl::PointXYZ> obj; pcl::transformPointCloud(model_manager.models[i].cloud, obj, A); // make sure bottom of model is touching table Vector4f pmin, pmax; pcl::getMinMax3D(obj, pmin, pmax); Matrix4f A_gravity = Matrix4f::Identity(); A_gravity(2,3) = table_height - pmin(2); pcl::transformPointCloud(obj, obj, A_gravity); A = A_gravity * A; // fit rotated model to range image ModelPoseOptimizer opt(model_tester, model_manager.models[i]); opt.setMaxIterations(200); Matrix4f A2 = opt.optimizeAffine(A); float score = opt.getFinalCost(); printf("."); fflush(0); # pragma omp critical { if (score < fit_model.fitness_score) { fit_model.fitness_score = score; fit_model.name = model_manager.models[i].name; fit_model.pose = affine_matrix_to_pose(A2); // * A } if (score < min_score) min_score = score; } } } t2 = get_time_ms(); printf("finished j loop in %.2f ms (min_score = %.4f)\n", t2-t1, min_score); } cout << "Best fit: obj = " << fit_model.name << ", score = " << fit_model.fitness_score << endl; //cout << fit_model.pose << endl; // print component scores const Model &best_model = model_manager.get_model(fit_model.name); if (best_model.name.size() != 0) { printf("component scores: [ "); CompositeTester *CT = (CompositeTester *)model_tester; for (uint i = 0; i < CT->testers.size(); i++) { float score = CT->testers[i]->testHypothesis(best_model, pose_to_affine_matrix(fit_model.pose)); printf("%.4f ", CT->weights[i] * score); } printf("]\n"); } return fit_model; } //----------------------- Alignment ----------------------// SceneHypothesis *align_models(sensor_msgs::PointCloud2 &msg, string target_frame, vector<geometry_msgs::Polygon> surface_polygons, std::vector<geometry_msgs::Pose> initial_poses, std::vector<string> models, tf::TransformListener *tf_listener, double table_filter_thresh, ModelManager *model_manager) { // get the cloud in PCL format in the right coordinate frame PointCloudXYZ cloud, cloud2, full_cloud; pcl::fromROSMsg(msg, cloud); if (!pcl_ros::transformPointCloud(target_frame, cloud, cloud2, *tf_listener)) { ROS_WARN("Can't transform point cloud; aborting object detection."); return NULL; } full_cloud = cloud2; // lookup the transform from target frame to sensor tf::StampedTransform tf_transform; Eigen::Affine3f sensor_pose; try { //tf_listener->lookupTransform(msg.header.frame_id, target_frame, msg.header.stamp, tf_transform); tf_listener->lookupTransform(target_frame, msg.header.frame_id, msg.header.stamp, tf_transform); transformTFToEigen(tf_transform, sensor_pose); } catch (tf::TransformException& ex) { ROS_WARN("[point_cloud_callback] TF exception:\n%s", ex.what()); return NULL; } //pcl::RangeImage full_range_image; //pcl::RangeImage::CoordinateFrame frame = pcl::RangeImage::CAMERA_FRAME; //full_range_image.createFromPointCloud(full_cloud, .2*M_PI/180, 2*M_PI, M_PI, sensor_pose, frame, 0, 0, 0); //ROS_INFO("Got PointCloud2 msg with %lu points\n", cloud2.points.size()); //if (!have_table) // return NULL; // filter out points outside of the attention area, and only keep points above the tabl e ROS_INFO("Have table, filtering points on table..."); polygon_filter(surface_polygons[0], cloud2, cloud); if (cloud.points.size() < 100) { ROS_WARN("Not enough points in table region; aborting object detection."); return NULL; } pcl::PassThrough<pcl::PointXYZ> pass; pass.setInputCloud(cloud.makeShared()); pass.setFilterFieldName("z"); //float table_height = table_polygon.points[0].z; float table_height = adjust_table_height(cloud, surface_polygons[0].points[0].z); pass.setFilterLimits(table_height + table_filter_thresh, 1000.); pass.filter(cloud2); ROS_INFO("Done filtering table."); if (cloud2.points.size() < 100) { ROS_WARN("Not enough points above table; aborting object detection."); return NULL; } ROS_INFO("Downsampling point cloud with %lu points", cloud2.points.size()); pcl::VoxelGrid<pcl::PointXYZ> grid; //grid.setFilterFieldName ("z"); grid.setLeafSize (0.006, 0.006, 0.006); //grid.setFilterLimits (0.4, 1.1); //assuming there might be very low and very high tables grid.setInputCloud(cloud2.makeShared()); grid.filter(cloud); ROS_INFO("Clustering remaining %lu points", cloud.points.size()); // cluster groups of points (in the XY plane?) //flatten_point_cloud(cloud, cloud2); //dbug pcl::EuclideanClusterExtraction<pcl::PointXYZ> cluster; //KdTreeXYZ::Ptr clusters_tree = boost::make_shared< pcl::KdTreeFLANN<pcl::PointXYZ> > (); pcl::search::KdTree<pcl::PointXYZ>::Ptr clusters_tree (new pcl::search::KdTree<pcl::PointXYZ> ()); clusters_tree->setEpsilon (.0001); cluster.setClusterTolerance (0.02); cluster.setMinClusterSize (100); cluster.setSearchMethod (clusters_tree); vector<pcl::PointIndices> cluster_indices; cluster.setInputCloud (cloud.makeShared()); //cloud2 cluster.extract(cluster_indices); ROS_INFO("Found %lu clusters.", cluster_indices.size()); // for each cluster, try to fit an object model SceneHypothesis *detected_objects = new SceneHypothesis(); // store point-clusters and accompanying clouds vector<geometry_msgs::Pose> clusterPoses; vector<PointCloudXYZ> clusterClouds; for (size_t i = 0; i < cluster_indices.size(); i++) { PointCloudXYZ cluster; pcl::copyPointCloud (cloud, cluster_indices[i], cluster); // compute cluster centroid Vector4f centroid; pcl::compute3DCentroid(cluster, centroid); geometry_msgs::Pose init_pose; init_pose.position.x = centroid(0); init_pose.position.y = centroid(1); init_pose.position.z = centroid(2); clusterPoses.push_back(init_pose); clusterClouds.push_back(cluster); } // for each initial pose, find closest point-cluster for (uint i = 0; i < initial_poses.size(); i++){ int poseIndex = findClosestPoseIndex(initial_poses[i], clusterPoses); geometry_msgs::Pose clusterPose = clusterPoses[poseIndex]; PointCloudXYZ cluster = clusterClouds[poseIndex]; // create range image for point cluster pcl::RangeImage range_image0; pcl::RangeImage::CoordinateFrame frame = pcl::RangeImage::CAMERA_FRAME; range_image0.createFromPointCloud(cluster, .2*M_PI/180, 2*M_PI, M_PI, sensor_pose, frame, 0, 0, 0); // dilate range image pcl::RangeImage range_image; cardboard::dilate_range_image(range_image0, range_image); // add background points from full point cloud to cluster range image for (size_t j = 0; j < cloud.points.size(); j++) { Vector3f p(cloud.points[j].x, cloud.points[j].y, cloud.points[j].z); int xi, yi; float r; range_image.getImagePoint(p, xi, yi, r); if (range_image.isInImage(xi, yi) && isinf(r)) range_image.getPoint(xi,yi).range = INFINITY; } // do one alignment for each cluster cardboard::RangeImageTester T1(range_image); cardboard::PointCloudDistanceTester T2(cluster); //cardboard::RangeImageNormalTester T3(range_image_normals); cardboard::CompositeTester model_tester(&T1,&T2); //,&T3); cardboard::ObjectHypothesis obj = align_object(*model_manager, &model_tester, initial_poses[i], table_height, models[i]); T1.testHypothesis(model_manager->get_model(models[i]), cardboard::pose_to_affine_matrix(initial_poses[i]), true); //if (obj.fitness_score < 1.6) // 1.6 sigma (less that 5% false negative) detected_objects->objects.push_back(obj); } detected_objects->header.stamp = msg.header.stamp; detected_objects->header.frame_id = target_frame; //publish_scene_hypothesis(detected_objects, target_frame, msg.header.stamp); return detected_objects; } //-----------------------------------------------------------------------------------------------// ObjectHypothesis align_object(const ModelManager &model_manager, ModelTester *model_tester, geometry_msgs::Pose init_pose, float table_height, string modelName) { Matrix4f A0 = pose_to_affine_matrix(init_pose); ObjectHypothesis fit_model; fit_model.fitness_score = std::numeric_limits<float>::max(); float min_score = std::numeric_limits<float>::max(); double t1, t2; Vector3f t = Vector3f::Zero(); t1 = get_time_ms(); for (uint k = 0 /*cnt*/; k < 5; k++) { //dbug // rotate model incrementally about the z-axis double a = 2*M_PI*(k/5.0); //dbug Quaternionf q2 = Quaternionf(cos(a/2), 0, 0, sin(a/2)); Matrix4f A_zrot = pose_to_affine_matrix(t, q2); Matrix4f A = A0 * A_zrot; pcl::PointCloud<pcl::PointXYZ> obj; pcl::transformPointCloud(model_manager.get_model(modelName).cloud, obj, A); // make sure bottom of model is touching table Vector4f pmin, pmax; pcl::getMinMax3D(obj, pmin, pmax); Matrix4f A_gravity = Matrix4f::Identity(); A_gravity(2,3) = table_height - pmin(2); pcl::transformPointCloud(obj, obj, A_gravity); A = A_gravity * A; // Do one aligment at the detected pose with the detected model ModelPoseOptimizer opt(model_tester, model_manager.get_model(modelName)); opt.setMaxIterations(200); Matrix4f A2 = opt.optimizeAffine(A); float score = opt.getFinalCost(); printf("."); fflush(0); { if (score < fit_model.fitness_score) { fit_model.fitness_score = score; fit_model.name = modelName; fit_model.pose = affine_matrix_to_pose(A2); // * A } if (score < min_score) min_score = score; } } t2 = get_time_ms(); printf("finished Alignment loop in %.2f ms (min_score = %.4f)\n", t2-t1, min_score); // print component scores const Model &best_model = model_manager.get_model(modelName); if (best_model.name.size() != 0) { printf("component scores: [ "); CompositeTester *CT = (CompositeTester *)model_tester; for (uint i = 0; i < CT->testers.size(); i++) { float score = CT->testers[i]->testHypothesis(best_model, pose_to_affine_matrix(fit_model.pose)); printf("%.4f ", CT->weights[i] * score); } printf("]\n"); } return fit_model; } //--------------------------- DEPRECATED ---------------------------// /* RangeImageOptimizer class (deprecated) * - Optimizes the placement of a point cloud with respect to a range image via gradient descent * class RangeImageOptimizer : public GradientFreeRandomizedGradientOptimizer { private: //MatrixXf eigen_cloud_; //MatrixXf eigen_range_image_; const pcl::RangeImage &range_image_; const pcl::PointCloud<pcl::PointXYZ> &cloud_; const DistanceTransform3D &distance_transform_; // distance transform of the point cloud Matrix4f initial_pose_; //pcl::KdTreeANN<pcl::PointXYZ> kdtree_; Vector3f cloud_centroid_; public: RangeImageOptimizer(const pcl::RangeImage &range_image, const pcl::PointCloud<pcl::PointXYZ> &cloud, const DistanceTransform3D &distance_transform); float evaluate(VectorXf x); VectorXf gradient(VectorXf x); Matrix4f optimizeAffine(const Matrix4f &initial_pose); void setInitialPose(const Matrix4f &initial_pose); Matrix4f x2affine(VectorXf x); }; *****************/ /* RangeImageGridOptimizer class (deprecated) * - Optimizes the placement of a point cloud with respect to a range image via grid search * class RangeImageGridOptimizer : public GridOptimizer { private: RangeImageOptimizer opt_; public: RangeImageGridOptimizer(RangeImageOptimizer opt); ~RangeImageGridOptimizer(); float evaluate(VectorXf x); Matrix4f optimizeAffine(const Matrix4f &initial_pose); }; //dbug //static int grid_cnt = 0; //static int eval_cnt = 0; //static FILE *grid_f = NULL; *****************/ //--------------------- RangeImageOptimizer class deprecated) --------------------// /************************* RangeImageOptimizer::RangeImageOptimizer(const pcl::RangeImage &range_image, const pcl::PointCloud<pcl::PointXYZ> &cloud, const DistanceTransform3D &distance_transform) : GradientFreeRandomizedGradientOptimizer(.07, Vector4f(.004, .004, 0, .03), 3.0), range_image_(range_image), cloud_(cloud), distance_transform_(distance_transform) { } Matrix4f RangeImageOptimizer::x2affine(VectorXf x) { Matrix4f A_shift = Matrix4f::Identity(); // shift to origin A_shift.col(3) << -cloud_centroid_, 1; Vector3f t = cloud_centroid_ + x.topRows(3); float theta = x(3); Quaternionf q(cos(theta/2.0), 0, 0, sin(theta/2.0)); Matrix4f A = pose_to_affine_matrix(t, q); // rotate, then unshift and translate by x(0:2) return A * A_shift * initial_pose_; } float RangeImageOptimizer::evaluate(VectorXf x) { Matrix4f A = x2affine(x); Matrix4f A_inv = A.inverse(); pcl::PointCloud<pcl::PointXYZ> cloud2; pcl::transformPointCloud(cloud_, cloud2, A); pcl::RangeImage range_image2; pcl::transformPointCloud(range_image_, range_image2, A_inv); float f_neg = 1500*range_image_fitness(range_image_, cloud2); // negative information float f_pos = 5000*range_cloud_fitness(distance_transform_, range_image2); // positive information return f_pos + f_neg; } VectorXf RangeImageOptimizer::gradient(VectorXf x) { VectorXf dfdx = VectorXf::Zero(4); float dt = .005; float da = .05; float f = evaluate(x); for (int i = 0; i < 2; i++) { VectorXf x2 = x; x2(i) += dt; dfdx(i) = (evaluate(x2) - f) / dt; } VectorXf x2 = x; x2(3) += da; dfdx(3) = (evaluate(x2) - f) / dt; return dfdx; } Matrix4f RangeImageOptimizer::optimizeAffine(const Matrix4f &initial_pose) { setInitialPose(initial_pose); VectorXf x0 = VectorXf::Zero(4); VectorXf x = optimize(x0); return x2affine(x); } void RangeImageOptimizer::setInitialPose(const Matrix4f &initial_pose) { initial_pose_ = initial_pose; pcl::PointCloud<pcl::PointXYZ> cloud2; pcl::transformPointCloud(cloud_, cloud2, initial_pose); Vector4f centroid; pcl::compute3DCentroid(cloud2, centroid); cloud_centroid_ = centroid.topRows(3); } ***********************/ //--------------------- RangeImageGridOptimizer class (deprecated) --------------------// /********************** RangeImageGridOptimizer::RangeImageGridOptimizer(RangeImageOptimizer opt) : opt_(opt) { } RangeImageGridOptimizer::~RangeImageGridOptimizer() { } float RangeImageGridOptimizer::evaluate(VectorXf x) { float score = opt_.evaluate(x); fprintf(grid_f, "%.6f ", score); //dbug return score; } Matrix4f RangeImageGridOptimizer::optimizeAffine(const Matrix4f &initial_pose) { opt_.setInitialPose(initial_pose); //dbug char fname[100]; sprintf(fname, "out%d.m", grid_cnt); grid_f = fopen(fname, "w"); grid_cnt++; //eval_cnt = 0; fprintf(grid_f, "F = ["); VectorXf x = GridOptimizer::optimize(); //dbug fprintf(grid_f, "];\n"); fprintf(grid_f, "F = F(1:end-1);\n"); fprintf(grid_f, "F_dims = ["); for (int i = 0; i < x.size(); i++) fprintf(grid_f, "%d ", 1 + (int)round((xmax_(i) - xmin_(i)) / resolution_(i))); fprintf(grid_f, "];\n"); fclose(grid_f); return opt_.x2affine(x); } ************************/ /***** deprecated ***** TrackedObject fit_object_to_range_image(const pcl::RangeImage &range_image_in, geometry_msgs::Pose init_pose, float table_height) { // dilate range image pcl::RangeImage range_image = range_image_in; //dilate_range_image(range_image_in, range_image); //static uint cnt = 9; Matrix4f A0 = pose_to_affine_matrix(init_pose); ROS_INFO("fit_object_to_range_image()"); //ROS_INFO("Initial Pose:"); //cout << A0 << endl; if (!modelManager.loaded_models) modelManager.load_models(); TrackedObject fit_model; // try fitting each model to the point cloud at several orientations double min_score = std::numeric_limits<double>::max(); for (uint i = 0; i < modelManager.model_clouds.size(); i++) { //dbug double t1, t2; t1 = get_time_ms(); # pragma omp parallel for for (uint j = 0; j < modelManager.model_orientations[i].size(); j++) { //dbug //printf("[i = %u, j = %u]\n", i, j); // rotate model onto a face of its convex hull Quaternionf q1 = modelManager.model_orientations[i][j]; Vector3f t = Vector3f::Zero(); Matrix4f A_face = pose_to_affine_matrix(t, q1); # pragma omp parallel for for (uint k = 0 ; k < 5; k++) { //dbug // rotate model incrementally about the z-axis double a = 2*M_PI*(k/5.0); //dbug Quaternionf q2 = Quaternionf(cos(a/2), 0, 0, sin(a/2)); Matrix4f A_zrot = pose_to_affine_matrix(t, q2); Matrix4f A = A0 * A_zrot * A_face; pcl::PointCloud<pcl::PointXYZ> obj; pcl::transformPointCloud(modelManager.model_clouds[i], obj, A); // make sure bottom of model is touching table Vector4f pmin, pmax; pcl::getMinMax3D(obj, pmin, pmax); Matrix4f A_gravity = Matrix4f::Identity(); A_gravity(2,3) = table_height - pmin(2); pcl::transformPointCloud(obj, obj, A_gravity); A = A_gravity * A; // fit rotated model to range image double score = range_image_fitness(range_image, obj); RangeImageOptimizer opt(range_image, modelManager.model_clouds[i], modelManager.model_distance_transforms[i]); opt.setMaxIterations(200); //50 //RangeImageGridOptimizer optimizer(opt); //VectorXf res(4), xmin(4), xmax(4); //res << .004, .004, 1, (M_PI/100.0); //xmin << -.04, -.04, 0, -M_PI/10.0; //xmax << .0401, .0401, 0, (M_PI/10.0 + .0001); //optimizer.setResolution(res); //optimizer.setBounds(xmin, xmax); Matrix4f A2 = opt.optimizeAffine(A); //optimizer.optimizeAffine(A); score = opt.getFinalCost(); //optimizer.getFinalCost(); printf("."); fflush(0); # pragma omp critical { if (score < min_score) { //printf("min_score = %.6f\n", score); min_score = score; fit_model.name = modelManager.object_names[i]; fit_model.pose = affine_matrix_to_pose(A2); // * A } //else // printf("score = %.6f\n", score); } } } t2 = get_time_ms(); printf("finished j loop in %.2f ms\n", t2-t1); } cout << "Best fit: obj = " << fit_model.name << ", score = " << min_score << endl; cout << fit_model.pose << endl; return fit_model; } ****************/ } // end of namespace cardboard
[ "aanders@mit.edu" ]
aanders@mit.edu
2417a8b9432fba32186cecec15fbab167cd7a487
cf9fc8b34de889922a8cf84dbf3fdf51b01f2312
/under/FunctionWithParam.cpp
45a5e0467ae1a518755334128fc5747685fa54ba
[]
no_license
cks920402/cpp
71f920b5fcf3741ff69760859f7db40bb2ad1199
62ae8872cbccb17b1e65844ae2bbccb35d46a27b
refs/heads/master
2023-01-08T23:34:33.051080
2020-11-13T08:48:43
2020-11-13T08:48:43
311,860,713
0
0
null
null
null
null
UTF-8
C++
false
false
196
cpp
#include <iostream> using namespace std; int max(int num_first, int num_second){ int result; if (num_first > num_second) result=num_first; else result=num_second; return result; }
[ "cks70001559@gmail.com" ]
cks70001559@gmail.com
cb332d6ef0e7ab246126c5b81c9c38b898b3b476
a94008428e172058c1ed532911f36399c5f3dc7c
/TouchGFX/generated/fonts/src/Kerning_arial_28_4bpp.cpp
e6a551f46b210975c5732a7d56f6636e2745daae
[]
no_license
HanesSciarrone/ATIOGUI
a07097ee0837a9e39abd0b21e17b4673d27c3174
c895e4ab51253ebe975b02a8d3b9b057307b3149
refs/heads/master
2023-03-18T05:02:02.031953
2021-02-08T22:58:05
2021-02-08T22:58:05
291,339,164
0
0
null
null
null
null
UTF-8
C++
false
false
7,255
cpp
#include <touchgfx/Font.hpp> FONT_KERNING_LOCATION_FLASH_PRAGMA KEEP extern const touchgfx::KerningNode kerning_arial_28_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE = { { 0x0041, -2 }, // (First char = [0x0041, A], Second char = [0x0020, ], Kerning dist = -2) { 0x004C, -1 }, // (First char = [0x004C, L], Second char = [0x0020, ], Kerning dist = -1) { 0x0046, -3 }, // (First char = [0x0046, F], Second char = [0x002C, ,], Kerning dist = -3) { 0x0050, -4 }, // (First char = [0x0050, P], Second char = [0x002C, ,], Kerning dist = -4) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x002C, ,], Kerning dist = -3) { 0x0056, -3 }, // (First char = [0x0056, V], Second char = [0x002C, ,], Kerning dist = -3) { 0x0057, -2 }, // (First char = [0x0057, W], Second char = [0x002C, ,], Kerning dist = -2) { 0x0059, -4 }, // (First char = [0x0059, Y], Second char = [0x002C, ,], Kerning dist = -4) { 0x0072, -2 }, // (First char = [0x0072, r], Second char = [0x002C, ,], Kerning dist = -2) { 0x0076, -2 }, // (First char = [0x0076, v], Second char = [0x002C, ,], Kerning dist = -2) { 0x0077, -2 }, // (First char = [0x0077, w], Second char = [0x002C, ,], Kerning dist = -2) { 0x0079, -2 }, // (First char = [0x0079, y], Second char = [0x002C, ,], Kerning dist = -2) { 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x002D, -], Kerning dist = -2) { 0x0056, -2 }, // (First char = [0x0056, V], Second char = [0x002D, -], Kerning dist = -2) { 0x0059, -3 }, // (First char = [0x0059, Y], Second char = [0x002D, -], Kerning dist = -3) { 0x0046, -3 }, // (First char = [0x0046, F], Second char = [0x002E, .], Kerning dist = -3) { 0x0050, -4 }, // (First char = [0x0050, P], Second char = [0x002E, .], Kerning dist = -4) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x002E, .], Kerning dist = -3) { 0x0056, -3 }, // (First char = [0x0056, V], Second char = [0x002E, .], Kerning dist = -3) { 0x0057, -2 }, // (First char = [0x0057, W], Second char = [0x002E, .], Kerning dist = -2) { 0x0059, -4 }, // (First char = [0x0059, Y], Second char = [0x002E, .], Kerning dist = -4) { 0x0072, -2 }, // (First char = [0x0072, r], Second char = [0x002E, .], Kerning dist = -2) { 0x0076, -2 }, // (First char = [0x0076, v], Second char = [0x002E, .], Kerning dist = -2) { 0x0077, -2 }, // (First char = [0x0077, w], Second char = [0x002E, .], Kerning dist = -2) { 0x0079, -2 }, // (First char = [0x0079, y], Second char = [0x002E, .], Kerning dist = -2) { 0x0031, -2 }, // (First char = [0x0031, 1], Second char = [0x0031, 1], Kerning dist = -2) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x003A, :], Kerning dist = -3) { 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x003A, :], Kerning dist = -1) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x003A, :], Kerning dist = -2) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x003B, ;], Kerning dist = -3) { 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x003B, ;], Kerning dist = -1) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x003B, ;], Kerning dist = -2) { 0x0020, -2 }, // (First char = [0x0020, ], Second char = [0x0041, A], Kerning dist = -2) { 0x0046, -2 }, // (First char = [0x0046, F], Second char = [0x0041, A], Kerning dist = -2) { 0x0050, -2 }, // (First char = [0x0050, P], Second char = [0x0041, A], Kerning dist = -2) { 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x0041, A], Kerning dist = -2) { 0x0056, -2 }, // (First char = [0x0056, V], Second char = [0x0041, A], Kerning dist = -2) { 0x0057, -1 }, // (First char = [0x0057, W], Second char = [0x0041, A], Kerning dist = -1) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x0041, A], Kerning dist = -2) { 0x0041, -2 }, // (First char = [0x0041, A], Second char = [0x0054, T], Kerning dist = -2) { 0x004C, -2 }, // (First char = [0x004C, L], Second char = [0x0054, T], Kerning dist = -2) { 0x0041, -2 }, // (First char = [0x0041, A], Second char = [0x0056, V], Kerning dist = -2) { 0x004C, -2 }, // (First char = [0x004C, L], Second char = [0x0056, V], Kerning dist = -2) { 0x0041, -1 }, // (First char = [0x0041, A], Second char = [0x0057, W], Kerning dist = -1) { 0x004C, -2 }, // (First char = [0x004C, L], Second char = [0x0057, W], Kerning dist = -2) { 0x0041, -2 }, // (First char = [0x0041, A], Second char = [0x0059, Y], Kerning dist = -2) { 0x004C, -2 }, // (First char = [0x004C, L], Second char = [0x0059, Y], Kerning dist = -2) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x0061, a], Kerning dist = -3) { 0x0056, -2 }, // (First char = [0x0056, V], Second char = [0x0061, a], Kerning dist = -2) { 0x0057, -1 }, // (First char = [0x0057, W], Second char = [0x0061, a], Kerning dist = -1) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x0061, a], Kerning dist = -2) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x0063, c], Kerning dist = -3) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x0065, e], Kerning dist = -3) { 0x0056, -2 }, // (First char = [0x0056, V], Second char = [0x0065, e], Kerning dist = -2) { 0x0059, -3 }, // (First char = [0x0059, Y], Second char = [0x0065, e], Kerning dist = -3) { 0x0054, -1 }, // (First char = [0x0054, T], Second char = [0x0069, i], Kerning dist = -1) { 0x0059, -1 }, // (First char = [0x0059, Y], Second char = [0x0069, i], Kerning dist = -1) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x006F, o], Kerning dist = -3) { 0x0056, -2 }, // (First char = [0x0056, V], Second char = [0x006F, o], Kerning dist = -2) { 0x0059, -3 }, // (First char = [0x0059, Y], Second char = [0x006F, o], Kerning dist = -3) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x0070, p], Kerning dist = -2) { 0x0059, -3 }, // (First char = [0x0059, Y], Second char = [0x0071, q], Kerning dist = -3) { 0x0054, -1 }, // (First char = [0x0054, T], Second char = [0x0072, r], Kerning dist = -1) { 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x0072, r], Kerning dist = -1) { 0x0054, -3 }, // (First char = [0x0054, T], Second char = [0x0073, s], Kerning dist = -3) { 0x0054, -1 }, // (First char = [0x0054, T], Second char = [0x0075, u], Kerning dist = -1) { 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x0075, u], Kerning dist = -1) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x0075, u], Kerning dist = -2) { 0x0059, -2 }, // (First char = [0x0059, Y], Second char = [0x0076, v], Kerning dist = -2) { 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x0077, w], Kerning dist = -2) { 0x004C, -1 }, // (First char = [0x004C, L], Second char = [0x0079, y], Kerning dist = -1) { 0x0054, -2 }, // (First char = [0x0054, T], Second char = [0x0079, y], Kerning dist = -2) { 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x0079, y], Kerning dist = -1) };
[ "hsciarrone@atioinc.com" ]
hsciarrone@atioinc.com
1bc0ed1c075e5aadf4bb62917489793a6c7ced48
f9e23433aaa32cca6567ef0a5295af2600a3f236
/src/graphics/delete_shader.cpp
ea7a4ab6791a0dc3f76872e324afb3b7bd52a8d8
[ "BSD-2-Clause" ]
permissive
TetraSomia/liblapin
72d8bbcf48b4acb39d079884e50d80cd38827c52
f5ee3ce9b0fff8459ec15d5e24287f2c16e5ae35
refs/heads/main
2023-06-02T02:28:38.107596
2021-06-13T18:54:09
2021-06-13T18:54:09
376,612,564
1
0
null
null
null
null
UTF-8
C++
false
false
240
cpp
// Jason Brillante "Damdoshi" // Hanged Bunny Studio 2014-2015 // // Bibliothèque Lapin #include "lapin_private.h" void bunny_delete_shader(t_bunny_shader *_shader) { sf::Shader *shader = (sf::Shader*)_shader; delete shader; }
[ "arthur.josso@obspm.fr" ]
arthur.josso@obspm.fr
67e861897260c5abe68bd75fcab2208919cefdb7
7763ebabad16e792d41ba2753a9746bf7496a26e
/cocos2D/Game_LockPuzzle/Source/Game/GamePlay/UnitManager.h
4d41f24672ff63900c589d0943fdbad4702aeebc
[]
no_license
flowerfx/ColorLockPuzzle
a4dc1ebf4ccfce74da5bb1f4472c71d2182351bc
2e17e6305a437a1e1c76093d82f63703ecfa3def
refs/heads/master
2021-01-10T23:31:44.419176
2020-05-06T14:04:09
2020-05-06T14:04:09
69,724,573
1
1
null
null
null
null
UTF-8
C++
false
false
7,573
h
#ifndef __UINIT_MANAGER_H__ #define __UINIT_MANAGER_H__ #include "ControllableUnit.h" #include "cocos2d.h" using namespace cocos2d; using namespace RKUtils; //#define USE_RANDOM_LEVEL //#define RECORRECT_HINT enum STATE_GAME { STATE_NONE = 0, STATE_MOVE, STATE_NEXT_STEP, STATE_FINISH, STATE_FAILED, STATE_COUNT }; struct UIDecVisible { RKString name_ui; RKString name_resource; bool IsVisible; public: UIDecVisible() { name_ui = ""; name_resource = ""; IsVisible = true; } }; struct DecGameMode { std::vector<UIDecVisible*> ui_dec; std::map<RKString,xml::BasicDec *> p_GamePlay_Item_; int time_init_each_mode; public: DecGameMode() { ui_dec.clear(); p_GamePlay_Item_.clear(); time_init_each_mode = 0; } virtual ~DecGameMode() { ui_dec.clear(); p_GamePlay_Item_.clear(); } xml::BasicDec * GetGamePlayItemByName(RKString name) { if (p_GamePlay_Item_.size() > 0 && p_GamePlay_Item_.find(name) != p_GamePlay_Item_.end()) return p_GamePlay_Item_.at(name); return 0; } int GetTimeInit() { return time_init_each_mode; } }; struct HLLink : public BasicUnit { Vec2 IdxObjectContain; int number_count; public: HLLink() { IdxObjectContain = Vec2(0, 0); number_count = 0; } virtual ~HLLink() { IdxObjectContain = Vec2(0, 0); number_count = 0; } }; struct GameLevelDec { bool move_diagonally; std::vector<std::vector<int>> value; std::vector<int> hint; std::map<int, int> index_have_lock; int number_move_diagonnally; int number_start_random; Vec2 range_random_number; bool Is_level_for_creation; int getValueAt(int i, int j) { if ((unsigned int)j >= value.size()) { PASSERT2(false, "out of stack !"); return 0; } auto line = value.at(j); if ((unsigned int)i >= line.size()) { PASSERT2(false, "out of stack !"); return 0; } return line.at(i); } void SetValueAt(int i, int j, int value_i) { if ((unsigned int)j >= value.size()) { PASSERT2(false, "out of stack !"); return ; } auto line = value.at(j); if ((unsigned int)i >= line.size()) { PASSERT2(false, "out of stack !"); return ; } line.erase(line.begin() + i); line.insert(line.begin() + i, value_i); } GameLevelDec() { move_diagonally = false; value.clear(); hint.clear(); index_have_lock.clear(); number_move_diagonnally = -2; number_start_random = 0; Is_level_for_creation = false; } virtual ~GameLevelDec() { move_diagonally = false; value.clear(); hint.clear(); index_have_lock.clear(); number_move_diagonnally = -2; number_start_random = 0; Is_level_for_creation = false; } }; class UnitManager { private: //for the hint BasicUnit * p_hand_hint; BasicUnit * p_mini_circle_hint; //vari contain the control unit of game Vector<ControllableUnit* > p_ListControllableObject; //vari contain line object link unit of game Vector<HLLink* > p_listObjectLinkHL; //vari of the text notice of AP Vector<BasicUnit* > p_listFlyTextNotice; //list color object highlight as stack std::vector<Color4B> p_color_hight_light; //list of index of controlled object under hightlight std::vector<int> p_List_current_idx_link; //check the index of object as same as the given result int * p_currentStateIdxLink; //nothing int p_current_index_object_controll; //size width and height of object ex: 4x4 or 5x5 Vec2 p_size_list_controllable_object; //list of index of controlled object have lock inside RKList<int> p_current_number_object_have_lock; //nothing std::map<RKString, xml::BasicDec *> p_gameplay_dec; //use to show hint bool p_IsUseHintShow; //state move/finish/failed of game STATE_GAME p_current_state_game; //use diagonally move bool p_diagonally_move; int p_current_move_diagonally_remain; int p_number_move_dia; unsigned int p_number_failed; int InsertIdxLink(int idx); bool IsTheIdxNearThePreviousIdx(int idx); // use the 8 square void RemoveTheAfterIdxLink(int idx); Vec2 CotainIdx(int idx); // Vec2(x,y) x is idx , y number of idx bool p_IsLevelCreation; int p_count_move_diagonally; //for the effect zoom to pause btn int p_current_node_have_effect; bool is_zoom_effect; protected: //control function void PerformLinkObjectTogether(); HLLink* GenerateObjectLink(ControllableUnit* a, ControllableUnit* b); void OnProcessNextLevel(int current_number); int InitStepLock(int& chance_each); //return number_lock void GenStepLock(int& chance_each , int& number_ins,Vec2 step_range, xml::BasicDec* _basic_dec); #if defined USE_RANDOM_LEVEL public: static void GenRandomLevel(GameLevelDec * level); static Vec2 GetDirectMove(int t); #else Vec2 GetDirectMove(int t); void GenRandomLevel(GameLevelDec * level); #endif public: UnitManager(); ~UnitManager(); bool InitAllObjectWithParam(GameLevelDec * game_mode_level); void DrawAllObject(Renderer *renderer, const Mat4& transform, uint32_t flags); void VisitAllObject(Renderer *renderer, const Mat4& transform, uint32_t flags); void UpdateAllObject(float dt); Vec2 GetSizeListObject() { return p_size_list_controllable_object; } void SetSizeListObject(Vec2 val){ p_size_list_controllable_object = val; } Vec2 GetNumberCotainOfObjectAtlocation(int x, int y); //x is number contain, y is the index contain void SetActionForControlObject(RKString name_action); void SetColorHL(Color4B val , int idx) { if (idx >= 0 && p_color_hight_light.size() > 0 && (unsigned int)idx < p_color_hight_light.size()) { p_color_hight_light.erase(p_color_hight_light.begin() + (unsigned int)idx); p_color_hight_light.insert(p_color_hight_light.begin() + (unsigned int)idx, val); } } void InsertColorHL(Color4B val) { p_color_hight_light.push_back(val); } Color4B GetColorHLAtIdx(int idx) { if ((unsigned int)idx >= 0 && p_color_hight_light.size() >0 && (unsigned int)idx < p_color_hight_light.size()) { return p_color_hight_light.at((unsigned int)idx); } return p_color_hight_light.at(0); } void InsertGamePlayDec(RKString str, xml::BasicDec * dec) { p_gameplay_dec.insert(std::pair<RKString, xml::BasicDec*>(str, dec)); } xml::BasicDec * GetGamePlayDec(RKString name) { if (p_gameplay_dec.size() > 0 && p_gameplay_dec.find(name) != p_gameplay_dec.end()) return p_gameplay_dec.at(name); return 0; } ControllableUnit* GetUnitAtIdx(int idx) { if (idx < 0 || idx >= p_ListControllableObject.size()) { return 0; } return p_ListControllableObject.at(idx); } bool IsUseHintShow() { return p_IsUseHintShow; } void IsUseHintShow(bool b) { p_IsUseHintShow = b; } void SetObjectFlyTo(RKString resource, Vec2 pos_from, Vec2 pos_to, int number ,float size = 0.f, Color4B color = Color4B::WHITE, float delay_first = 0.f); void SetTextFlyTime(int addition_time, Vec2 pos_from, float size = 0.f, Color4B color = Color4B::WHITE, float delay_first = 0.f); void SetTextFlyScore(int number, Vec2 pos_from, float size = 0.f, Color4B color = Color4B::WHITE, float delay_first = 0.f); void SetObjFlyFromPos(RKString resource , RKString text, Vec2 pos_from , Vec2 pos_to, RKString tag_name,int number, float size = 0.f, Color4B color = Color4B::WHITE, float delay_first = 0.f); int IsFinishLevel(); STATE_GAME GetCurrentGameState() { return p_current_state_game; } void ResetCurrentGameState() { p_current_state_game = STATE_GAME::STATE_NONE; } void ShowHintWithListIdx(std::vector<int> list); }; #endif //__UINIT_MANAGER_H__
[ "qchien.gl@hotmail.com" ]
qchien.gl@hotmail.com
52b6b95c7ba7ef229e25681ca2c28049ffe757bb
4503b4ec29e9a30d26c433bac376f2bddaefd9e5
/PCL 1.7.2_vs2013/x64/3rdParty/VTK-6.1.0/include/vtk-6.1/vtkInformationDoubleVectorKey.h
8f5f63636104ea575ad91f8cd98d559aaa43b157
[]
no_license
SwunZH/ecocommlibs
0a872e0bbecbb843a0584fb787cf0c5e8a2a270b
4cff09ff1e479f5f519f207262a61ee85f543b3a
refs/heads/master
2021-01-25T12:02:39.067444
2018-02-23T07:04:43
2018-02-23T07:04:43
123,447,012
1
0
null
2018-03-01T14:37:53
2018-03-01T14:37:53
null
UTF-8
C++
false
false
2,594
h
/*========================================================================= Program: Visualization Toolkit Module: vtkInformationDoubleVectorKey.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkInformationDoubleVectorKey - Key for double vector values. // .SECTION Description // vtkInformationDoubleVectorKey is used to represent keys for double // vector values in vtkInformation.h #ifndef __vtkInformationDoubleVectorKey_h #define __vtkInformationDoubleVectorKey_h #include "vtkCommonCoreModule.h" // For export macro #include "vtkInformationKey.h" #include "vtkCommonInformationKeyManager.h" // Manage instances of this type. class VTKCOMMONCORE_EXPORT vtkInformationDoubleVectorKey : public vtkInformationKey { public: vtkTypeMacro(vtkInformationDoubleVectorKey,vtkInformationKey); void PrintSelf(ostream& os, vtkIndent indent); vtkInformationDoubleVectorKey(const char* name, const char* location, int length=-1); ~vtkInformationDoubleVectorKey(); // Description: // Get/Set the value associated with this key in the given // information object. void Append(vtkInformation* info, double value); void Set(vtkInformation* info, double* value, int length); double* Get(vtkInformation* info); double Get(vtkInformation* info, int idx); void Get(vtkInformation* info, double* value); int Length(vtkInformation* info); // Description: // Copy the entry associated with this key from one information // object to another. If there is no entry in the first information // object for this key, the value is removed from the second. virtual void ShallowCopy(vtkInformation* from, vtkInformation* to); // Description: // Print the key's value in an information object to a stream. virtual void Print(ostream& os, vtkInformation* info); protected: // The required length of the vector value (-1 is no restriction). int RequiredLength; private: vtkInformationDoubleVectorKey(const vtkInformationDoubleVectorKey&); // Not implemented. void operator=(const vtkInformationDoubleVectorKey&); // Not implemented. }; #endif
[ "hnk0313@3e9e098e-e079-49b3-9d2b-ee27db7392fb" ]
hnk0313@3e9e098e-e079-49b3-9d2b-ee27db7392fb
740ae376b1114bbb9fa6b1c11a10dc6fec54a821
ac4ca0a2c6b41832a84853c58c619940e15ed779
/include/marnav/nmea/zfo.hpp
57ed2da7fe3b56650e25c18c4579f21613cc9734
[ "BSD-3-Clause", "BSD-4-Clause" ]
permissive
mariokonrad/marnav
12c2fff7117dfee356b8318e8e964ee8d6e81459
01c55205736fcc8157891b84e3efe387a221ff3a
refs/heads/master
2023-06-08T13:53:39.701103
2023-04-28T15:15:06
2023-05-04T15:50:15
37,308,245
84
48
NOASSERTION
2023-06-05T14:16:36
2015-06-12T07:26:41
C++
UTF-8
C++
false
false
1,571
hpp
#ifndef MARNAV_NMEA_ZFO_HPP #define MARNAV_NMEA_ZFO_HPP #include <marnav/nmea/sentence.hpp> #include <marnav/nmea/time.hpp> #include <marnav/nmea/waypoint.hpp> #include <optional> namespace marnav::nmea { /// @brief ZFO - UTC & Time from origin Waypoint /// /// @code /// 1 2 3 /// | | | /// $--ZFO,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF> /// @endcode /// /// Field Number: /// 1. Universal Time Coordinated (UTC) /// 2. Elapsed Time /// 3. Origin Waypoint ID /// class zfo : public sentence { friend class detail::factory; public: constexpr static sentence_id ID = sentence_id::ZFO; constexpr static const char * TAG = "ZFO"; zfo(); zfo(const zfo &) = default; zfo & operator=(const zfo &) = default; zfo(zfo &&) = default; zfo & operator=(zfo &&) = default; protected: zfo(talker talk, fields::const_iterator first, fields::const_iterator last); void append_data_to(std::string &, const version &) const override; private: std::optional<nmea::time> time_utc_; std::optional<nmea::duration> time_elapsed_; std::optional<waypoint> waypoint_id_; public: std::optional<nmea::time> get_time_utc() const { return time_utc_; } std::optional<nmea::duration> get_time_elapsed() const { return time_elapsed_; } std::optional<waypoint> get_waypoint_id() const { return waypoint_id_; } void set_time_utc(const nmea::time & t) noexcept { time_utc_ = t; } void set_time_elapsed(const nmea::duration & t) noexcept { time_elapsed_ = t; } void set_waypoint_id(const waypoint & id) { waypoint_id_ = id; } }; } #endif
[ "mario.konrad@gmx.net" ]
mario.konrad@gmx.net
2e4be86844707b49cab07110da3bafbec98b7f8f
9e1e374a6a497563eaad4e7e8947885c61ecb0b2
/src/scenes/simple_scene.hpp
81863ca0c63500303b756e63e3261bd53f7cc57b
[]
no_license
matthieubulte/georges
2ca92e8d3f8fb10dc59a94d4da6c028dd9e49458
c1a107a8d4853dd346d7147a81f4bf51fd089bcb
refs/heads/master
2023-02-07T23:43:29.291976
2020-12-31T16:22:11
2020-12-31T16:22:11
325,816,680
0
1
null
2020-12-31T16:07:09
2020-12-31T14:31:36
C++
UTF-8
C++
false
false
1,899
hpp
#ifndef SIMPLE_SCENE_HPP #define SIMPLE_SCENE_HPP #include "../transformations.hpp" #include "../distances.hpp" #include "scene.hpp" class SimpleScene : public Scene { public: vec2 dist_field(const float t, const vec3& p) const; vecpack<8, 2> dist_field_simd(const float t, const vecpack<8, 3>& p) const; vec3 texture(int texture_id, const vec3& pos) const; vecpack<8, 3> texture_simd(const vec<8>& hit_time, const vec<8>& hit_texture) const; }; vec2 SimpleScene::dist_field(const float t, const vec3& p) const { vec3 q; float d = 10000.0f; // floor d = dist_plane(vec3(0,1,0), 0, p); // sphere q = p - vec3(0.0f, 1.0f, 3.0f); float d2 = dist_sphere(0.5f, q); float ds = smin(d, d2, 0.32); return vec2(ds, 1.0); } vecpack<8, 2> SimpleScene::dist_field_simd(const float t, const vecpack<8, 3>& p) const { vecpack<8, 3> q; vec<8> d, d2, ds; // floor d = dist_plane(vec3(0,1,0), 0, p); // sphere q = p - vec3(0.0f, 1.0f, 3.0f); d2 = dist_sphere(0.5f, q); ds = smin(d, d2, 0.32); vecpack<8, 2> res; res[0] = ds; res[1] = 1.0f; return res; } vec3 SimpleScene::texture(int texture_id, const vec3& pos) const { if (texture_id == 2) { // floor float x = pos[0] >= 0 ? pos[0] : -pos[0] + 0.5; float z = pos[2] >= 0 ? pos[2] : -pos[2] + 0.5; return (fmod(x, 1) < 0.5) == (fmod(z, 1) < 0.5) ? vec3(1,1,1) : vec3(0,0,0); } else if (texture_id == 3) { // block return vec3(51, 255, 189)/255.0f/5.0; } else if (texture_id == 1) { // sphere return vec3(255, 189, 51)/255.0f/2.0; } return vec3(0,1,0); } vecpack<8, 3> SimpleScene::texture_simd(const vec<8>& hit_time, const vec<8>& hit_texture) const { vecpack<8, 3> col(vec3(0.5, 0.37, 0.1)); vec<8> col_mask = hit_time >= 0; return col_mask * col; } #endif
[ "matthieu.bulte.06@gmail.com" ]
matthieu.bulte.06@gmail.com
dea314bbd55ae40139ed71c88aa983f580f23907
c0caed81b5b3e1498cbca4c1627513c456908e38
/src/protocols/stepwise/sampler/StepWiseSamplerSizedComb.cc
3225741b290f5479a62a65c40043a66339638f1e
[]
no_license
malaifa/source
5b34ac0a4e7777265b291fc824da8837ecc3ee84
fc0af245885de0fb82e0a1144422796a6674aeae
refs/heads/master
2021-01-19T22:10:22.942155
2017-04-19T14:13:07
2017-04-19T14:13:07
88,761,668
0
2
null
null
null
null
UTF-8
C++
false
false
6,154
cc
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*- // vi: set ts=2 noet: // // (c) Copyright Rosetta Commons Member Institutions. // (c) This file is part of the Rosetta software suite and is made available under license. // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. // (c) For more information, see http://www.rosettacommons.org. Questions about this can be // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu. /// @file protocols/stepwise/sampler/StepWiseSamplerSizedComb.cc /// @brief Aggregate of multiple rotamer samplers for modeler combinatorially. /// @author Fang-Chieh Chou // Unit headers #include <protocols/stepwise/sampler/StepWiseSamplerSizedComb.hh> // Project headers #include <core/pose/Pose.hh> #include <utility/stream_util.hh> #include <basic/Tracer.hh> // Numeric Headers #include <numeric/random/random.hh> static THREAD_LOCAL basic::Tracer TR( "protocols.sampler.StepWiseSamplerSizedComb" ); using namespace core; /////////////////////////////////////////////////////////////////////////// // StepWiseSampler Combination is a lot like nesting loops, or like // writing numbers in decimal format. // // Due to a historical choice, however, rotamer samplers that are // later in the list are 'external' to rotamer samplers earlier in the list. // // This order seems counter-intuitive (cf. writing numbers -- incrementing changes // the *last* decimal place first), and may be worth fixing. // /////////////////////////////////////////////////////////////////////////// namespace protocols { namespace stepwise { namespace sampler { /////////////////////////////////////////////////////////////////////////// StepWiseSamplerSizedComb::StepWiseSamplerSizedComb(): StepWiseSamplerSized(), size_( 0 ) {} StepWiseSamplerSizedComb::StepWiseSamplerSizedComb( StepWiseSamplerSizedOP outer_loop_rotamer, StepWiseSamplerSizedOP inner_loop_rotamer ): size_( 0 ) //will be fixed on init() { rotamer_list_.push_back( inner_loop_rotamer ); rotamer_list_.push_back( outer_loop_rotamer ); init(); } StepWiseSamplerSizedComb::~StepWiseSamplerSizedComb(){} /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::init() { runtime_assert( !rotamer_list_.empty() ); for ( Size i = 1; i <= rotamer_list_.size(); ++i ) { rotamer_list_[i]->init(); } size_list_.clear(); id_list_.clear(); size_ = 1; for ( Size i = 1; i <= rotamer_list_.size(); ++i ) { Real const curr_size = rotamer_list_[i]->size(); id_list_.push_back( 0 ); size_list_.push_back( (Size)curr_size ); size_ = (Size)(size_ * curr_size); if ( curr_size == 0 ) TR << "Got a null rotamer sampler!" << std::endl; } set_init( true ); } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::reset() { runtime_assert( is_init() ); if ( random() ) { ++( *this ); } else { for ( Size i = 1; i <= id_list_.size(); ++i ) { id_list_[i] = 1; } id_ = 1; } update_rotamer_ids(); } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::operator++() { runtime_assert( not_end() ); if ( random() ) { id_ = numeric::random::rg().random_range( 1, size() ); } else { ++id_; } id_list_ = id2list( id_ ); update_rotamer_ids(); } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::update_rotamer_ids() { for ( Size i = 1; i <= id_list_.size(); ++i ) { rotamer_list_[i]->set_id( id_list_[i] ); } } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::apply( Pose & pose ) { apply( pose, id_ ); } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::apply( core::pose::Pose & pose, Size const id ) { runtime_assert( is_init() ); utility::vector1<Size> new_id_list = id2list( id ); for ( Size i = 1; i <= rotamer_list_.size(); ++i ) { rotamer_list_[i]->apply( pose, new_id_list[i] ); } } /////////////////////////////////////////////////////////////////////////// utility::vector1<Size> StepWiseSamplerSizedComb::id2list( core::Size const id ) const { runtime_assert( is_init() ); utility::vector1<Size> new_id_list ( id_list_.size(), 1 ); new_id_list[1] = id; for ( Size i = 1; i < new_id_list.size(); ++i ) { if ( new_id_list[i] > size_list_[i] ) { Size quot = new_id_list[i] / size_list_[i]; Size const rem = new_id_list[i] % size_list_[i]; if ( rem == 0 ) { new_id_list[i] = size_list_[i]; --quot; } else { new_id_list[i] = rem; } new_id_list[i+1] += quot; } else { break; } } return new_id_list; } /////////////////////////////////////////////////////////////////////////// core::Size StepWiseSamplerSizedComb::list2id( utility::vector1<core::Size> const & id_list ) const { runtime_assert( is_init() ); Size id( 1 ); Size block_size_( 1 ); for ( Size i = 1; i <= id_list.size(); ++i ) { id += block_size_ * ( id_list[ i ] - 1); block_size_ *= size_list_[ i ]; } return id; } /// @brief Move sampler to end. void StepWiseSamplerSizedComb::fast_forward( Size const sampler_number ){ runtime_assert( sampler_number <= rotamer_list_.size() ); for ( Size n = 1; n <= sampler_number; n++ ) { id_list_[ n ] = rotamer_list_[ n ]->size(); } id_ = list2id( id_list_ ); } /// @brief Set the random modeler state void StepWiseSamplerSizedComb::set_random( bool const setting ){ StepWiseSamplerBase::set_random( setting ); for ( Size n = 1; n <= rotamer_list_.size(); n++ ) rotamer_list_[ n ]->set_random( setting ); } /////////////////////////////////////////////////////////////////////////// void StepWiseSamplerSizedComb::show( std::ostream & out, Size const indent ) const { StepWiseSamplerSized::show( out, indent ); // reverse direction so that 'inner loop' is last. for ( Size k = rotamer_list_.size(); k >= 1; k-- ) rotamer_list_[k]->show( out, indent + 1 ); } } //sampler } //stepwise } //protocols
[ "malaifa@yahoo.com" ]
malaifa@yahoo.com
0b46c49dafd552f8cb5e5ba4bc5cf248401fb2ef
3ac6a7af9e1c58bb3e2ae6bc33dee47b21269f87
/OpenS4/Renderer/Batch/PointBatch.hpp
790354d89c2842086b73a18a9b4b281cfad9321c
[ "MIT" ]
permissive
MadShadow-/OpenS4
eabefdd744160e48735be078f9e510ae7f4e6db2
1b2f69d617406a2a49ed0511d93771d978b6bfc3
refs/heads/master
2022-12-01T09:36:10.402171
2020-08-10T21:34:39
2020-08-10T21:34:39
273,549,066
3
4
null
null
null
null
UTF-8
C++
false
false
2,920
hpp
#pragma once #include "../OpenGL.hpp" namespace OpenS4::Renderer { class PointBatch { public: GLuint m_vertexArrayObject = 0; GLuint m_attributes[3] = {0}; u64 m_attributeSize[3] = {0}; u64 m_numberOfVertices; void setAttribute(u64 attrID, const std::vector<float>& attribute, u64 valuesPerAttribute) { if (m_attributes[attrID] == 0) { glGenBuffers(1, &m_attributes[attrID]); } glBindBuffer(GL_ARRAY_BUFFER, m_attributes[attrID]); if (m_attributeSize[attrID] < attribute.size()) { glBufferData(GL_ARRAY_BUFFER, sizeof(float) * attribute.size(), attribute.data(), GL_DYNAMIC_DRAW); m_attributeSize[attrID] = attribute.size(); } else { glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float) * attribute.size(), attribute.data()); } glVertexAttribPointer(attrID, valuesPerAttribute, GL_FLOAT, GL_FALSE, 0, 0); } void setAttribute(u64 attrID, float* attribute, u64 attributeLength, u64 valuesPerAttribute) { if (m_attributes[attrID] == 0) { glGenBuffers(1, &m_attributes[attrID]); } glBindBuffer(GL_ARRAY_BUFFER, m_attributes[attrID]); if (m_attributeSize[attrID] < attributeLength) { glBufferData(GL_ARRAY_BUFFER, sizeof(float) * attributeLength, attribute, GL_DYNAMIC_DRAW); m_attributeSize[attrID] = attributeLength; } else { glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float) * attributeLength, attribute); } glVertexAttribPointer(attrID, valuesPerAttribute, GL_FLOAT, GL_FALSE, 0, 0); } void bindVAO() { if (m_vertexArrayObject == 0) { glGenVertexArrays(1, &m_vertexArrayObject); } glBindVertexArray(m_vertexArrayObject); } public: PointBatch() {} ~PointBatch() { for (int i = 0; i < 3; i++) { if (m_attributes[i]) glDeleteBuffers(1, &m_attributes[i]); } if (m_vertexArrayObject != 0) glDeleteVertexArrays(1, &m_vertexArrayObject); } void draw() { glBindVertexArray(m_vertexArrayObject); glDrawArrays(GL_POINTS, 0, m_numberOfVertices); glBindVertexArray(0); } void updateData(const std::vector<float>& xy, u64 nXY, const std::vector<float>& color, u64 nColor) { bindVAO(); setAttribute(0, xy, nXY); setAttribute(2, color, nColor); glEnableVertexAttribArray(0); glEnableVertexAttribArray(2); glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); m_numberOfVertices = xy.size() / nXY; } }; } // namespace OpenS4::Renderer
[ "40365952+Kimichura@users.noreply.github.com" ]
40365952+Kimichura@users.noreply.github.com
2cd037e06f282730209163c6bc4ef72bc5efcf01
ae05c57c352bd420eeb2f11ef10fb3407a7797d2
/Practica3/TestAlumno.cpp
f59ee53959fd12e643d10aa4b40c933114c67c94
[]
no_license
ernesto-na/repasoc-
ab0898bd8f1f5b630755f52ac9021bcb6614c117
3872e82deede3d1265aff7852dfdf82d214ca640
refs/heads/master
2023-07-03T18:38:05.870351
2021-08-10T08:14:03
2021-08-10T08:14:03
393,239,120
0
0
null
null
null
null
ISO-8859-1
C++
false
false
9,834
cpp
#include"Alumno.h" #include"Profesor.h" #include"Materia.h" #include<iostream> #include <stdio.h> #include <stdlib.h> #include <conio.h> using namespace std; Alumno arregloAlumnos[100]; Materia arregloMaterias[100]; Profesor arregloProfesores[100]; int elementos = 1; int indiceAlumnos = 0, indiceProfesores = 0, indiceMaterias = 0; void leerAlumnos() { //cout << "---iA->" << indiceAlumnos << "..elementos.." << elementos; //for(int i=indiceAlumnos; i<elementos;i++){ string auxNombre, auxAPaterno, auxSexo; int auxEdad, auxNumCtrlEscolar, auxSemestre, auxIdMateria; //Materia auxMateria;//("mate","ernes",10); fflush (stdin); //system("cls"); cout << "\n\n\tBienvenido al sistema escolar" << endl; cout << "\tEscribe el nombre del alumno "; getline(cin, auxNombre); cout << "\tEscribe el apellido paterno "; getline(cin, auxAPaterno); cout << "\tEscribe el sexo "; getline(cin, auxSexo); cout << "\tEscribe la edad "; cin >> auxEdad; cout << "\tEscribe el numero de Boleta "; cin >> auxNumCtrlEscolar; cout << "\tEscribe el numero de semestre "; cin >> auxSemestre; Alumno alumno(auxNombre, auxAPaterno, auxSexo, auxEdad, auxNumCtrlEscolar, auxSemestre, auxIdMateria); for (int i = 0; i < 2; i++) { cout << "\tEscriba el ID de la materias "; cin >> auxIdMateria; alumno.setIdArregloIdMaterias(i, auxIdMateria); } arregloAlumnos[indiceAlumnos] = alumno; indiceAlumnos++; } void validarAlumnos() { string auxNombre; fflush (stdin); cout << "\n\tEscribe el nombre del cliente a buscar: "; getline(cin, auxNombre); cout << "\n\tEscribe el nombre del cliente a buscar: " << auxNombre; for (int i = 0; i < indiceAlumnos; i++) { //if(arregloAlumnos[i].getNombre()==auxNombre){ if (arregloAlumnos[i].getNombre() == auxNombre) { cout << "\n\n\n----------------------BD--ALUMNOS------------------------------------\n"; cout << "\tEl nombre es: " << arregloAlumnos[i].getNombre() << endl; cout << "\tEl apellido paterno: " << arregloAlumnos[i].getApellidoP() << endl; cout << "\tEl sexo es: " << arregloAlumnos[i].getSexo() << endl; cout << "\tSu edad es: " << arregloAlumnos[i].getEdad() << endl; cout << "\tSu Boleta es: " << arregloAlumnos[i].getNumeroCtrlEscolar() << endl; cout << "\tSu Semestre es: " << arregloAlumnos[i].getSemestre() << endl; //cout<<"\tSu id de materia es: "<<arregloAlumnos[i].getIdMateria()<<endl; cout << "\t-----------Sus materias son-------------: " << endl; /*for(int j=0; j<2; j++){ cout<<"\t\tSu materia es: "<<arregloAlumnos[i].getIdArregloIdMaterias(j)<<endl; }*/ for (int j = 0; j < 2; j++) { cout << "idMAteria " << arregloMaterias[j].getIdMateria()<< " Alumno y su idmateria "<< arregloAlumnos[i].getIdArregloIdMaterias(j)<<endl; if (arregloMaterias[j].getIdMateria() == arregloAlumnos[i].getIdArregloIdMaterias(j) ||arregloMaterias[j].getIdMateria() == arregloAlumnos[i].getIdArregloIdMaterias(j+1) ) { cout<<"valor de i: "<<i<<"valor de j: "<<j<<"numAlumnos"<<indiceAlumnos; cout<< "\n\n\n************************************************\n"; cout<< "\t*La materia es: "<< arregloMaterias[j].getNombre()<< "\t*" << endl; cout << "\t*El profesor es: "<< arregloMaterias[j].getProfesor()<< "\t*" << endl; cout << "\t*Los creditos son: "<< arregloMaterias[j].getNumeroCreditos()<< "\t*"<< endl; cout << "\t*Su id es: " << arregloMaterias[j].getIdMateria()<< "\t\t*" << endl; cout<< "\n*****************************************************"; } cout<<"j: "<<j<<endl; } cout<< "\n-------------------------------------------------------------------------"; //} } } } void leerMaterias() { //for(int i=0; i<indiceMaterias;i++){ string auxNombre, auxProfesor; int auxCreditos, auxId; //Materia auxMateria;//("mate","ernes",10); fflush (stdin); system("cls"); cout << "\n\n\tBienvenido al sistema escolar" << endl; cout << "\tEscribe La materia "; getline(cin, auxNombre); cout << "\tEscribe el profesor "; getline(cin, auxProfesor); cout << "\tEscribe los creditos "; cin >> auxCreditos; cout << "\tEscribe el id "; cin >> auxId; Materia materia(auxNombre, auxProfesor, auxCreditos, auxId); arregloMaterias[indiceMaterias] = materia; indiceMaterias++; // } } void mostrarMaterias() { for (int i = 0; i < indiceMaterias; i++) { cout << "\n\n\n----------------------------------------------------------\n"; cout << "\tLa materia es: " << arregloMaterias[i].getNombre() << endl; cout << "\tEl profesor es: " << arregloMaterias[i].getProfesor() << endl; cout << "\tLos creditos son: " << arregloMaterias[i].getNumeroCreditos() << endl; cout << "\tSu id es: " << arregloMaterias[i].getIdMateria() << endl; cout << "\n----------------------------------------------------------"; } } void leerProfesor() { string auxNombre, auxAPaterno, auxAMaterno, auxSexo, auxProfesion; int auxEdad, auxNumCedulaProfesional; float auxMontoCuenta; fflush (stdin); system("cls"); cout << "\n\n\tBienvenido al sistema para guardar profesores" << endl; cout << "\tEscribe el nombre "; getline(cin, auxNombre); cout << "\tEscribe el apellido paterno "; getline(cin, auxAPaterno); cout << "\tEscribe el apellido materno "; getline(cin, auxAMaterno); cout << "\tEscribe el sexo "; getline(cin, auxSexo); cout << "\tEscribe la edad "; cin >> auxEdad; Profesor profesor(auxNombre, auxAPaterno, auxAMaterno, auxSexo, auxEdad, auxProfesion, auxNumCedulaProfesional); arregloProfesores[indiceProfesores] = profesor; indiceProfesores++; } void validarProfesor() { string auxNombre; for (int i = 0; i < indiceProfesores; i++) { // if (arregloProfesores[i].getNombre() == auxNombre) //{ cout << "\n\n\n----------------------------------------------------------\n"; cout << "\tEl nombre del profesor es: " << arregloProfesores[i].getNombre() << endl; cout << "\tEl apellido paterno: " << arregloProfesores[i].getApellidoP() << endl; cout << "\tEl apellido materno: " << arregloProfesores[i].getApellidoM() << endl; cout << "\tSu sexo es: " << arregloProfesores[i].getSexo() << endl; cout << "\tSu edad es: " << arregloProfesores[i].getEdad() << endl; cout << "\tSu titulo o profesion es: " << arregloProfesores[i].getProfesion() << endl; cout << "\tSu No. de cedula profesional es: " << arregloProfesores[i].getNumCedulaProfesional() << endl; cout << "\n----------------------------------------------------------"; //} } } void eliminarAlumno() { string auxNombre; fflush (stdin); cout << "\n\tEscribe el nombre del alumno a eliminar: "; getline(cin, auxNombre); for (int i = 0; i <= elementos; i++) { if (arregloAlumnos[i].getNombre() == auxNombre) { arregloAlumnos[i].setNombre(""); arregloAlumnos[i].setApellidoP(""); arregloAlumnos[i].setSexo(""); arregloAlumnos[i].setEdad(0); arregloAlumnos[i].setNumeroCtrlEscolar(0); arregloAlumnos[i].setSemestre(0); arregloAlumnos[i].setIdMateria(0); } } } void eliminarProfesor() { string auxNombre; fflush (stdin); cout << "\n\tEscribe el nombre del profesor a eliminar: "; getline(cin, auxNombre); for (int i = 0; i <= elementos; i++) { if (arregloProfesores[i].getNombre() == auxNombre) { arregloProfesores[i].setNombre(""); arregloProfesores[i].setApellidoP(""); arregloProfesores[i].setApellidoM(""); arregloProfesores[i].setSexo(""); arregloProfesores[i].setEdad(0); arregloProfesores[i].setProfesion(""); arregloProfesores[i].setNumCedulaProfesional(0); } } } void eliminarMaterias() { string auxNombre; fflush (stdin); cout << "\n\tEscribe el nombre de la materia a eliminar: "; getline(cin, auxNombre); for (int i = 0; i <= elementos; i++) { if (arregloMaterias[i].getNombre() == auxNombre) { arregloMaterias[i].setNombre(""); arregloMaterias[i].setProfesor(""); arregloMaterias[i].setNumeroCreditos(0); arregloMaterias[i].setIdMateria(0); } } } int main() { // leerMaterias(); // mostrarMaterias(); // eliminarMaterias(); int opcion; bool repetir = true; do { //system("cls"); // Texto del menú que se verá cada vez cout << "\n\nMenu de Opciones" << endl; cout << "1. Agregar alumno 1" << endl; cout << "2. Mostrar alumnos 2" << endl; cout << "3. Borrar Alumnos" << endl; cout << "4. Agregar Profesor" << endl; cout << "5. Mostrar Profesores" << endl; cout << "6. Borrar Profesores" << endl; cout << "7. Agregar Materia" << endl; cout << "8. Mostrar Materias" << endl; cout << "9. Borrar Materia" << endl; cout << "0. SALIR" << endl; cout << "\nIngrese una opcion: "; cin >> opcion; switch (opcion) { case 1: // Lista de instrucciones de la opción 1 system("cls"); leerAlumnos(); //eliminarAlumno(); //validarAlumnos(); //system("1"); // Pausa break; case 2: // Lista de instrucciones de la opción 2 system("cls"); validarAlumnos(); // system("2"); // Pausa break; case 3: // Lista de instrucciones de la opción 3 eliminarAlumno(); break; case 4: // Lista de instrucciones de la opción 4 leerProfesor(); // system("4"); // Pausa break; case 5: // Lista de instrucciones de la opción 4 validarProfesor(); //system("5"); // Pausa break; case 6: // Lista de instrucciones de la opción 4 eliminarProfesor(); //system("6"); // Pausa break; case 7: // Lista de instrucciones de la opción 4 leerMaterias(); //system("6"); // Pausa break; case 8: // Lista de instrucciones de la opción 4 mostrarMaterias(); //system("6"); // Pausa break; case 9: // Lista de instrucciones de la opción 4 eliminarMaterias(); //system("6"); // Pausa break; case 0: repetir = false; break; } } while (repetir); }
[ "ernesto-na@outlook.com" ]
ernesto-na@outlook.com
9bb16000058a7fd5380e41e362778cca91d87ffa
87eccce05e29d7dda3532fefb0049c95226aef09
/数据结构/实验/ex4_1SqStack/ex4_1_Test.h
1cb2f53b333ff4e40706e8ab0dcd8a8408f7db7d
[]
no_license
guodongxiaren/ShiYan
ee993d35bafe7f8c1c2d96293fd04d944dc04871
fd73caa7a49228de985045e33a00da1492cf4354
refs/heads/master
2020-05-16T08:00:30.376449
2016-01-10T09:24:50
2016-01-10T09:24:50
22,560,353
11
6
null
null
null
null
GB18030
C++
false
false
4,040
h
#ifndef EX4_1_TEST_H #define EX4_1_TEST_H #endif #include "MySqStack.h" //////////////////////////////////////// template <class T> void displayCurrentObject(MySqStack<T> ms) { cout<<"当前顺序栈中的元素为:"<<endl; cout<<ms; } /////////////////////////////////////// template <class T> void ex4_1_1(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************在栈顶压入元素e*************"<<endl<<endl; T e; cout<<"请输入你要在栈顶压入的元素:"; cin>>e; ss.push(e); cout<<"压入元素"<<e<<"后,新顺序栈如下所示:"<<endl; cout<<ss; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_2(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************弹出栈顶元素到e*************"<<endl<<endl; T e; if(ss.pop(e)==ERROR) { cout<<"!栈空,不能出栈"<<endl; return; } cout<<"弹出的栈顶元素为:"<<e<<endl; cout<<"弹出后顺序栈中的元素为:"<<endl; cout<<ss; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_3(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************读栈顶元素*************"<<endl<<endl; T e; if(ss.getTop(e)==ERROR) { cout<<"!栈空,无栈顶元素"<<endl; return; } cout<<"读栈顶元素为:"<<e<<endl; cout<<"读栈顶元素后,顺序栈中的元素为:"<<endl; cout<<ss; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_4(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************判断顺序栈是否为空*************"<<endl<<endl; if(ss.isEmpty()) cout<<"当前栈为空"<<endl; else cout<<"当前栈不为空"<<endl; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_5(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************求顺序栈中元素的个数*************"<<endl<<endl; cout<<"当前顺序栈中元素的个数为"<<ss.getLength()<<endl; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_6(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************把一个顺序栈赋值给另一个顺序栈*************"<<endl<<endl; MySqStack<int> t; t.randomCreate(); ss=t; cout<<"另一个顺序栈赋值给当前顺序栈为:"<<endl; cout<<ss; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_7(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************把顺序栈置空*************"<<endl<<endl; ss.clear(); cout<<"当前顺序栈置空后,元素的个数为"<<ss.getLength()<<endl; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_8(MySqStack<T>& ss,char& continueYesNo) { cout<<" ***************随机生成顺序栈*************"<<endl<<endl; cout<<"随机生成的顺序站中的一些元素如下:"<<endl; ss.randomCreate(); cout<<endl<<"随机生成的顺序栈(采用顺序存储)如下:"<<endl; cout<<ss; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; } template <class T> void ex4_1_9(MySqStack<T>& ss,char& continueYesNo) { cout<<" ************用已有顺序栈初始化另一个新顺序栈************"<<endl<<endl; MySqStack<T> t(ss); cout<<"当前顺序栈初始化另一顺序栈为:"<<endl; cout<<t; cout<<" ***************************************"<<endl<<endl; cout<<" 还继续吗(Y.继续\tN.结束)?"; cin>>continueYesNo; }
[ "879231132@qq.com" ]
879231132@qq.com
4a312195b81e4816da41cfe7c123815c4f5cef91
92572e01e7728aeed7d5d11cbbb2c1a7039cd0cc
/worker.h
675570eaf8674da06bb82cd78f97eb121f1de40f
[]
no_license
Dongzhixiao/C-_study_onQT
21a9084768f1b55454f64ba5fede048be9e98d28
c7eeabe52e6bb89e0759ff607185479d9c50ee65
refs/heads/master
2020-04-15T14:04:33.251665
2019-03-07T13:20:28
2019-03-07T13:20:28
56,897,477
17
26
null
null
null
null
UTF-8
C++
false
false
1,824
h
//目录遍历工作线程:采用“线程+工人+事件”模式! #ifndef WORKER_H #define WORKER_H #include <QThread> #include <QEvent> #include <QPointer> #include <QList> /* NOTES: * 1. the caller MUST maintain Runnable's life cycle * 2. the derived class MUST offer a QObject instance * to receive RunnableExcutedEvent */ class Runnable { public: Runnable(QObject *observer) : m_observer(observer) {} virtual ~Runnable(){} virtual void run() = 0; virtual bool notifyAfterRun(){ return true; } QPointer<QObject> m_observer; }; /*为什么我需要使用事件,而不是使用信号槽呢?主要原因是,事件的分发既可以是同步的,又可以是异步的,而函数的调用或者说是槽的回调总是同步的。 * 事件的另外一个好处是,它可以使用过滤器。 */ class RunnableExcutedEvent : public QEvent { public: RunnableExcutedEvent(Runnable *r); Runnable *m_runnable; static QEvent::Type evType(); private: static QEvent::Type s_evType; }; class WorkerThread : public QThread //工作线程接受具有Runnable接口的对象,执行完后反馈RunnableExcutedEvent给Runnable携带的观察者 { public: WorkerThread(QObject *parent = 0); ~WorkerThread(); void postRunnable(Runnable *r); //用于提交待执行任务,具体任务由Worker类负责执行 protected: void run(); private: QPointer<QObject> m_worker; QList<Runnable*> *m_runnables; //temp queue }; class Worker : public QObject { friend class WorkerThread; public: Worker() : m_runnables(0) {} ~Worker(); bool event(QEvent *e); private: void excuteQueuedRunnables(); void excuteRunnable(Runnable *runnable); private: QList<Runnable*> *m_runnables; }; #endif // WORKER_H
[ "dongzhixiaodong@gmail.com" ]
dongzhixiaodong@gmail.com
d48bcff5880ac712e04b0d6ae7506981b75360cd
b4f42eed62aa7ef0e28f04c1f455f030115ec58e
/messagingfw/sendas/test/sendastestmtm/src/csendastestuimtm.cpp
549ca09e41345a3ebdadf4b09f43a089f950f7f0
[]
no_license
SymbianSource/oss.FCL.sf.mw.messagingmw
6addffd79d854f7a670cbb5d89341b0aa6e8c849
7af85768c2d2bc370cbb3b95e01103f7b7577455
refs/heads/master
2021-01-17T16:45:41.697969
2010-11-03T17:11:46
2010-11-03T17:11:46
71,851,820
1
0
null
null
null
null
UTF-8
C++
false
false
3,675
cpp
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" // which accompanies this distribution, and is available // at the URL "http://www.eclipse.org/legal/epl-v10.html". // // Initial Contributors: // Nokia Corporation - initial contribution. // // Contributors: // // Description: // #include "csendastestuimtm.h" _LIT(KSendAsTestUiMtmResourceFile, "\\resource\\messaging\\sendastestuimtm.rss"); EXPORT_C CSendAsTestUiMtm* CSendAsTestUiMtm::NewL(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll) { CSendAsTestUiMtm* self = new (ELeave) CSendAsTestUiMtm(aBaseMtm, aRegisteredMtmDll); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); return self; } CSendAsTestUiMtm::~CSendAsTestUiMtm() { } CSendAsTestUiMtm::CSendAsTestUiMtm(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll) : CBaseMtmUi(aBaseMtm, aRegisteredMtmDll) { } void CSendAsTestUiMtm::ConstructL() { CBaseMtmUi::ConstructL(); } /* * Methods from CBaseMtmUi */ CMsvOperation* CSendAsTestUiMtm::OpenL(TRequestStatus& /*aStatus*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::CloseL(TRequestStatus& /*aStatus*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::EditL(TRequestStatus& aStatus) { TMsvEntry entry = BaseMtm().Entry().Entry(); entry.SetMtmData3(1234567890); // Show we've been called by touching the TMsvEntry. BaseMtm().Entry().ChangeL(entry); return CMsvCompletedOperation::NewL(Session(), Type(), KNullDesC8, BaseMtm().Entry().OwningService(), aStatus, entry.iError); } CMsvOperation* CSendAsTestUiMtm::ViewL(TRequestStatus& /*aStatus*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::OpenL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::CloseL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::EditL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::ViewL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::CancelL(TRequestStatus& /*aStatus*/, const CMsvEntrySelection& /*aSelection*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::ReplyL(TMsvId /*aDestination*/, TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::ForwardL(TMsvId /*aDestination*/, TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/) { User::Leave(KErrNotSupported); return NULL; } CMsvOperation* CSendAsTestUiMtm::ConfirmSendL(TRequestStatus& aStatus, const CMsvEntrySelection& /*aSelection*/, const TSecurityInfo& /*aClientInfo*/) { // Use the error value of the context entry to indicate whether the send is // confirmed (iError == KErrNone) or not (iError != KErrNone). TMsvEntry entry = BaseMtm().Entry().Entry(); return CMsvCompletedOperation::NewL(Session(), Type(), KNullDesC8, BaseMtm().Entry().OwningService(), aStatus, entry.iError); } void CSendAsTestUiMtm::GetResourceFileName(TFileName& aFileName) const { aFileName = KSendAsTestUiMtmResourceFile(); }
[ "none@none" ]
none@none
20e21710044ce3a9b34c3043af476ff70554c460
fedfd83c0762e084235bf5562d46f0959b318b6f
/L4 信息学奥赛一本通/0. 程序部分/ch05/第01节 一维数组/1114.cpp
827c23bb3564d1eb1395a985fbf9a3fbd3034f49
[]
no_license
mac8088/noip
7843b68b6eeee6b45ccfb777c3e389e56b188549
61ee051d3aff55b3767d0f2f7d5cc1e1c8d3cf20
refs/heads/master
2021-08-17T21:25:37.951477
2020-08-14T02:03:50
2020-08-14T02:03:50
214,208,724
6
0
null
null
null
null
UTF-8
C++
false
false
613
cpp
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { double a[1001], b[1001] = {0.0}, max = -1000000.0, min = -max, sum=0.0, avg = 0.0, wc = max; int n; cin >> n; for(int i=0; i<n; ++i) { scanf("%lf", &a[i]); sum+=a[i]; if(a[i] > max) max = a[i]; if(a[i] < min) min = a[i]; } sum -= (max + min); avg = sum/((n-2)*1.0); //cacl each of tolerance for(int i=0; i<n; ++i) if(a[i] != max && a[i] != min) b[i] = abs(avg - a[i]); //compare and get the max differ for(int i=0; i<n; ++i) if(b[i] > wc) wc = b[i]; printf("%.2lf %.2lf", avg, wc); return 0; }
[ "chun.ma@atos.net" ]
chun.ma@atos.net
4ef0382f74b46b74a3b6e5b901a012e27e88f736
c816f5db557bf7cd9e1b4f694947079e7932b249
/Arduino_package/hardware/libraries/WiFi/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino
8b2b993933ba217bb32f45afd598e829d48bb13a
[]
no_license
happyme531/ambd_arduino
ff9eb67f228f7c4c54442038978baeaa4fbef893
8b4d7b100d9632a1772aa92d36f0525a38709d8b
refs/heads/master
2023-05-12T12:17:11.519167
2021-06-05T14:00:47
2021-06-05T14:00:47
349,416,367
0
1
null
2021-05-02T08:57:32
2021-03-19T12:32:01
C
UTF-8
C++
false
false
4,561
ino
#include <WiFi.h> char ssid[] = "yourNetwork"; // your network SSID (name) char pass[] = "Password"; // your network password int keyIndex = 0; // your network key Index number (needed only for WEP) int status = WL_IDLE_STATUS; WiFiServer server(80); void setup() { Serial.begin(115200); // initialize serial communication pinMode(13, OUTPUT); // set the LED pin mode // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); while (true); // don't continue } // attempt to connect to Wifi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to Network named: "); Serial.println(ssid); // print the network name (SSID); // Connect to WPA/WPA2 network. Change this line if using open or WEP network: status = WiFi.begin(ssid, pass); // wait 10 seconds for connection: delay(10000); } server.begin(); // start the web server on port 80 printWifiStatus(); // you're connected now, so print out the status } void loop() { WiFiClient client = server.available(); // listen for incoming clients if (client) { // if you get a client, Serial.println("new client"); // print a message out the serial port String currentLine = ""; // make a String to hold incoming data from the client while (client.connected()) { // loop while the client's connected if (client.available()) { // if there's bytes to read from the client, char c = client.read(); // read a byte, then Serial.write(c); // print it out the serial monitor if (c == '\n') { // if the byte is a newline character // if the current line is blank, you got two newline characters in a row. // that's the end of the client HTTP request, so send a response: if (currentLine.length() == 0) { // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK) // and a content-type so the client knows what's coming, then a blank line: client.println("HTTP/1.1 200 OK"); client.println("Content-type:text/html"); client.println(); // the content of the HTTP response follows the header: client.print("Click <a href=\"/H\">here</a> turn the LED on pin 13 on<br>"); client.print("Click <a href=\"/L\">here</a> turn the LED on pin 13 off<br>"); // The HTTP response ends with another blank line: client.println(); // break out of the while loop: break; } else { // if you got a newline, then clear currentLine: currentLine = ""; } } else if (c != '\r') { // if you got anything else but a carriage return character, currentLine += c; // add it to the end of the currentLine } // Check to see if the client request was "GET /H" or "GET /L": if (currentLine.endsWith("GET /H")) { digitalWrite(13, HIGH); // GET /H turns the LED on } if (currentLine.endsWith("GET /L")) { digitalWrite(13, LOW); // GET /L turns the LED off } } } // close the connection: client.stop(); Serial.println("client disonnected"); } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the received signal strength: long rssi = WiFi.RSSI(); Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); // print where to go in a browser: Serial.print("To see this page in action, open a browser to http://"); Serial.println(ip); }
[ "zhangzhenwu@realtek-sg.com" ]
zhangzhenwu@realtek-sg.com
b1dc43b2c5fc0b228bb05f364fafd68b9882d14a
5b22d68f9c01682fa96d7ca4e796ad5a7b72d9ab
/code/routingkit2/src/osm_decoder.cpp
681d4600fcca91c9d7a648e771923b7c024451d6
[ "BSD-3-Clause" ]
permissive
kit-algo/ch_potentials
54d1b0b28712d7a4f794a5decedce98fa1c36c52
f833a2153635961b01c2d68e2da6d1ae213117a5
refs/heads/master
2022-11-12T17:41:01.667707
2022-11-08T12:01:09
2022-11-08T12:01:09
347,034,552
5
0
null
null
null
null
UTF-8
C++
false
false
24,892
cpp
#include "osm_decoder.h" #include "protobuf_var_int.h" #include "buffered_async_reader.h" #include "data_source.h" #include "protobuf.h" #include <zlib.h> #include <stdexcept> #include <thread> #include <iomanip> #include <sstream> #include <algorithm> #include <atomic> #include <string.h> #include <assert.h> static uint32_t ntohl(uint32_t netlong){ return (netlong << 24) | ((netlong << 16) >> 8) | ((netlong << 8) >> 16) | (netlong >> 24); } // link with -lz namespace RoutingKit2{ namespace{ // formally // // uint8_t*p = ...; // uint32_t x = *((uint32_t*)p); // // is undefined behavior. We therefore use memcpy. template<class T> void unaligned_store(uint8_t*dest, const T&val){ memcpy(dest, (const uint8_t*)&val, sizeof(T)); } template<class T> T unaligned_load(const uint8_t*src){ T ret; memcpy((uint8_t*)&ret, src, sizeof(T)); return ret; } constexpr uint64_t is_header_info_available_bit = 1; constexpr uint64_t is_ordered_bit = 2; constexpr uint64_t was_blob_read_bit = 4; constexpr uint64_t was_header_read_bit = 8; constexpr uint32_t pbf_decompressor_read_size = 64 << 20; class OsmPBFDecompressor { public: OsmPBFDecompressor():status(0){} OsmPBFDecompressor(RefDataSource data_source): status(0), reader(data_source, pbf_decompressor_read_size){ } uint64_t get_status() const { return status; } RefDataSource as_ref(){ return [&](uint8_t*buffer, size_t how_much_to_read) -> size_t{ assert(how_much_to_read == pbf_decompressor_read_size); const uint8_t*blob_begin, *blob_end; for(;;){ uint8_t*p = reader.read(4); if(p == nullptr) return 0; uint32_t header_size = ntohl(unaligned_load<uint32_t>(p)); uint32_t data_size = (uint32_t)-1; char block_type[16] = ""; const uint8_t*buffer = reader.read_or_throw(header_size); decode_protobuf_message_with_callbacks( buffer, buffer+header_size, [&](uint64_t key_id, uint64_t num){ if(key_id == 3) data_size = num; }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*str_begin, const uint8_t*str_end){ if(key_id == 1){ size_t len = str_end - str_begin; if(len > sizeof(block_type)-1) len = sizeof(block_type)-1; memcpy(block_type, str_begin, len); block_type[len] = '\0'; } } ); if(data_size == (uint32_t)-1) throw std::runtime_error("Cannot parse OSM blob header because it is missing the data size"); if(!strcmp(block_type, "OSMData")){ status |= is_header_info_available_bit | was_blob_read_bit; blob_begin = reader.read_or_throw(data_size); blob_end = blob_begin + data_size; break; } else if(!strcmp(block_type, "OSMHeader")) { if((status & is_header_info_available_bit) != 0 && (status & was_blob_read_bit) != 0) throw std::runtime_error("OSM PBF file header block must preceed all blob blocks"); if((status & is_header_info_available_bit) != 0 && (status & was_header_read_bit) != 0) throw std::runtime_error("OSM PBF file contains two header blocks"); bool is_ordered = false; const uint8_t*buffer = reader.read_or_throw(data_size); decode_protobuf_message_with_callbacks( buffer, buffer+data_size, [&](uint64_t key_id, uint64_t num){}, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*blob_begin, const uint8_t*blob_end){ const char*str_begin = (const char*)blob_begin; const char*str_end = (const char*)blob_end; if(key_id == 4){ // must support if(!std::equal(str_begin, str_end, "DenseNodes")) throw std::runtime_error("Required OSM PBF feature \""+std::string(str_begin, str_end)+"\" is unknown"); }else if(key_id == 5){ // may exploit if(std::equal(str_begin, str_end, "Sort.Type_then_ID")) is_ordered = true; } } ); if(is_ordered) status = is_header_info_available_bit | is_ordered_bit | was_header_read_bit; else status = is_header_info_available_bit | was_header_read_bit; } else { reader.read(data_size); continue; } } const uint8_t *uncompressed_begin = nullptr, *uncompressed_end = nullptr, *compressed_begin = nullptr, *compressed_end = nullptr; uint64_t uncompressed_data_size = (uint64_t)-1; decode_protobuf_message_with_callbacks( blob_begin, blob_end, [&](uint64_t key_id, uint64_t num){ if(key_id == 2) uncompressed_data_size = num; }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*str_begin, const uint8_t*str_end){ if(key_id == 1){ uncompressed_begin = str_begin; uncompressed_end = str_end; }else if(key_id == 3){ compressed_begin = str_begin; compressed_end = str_end; } } ); if(uncompressed_begin != nullptr && compressed_begin != nullptr) throw std::runtime_error("PBF error: Blob must not contain both compressed and uncompressed data"); if(uncompressed_begin == nullptr && compressed_begin == nullptr) throw std::runtime_error("PBF error: Blob contains neither compressed nor uncompressed data"); if(uncompressed_data_size == (uint64_t)-1) throw std::runtime_error("PBF error: Blob does not contain the size of the uncompressed data"); if(uncompressed_begin){ if(uncompressed_data_size > how_much_to_read-4) throw std::runtime_error("PBF error: Blob is too large. It is "+std::to_string(uncompressed_data_size) + " but may be at most "+std::to_string(how_much_to_read-4)); if(uncompressed_data_size != (std::uint64_t)(uncompressed_end - uncompressed_begin)) throw std::runtime_error("PBF error: claimed uncompressed blob size does not correspond to actual blob size"); unaligned_store<uint32_t>(buffer, uncompressed_data_size); buffer += 4; memcpy(buffer, uncompressed_begin, uncompressed_data_size); return uncompressed_data_size + 4; }else{ uint64_t compressed_data_size = compressed_end - compressed_begin; if(uncompressed_data_size > how_much_to_read-4) throw std::runtime_error("PBF error: Blob is too large. It is "+std::to_string(uncompressed_data_size) + " but may be at most "+std::to_string(how_much_to_read-4)); unaligned_store<uint32_t>(buffer, uncompressed_data_size); buffer += 4; z_stream z; z.next_in = (unsigned char*) compressed_begin; z.avail_in = compressed_data_size; z.next_out = (unsigned char*) buffer; z.avail_out = how_much_to_read-4; z.zalloc = Z_NULL; z.zfree = Z_NULL; z.opaque = Z_NULL; if(inflateInit(&z) != Z_OK) { throw std::runtime_error("PBF error: Failed to initialize zlib stream."); } if(inflate(&z, Z_FINISH) != Z_STREAM_END) { throw std::runtime_error("PBF error: Failed to completely inflate zlib stream. Probably the OSM blob decompresses to something larger than reported in the header."); } if(inflateEnd(&z) != Z_OK) { throw std::runtime_error("PBF error: Failed to cleanup zlib stream."); } if(z.total_out != uncompressed_data_size) { throw std::runtime_error("PBF error: OSM blob decompresses to fewer bytes than reported in the header."); } return uncompressed_data_size + 4; } }; } private: uint64_t status; BufferedAsyncReader reader; }; } namespace { void internal_read_osm_pbf( BufferedAsyncReader&reader, std::function<void(uint64_t osm_node_id, LatLon p, const TagMap&tags)>node_callback, std::function<void(uint64_t osm_way_id, const std::vector<std::uint64_t>&osm_node_id_list, const TagMap&tags)>way_callback, std::function<void(uint64_t osm_relation_id, const std::vector<OSMRelationMember>&member_list, const TagMap&tags)>relation_callback, std::function<void(std::string msg)>log_message ){ TagMap tag_map; std::vector<OSMRelationMember>member_list; std::vector<uint64_t>node_list; std::vector<const char*>string_table; std::vector<uint32_t>key_list; std::vector<uint32_t>value_list; std::vector<std::pair<const uint8_t*, const uint8_t*>>group_list; for(;;){ uint8_t*primblock_begin, *primblock_end; { uint8_t*s_ptr = reader.read(4); if(s_ptr == nullptr) break; uint32_t s = unaligned_load<uint32_t>(s_ptr); primblock_begin = reader.read_or_throw(s); primblock_end = primblock_begin + s; } string_table.clear(); group_list.clear(); uint64_t latlon_granularity = 100; int64_t offset_of_latitude = 0; int64_t offset_of_longitude = 0; decode_protobuf_message_with_callbacks( primblock_begin, primblock_end, [&](uint64_t key_id, uint64_t num){ if(key_id == 17) latlon_granularity = num; else if(key_id == 19) offset_of_latitude = zigzag_convert_uint64_to_int64(num); else if(key_id == 20) offset_of_longitude = zigzag_convert_uint64_to_int64(num); }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, uint8_t*outter_blob_begin, uint8_t*outter_blob_end){ if(key_id == 1){ decode_protobuf_message_with_callbacks( outter_blob_begin, outter_blob_end, [&](uint64_t key_id, uint64_t num){}, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, uint8_t*inner_blob_begin, uint8_t*inner_blob_end){ // This is safe, see description of decode_protobuf_message_with_callbacks // for why. char*str_begin = (char*)inner_blob_begin-1; size_t len = inner_blob_end - inner_blob_begin; memmove(str_begin, inner_blob_begin, len); str_begin[len] = '\0'; string_table.push_back(str_begin); } ); }else if(key_id == 2){ group_list.push_back({outter_blob_begin, outter_blob_end}); } } ); if(latlon_granularity == 0) throw std::runtime_error("PBF error: latlon_granularity of a block must not be zero."); double primblock_lon_offset = 0.000000001 * offset_of_latitude; double primblock_lat_offset = 0.000000001 * offset_of_longitude; double primblock_granularity = 0.000000001 * latlon_granularity; auto decode_sparse_node = [&](const uint8_t*begin, const uint8_t*end){ uint64_t osm_node_id = (uint64_t)-1; double latitude = 0.0, longitude = 0.0; const uint8_t *key_begin = nullptr, *key_end = nullptr, *value_begin = nullptr, *value_end = nullptr; decode_protobuf_message_with_callbacks( begin, end, [&](uint64_t key_id, uint64_t num){ if(key_id == 1) osm_node_id = num; else if(key_id == 19) latitude = primblock_lon_offset + primblock_granularity * zigzag_convert_uint64_to_int64(num); else if(key_id == 20) longitude = primblock_lat_offset + primblock_granularity * zigzag_convert_uint64_to_int64(num); }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*begin, const uint8_t*end){ if(key_id == 2){ key_begin = begin; key_end = end; }else if(key_id == 3){ value_begin = begin; value_end = end; } } ); if(osm_node_id == (uint64_t)-1) throw std::runtime_error("PBF error: way is missing its OSM ID."); key_list.clear(); value_list.clear(); while(key_begin != key_end && value_begin != value_end){ key_list.push_back(decode_var_uint_from_front_and_advance(key_begin, key_end)); value_list.push_back(decode_var_uint_from_front_and_advance(value_begin, value_end)); } if(key_begin != key_end || value_begin != value_end) throw std::runtime_error("PBF error: key and value arrays do not decode to equal length."); tag_map.build( key_list.size(), [&](uint64_t i){ i = key_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: key string ID is out of bounds."); return string_table[i]; }, [&](uint64_t i){ i = value_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: value string ID is out of bounds."); return string_table[i]; } ); // FIXME: eliminate doubles node_callback(osm_node_id, LatLon::from_lat_lon(latitude, longitude), tag_map); }; auto decode_dense_node = [&](const uint8_t*begin, const uint8_t*end){ const uint8_t *osm_node_id_begin = nullptr, *osm_node_id_end = nullptr, *key_value_pairs_begin = nullptr, *key_value_pairs_end = nullptr, *latitude_begin = nullptr, *latitude_end = nullptr, *longitude_begin = nullptr, *longitude_end = nullptr; decode_protobuf_message_with_callbacks( begin, end, [&](uint64_t key_id, uint64_t num){}, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*begin, const uint8_t*end){ if(key_id == 1){ osm_node_id_begin = begin; osm_node_id_end = end; }else if(key_id == 8){ latitude_begin = begin; latitude_end = end; }else if(key_id == 9){ longitude_begin = begin; longitude_end = end; }else if(key_id == 10){ key_value_pairs_begin = begin; key_value_pairs_end = end; } } ); if(osm_node_id_begin == nullptr) throw std::runtime_error("PBF error: dense node must contain node IDs."); if(latitude_begin == nullptr) throw std::runtime_error("PBF error: dense node must contain latitudes."); if(longitude_begin == nullptr) throw std::runtime_error("PBF error: dense node must contain longitudes."); tag_map.clear(); uint64_t osm_node_id = 0; double latitude = 0.0, longitude = 0.0; while(osm_node_id_begin != osm_node_id_end){ osm_node_id += zigzag_convert_uint64_to_int64(decode_var_uint_from_front_and_advance(osm_node_id_begin, osm_node_id_end)); latitude += primblock_lon_offset + primblock_granularity * zigzag_convert_uint64_to_int64(decode_var_uint_from_front_and_advance(latitude_begin, latitude_end)); longitude += primblock_lon_offset + primblock_granularity * zigzag_convert_uint64_to_int64(decode_var_uint_from_front_and_advance(longitude_begin, longitude_end)); if(key_value_pairs_begin != nullptr){ key_list.clear(); value_list.clear(); for(;;){ uint64_t x = decode_var_uint_from_front_and_advance(key_value_pairs_begin, key_value_pairs_end); if(x == 0) break; uint64_t y = decode_var_uint_from_front_and_advance(key_value_pairs_begin, key_value_pairs_end); key_list.push_back(x); value_list.push_back(y); } tag_map.build( key_list.size(), [&](uint64_t i){ i = key_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: key string ID is out of bounds."); return string_table[i]; }, [&](uint64_t i){ i = value_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: value string ID is out of bounds."); return string_table[i]; } ); } // FIXME: eliminate doubles node_callback(osm_node_id, LatLon::from_lat_lon(latitude, longitude), tag_map); } if(latitude_begin != latitude_end) throw std::runtime_error("PBF error: dense node latitude array has a different length than the node ID array."); if(longitude_begin != longitude_end) throw std::runtime_error("PBF error: dense node longitude array has a different length than the node ID array."); if(key_value_pairs_begin != key_value_pairs_end) throw std::runtime_error("PBF error: dense node key-value array is too long."); }; auto decode_way = [&](const uint8_t*begin, const uint8_t*end){ uint64_t osm_way_id = (uint64_t)-1; const uint8_t *key_begin = nullptr, *key_end = nullptr, *value_begin = nullptr, *value_end = nullptr, *node_list_begin = nullptr, *node_list_end = nullptr; decode_protobuf_message_with_callbacks( begin, end, [&](uint64_t key_id, uint64_t num){ if(key_id == 1){ osm_way_id = num; } }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*begin, const uint8_t*end){ if(key_id == 2){ key_begin = begin; key_end = end; }else if(key_id == 3){ value_begin = begin; value_end = end; }else if(key_id == 8){ node_list_begin = begin; node_list_end = end; } } ); if(osm_way_id == (uint64_t)-1) throw std::runtime_error("PBF error: way is missing its OSM ID."); key_list.clear(); value_list.clear(); while(key_begin != key_end && value_begin != value_end){ key_list.push_back(decode_var_uint_from_front_and_advance(key_begin, key_end)); value_list.push_back(decode_var_uint_from_front_and_advance(value_begin, value_end)); } if(key_begin != key_end || value_begin != value_end) throw std::runtime_error("PBF error: key and value arrays do not decode to equal length."); tag_map.build( key_list.size(), [&](uint64_t i){ i = key_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: key string ID is out of bounds."); return string_table[i]; }, [&](uint64_t i){ i = value_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: value string ID is out of bounds."); return string_table[i]; } ); node_list.clear(); uint64_t id = 0; while(node_list_begin != node_list_end){ id += zigzag_convert_uint64_to_int64(decode_var_uint_from_front_and_advance(node_list_begin, node_list_end)); node_list.push_back(id); } if(node_list.size() == 0) log_message("Warning: OSM way "+std::to_string(osm_way_id)+" has no nodes; ignoring way"); else if(node_list.size() == 1) log_message("Warning: OSM way "+std::to_string(osm_way_id)+" has only one node; ignoring way"); else way_callback(osm_way_id, node_list, tag_map); }; auto decode_relation = [&](const uint8_t*begin, const uint8_t*end){ uint64_t osm_relation_id = (uint64_t)-1; const uint8_t *key_begin = nullptr, *key_end = nullptr, *value_begin = nullptr, *value_end = nullptr, *member_role_begin = nullptr, *member_role_end = nullptr, *member_id_begin = nullptr, *member_id_end = nullptr, *member_type_begin = nullptr, *member_type_end = nullptr; decode_protobuf_message_with_callbacks( begin, end, [&](uint64_t key_id, uint64_t num){ if(key_id == 1){ osm_relation_id = num; } }, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*begin, const uint8_t*end){ if(key_id == 2){ key_begin = begin; key_end = end; }else if(key_id == 3){ value_begin = begin; value_end = end; }else if(key_id == 8){ member_role_begin = begin; member_role_end = end; }else if(key_id == 9){ member_id_begin = begin; member_id_end = end; }else if(key_id == 10){ member_type_begin = begin; member_type_end = end; } } ); if(osm_relation_id == (uint64_t)-1) throw std::runtime_error("PBF error: way is missing its OSM ID."); key_list.clear(); value_list.clear(); while(key_begin != key_end && value_begin != value_end){ key_list.push_back(decode_var_uint_from_front_and_advance(key_begin, key_end)); value_list.push_back(decode_var_uint_from_front_and_advance(value_begin, value_end)); } if(key_begin != key_end || value_begin != value_end) throw std::runtime_error("PBF error: key and value arrays do not decode to equal length."); tag_map.build( key_list.size(), [&](uint64_t i){ i = key_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: key string ID is out of bounds."); return string_table[i]; }, [&](uint64_t i){ i = value_list[i]; if(i > string_table.size()) throw std::runtime_error("PBF error: value string ID is out of bounds."); return string_table[i]; } ); member_list.clear(); uint64_t member_id = 0; while(member_id_begin != member_id_end){ member_id += zigzag_convert_uint64_to_int64(decode_var_uint_from_front_and_advance(member_id_begin, member_id_end)); auto x = decode_var_uint_from_front_and_advance(member_role_begin, member_role_end); if(x >= string_table.size()) throw std::runtime_error("PBF error: relation member role string ID is out of bounds."); const char*role = string_table[x]; uint64_t type_id = decode_var_uint_from_front_and_advance(member_type_begin, member_type_end); OSMIDType member_type; if(type_id == 0) member_type = OSMIDType::node; else if(type_id == 1) member_type = OSMIDType::way; else if(type_id == 2) member_type = OSMIDType::relation; else throw std::runtime_error("PBF error: Unknown relation type."); member_list.push_back({member_type, member_id, role}); } relation_callback(osm_relation_id, member_list, tag_map); }; for(auto g:group_list){ decode_protobuf_message_with_callbacks( g.first, g.second, [&](uint64_t key_id, uint64_t num){}, [&](uint64_t key_id, double num){}, [&](uint64_t key_id, const uint8_t*blob_begin, const uint8_t*blob_end){ if(key_id == 1 && node_callback) { decode_sparse_node(blob_begin, blob_end); } else if(key_id == 2 && node_callback) { decode_dense_node(blob_begin, blob_end); } else if(key_id == 3 && way_callback) { decode_way(blob_begin, blob_end); } else if(key_id == 4 && relation_callback) { decode_relation(blob_begin, blob_end); } } ); } } } } void unordered_read_osm_pbf( const std::string&file_name, std::function<void(uint64_t osm_node_id, LatLon p, const TagMap&tags)>node_callback, std::function<void(uint64_t osm_way_id, Span<const uint64_t>osm_node_id_list, const TagMap&tags)>way_callback, std::function<void(uint64_t osm_relation_id, Span<const OSMRelationMember>member_list, const TagMap&tags)>relation_callback, std::function<void(std::string msg)>log_message ){ assert(node_callback || way_callback || relation_callback); FileDataSource data_source(file_name); OsmPBFDecompressor decompressor(data_source.as_ref()); BufferedAsyncReader reader(decompressor.as_ref(), pbf_decompressor_read_size); internal_read_osm_pbf(reader, node_callback, way_callback, relation_callback, log_message); } void ordered_read_osm_pbf( const std::string&file_name, std::function<void(uint64_t osm_node_id, LatLon p, const TagMap&tags)>node_callback, std::function<void(uint64_t osm_way_id, Span<const uint64_t>osm_node_id_list, const TagMap&tags)>way_callback, std::function<void(uint64_t osm_relation_id, Span<const OSMRelationMember>member_list, const TagMap&tags)>relation_callback, std::function<void(std::string msg)>log_message, bool file_is_ordered_even_though_file_header_says_that_it_is_unordered ){ assert(node_callback || way_callback || relation_callback); FileDataSource data_source(file_name); OsmPBFDecompressor decompressor(data_source.as_ref()); BufferedAsyncReader reader(decompressor.as_ref(), pbf_decompressor_read_size); if(!file_is_ordered_even_though_file_header_says_that_it_is_unordered){ while((decompressor.get_status() & is_header_info_available_bit) == 0){ std::atomic_thread_fence(std::memory_order::memory_order_seq_cst); std::this_thread::yield(); } } if(file_is_ordered_even_though_file_header_says_that_it_is_unordered || (decompressor.get_status() & is_ordered_bit) != 0){ internal_read_osm_pbf(reader, node_callback, way_callback, relation_callback, log_message); } else { if(node_callback){ internal_read_osm_pbf(reader, node_callback, nullptr, nullptr, log_message); if(relation_callback || way_callback){ reader = BufferedAsyncReader(); decompressor = OsmPBFDecompressor(); data_source.rewind(); decompressor = OsmPBFDecompressor(data_source.as_ref()); reader = BufferedAsyncReader(decompressor.as_ref(), pbf_decompressor_read_size); } } if(way_callback){ internal_read_osm_pbf(reader, nullptr, way_callback, nullptr, log_message); if(relation_callback){ reader = BufferedAsyncReader(); decompressor = OsmPBFDecompressor(); data_source.rewind(); decompressor = OsmPBFDecompressor(data_source.as_ref()); reader = BufferedAsyncReader(decompressor.as_ref(), pbf_decompressor_read_size); } } if(relation_callback){ internal_read_osm_pbf(reader, nullptr, nullptr, relation_callback, log_message); } } } } // RoutingKit2
[ "github@ben-strasser.net" ]
github@ben-strasser.net
ad7b61cd4c49b27563c351901728be33d527eff7
5388c95e89ccd03bb1a18aaa663785efc4d6e767
/Test002-FontBlitting/MainWindow.h
ea5504011df9dbff2e27ef0a42fb994a579f5ee6
[]
no_license
egrath/Tests
59397a79432bdf9c4dda9684fbdced4253ef7497
d50a2420f0bd2a78acdee1f419d5bd2d7c0a731d
refs/heads/master
2022-10-23T01:35:53.820355
2020-06-12T05:46:04
2020-06-12T05:46:04
251,276,549
0
0
null
null
null
null
UTF-8
C++
false
false
251
h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "ui_MainWindow.h" class MainWindow : public QMainWindow { private: Ui_MainWindow *m_Ui = nullptr; public: MainWindow(); ~MainWindow(); }; #endif // MAINWINDOW_H
[ "egon.rath@gmail.com" ]
egon.rath@gmail.com
0ff1aea4371eed1604a0fe97e9ed70c543644723
f4d62879bd6cc2d6c15eb21ea3d14101ed4eed2b
/plugins/win-mf/mf-h264-encoder.hpp
0d79050fd2c4b008e8520d0161ba6ec84a3b597a
[]
no_license
LiuKeHua/MyObsStudio
ccc9befec01458d126970868c70413dd4755463c
3fbb813550572d417355b40039bc0e3c1f030a2e
refs/heads/master
2020-04-03T14:41:58.413711
2018-12-10T03:43:46
2018-12-10T03:43:46
155,331,426
2
0
null
null
null
null
UTF-8
C++
false
false
4,452
hpp
#pragma once #include <obs-module.h> #define WIN32_MEAN_AND_LEAN #include <Windows.h> #undef WIN32_MEAN_AND_LEAN #include <mfapi.h> #include <mfidl.h> #include <wmcodecdsp.h> #include <vector> #include <queue> #include <memory> #include <atomic> #include <util/windows/ComPtr.hpp> #include "mf-encoder-descriptor.hpp" #include "mf-common.hpp" namespace MF { enum H264Profile { H264ProfileBaseline, H264ProfileMain, H264ProfileHigh }; enum H264RateControl { H264RateControlCBR, H264RateControlConstrainedVBR, H264RateControlVBR, H264RateControlCQP }; struct H264QP { UINT16 defaultQp; UINT16 i; UINT16 p; UINT16 b; UINT64 Pack(bool packDefault) { int shift = packDefault ? 0 : 16; UINT64 packedQp; if (packDefault) packedQp = defaultQp; packedQp |= i << shift; shift += 16; packedQp |= p << shift; shift += 16; packedQp |= b << shift; return packedQp; } }; enum H264EntropyEncoding { H264EntropyEncodingCABLC, H264EntropyEncodingCABAC }; struct H264Frame { public: H264Frame(bool keyframe, UINT64 pts, UINT64 dts, std::unique_ptr<std::vector<uint8_t>> data) : keyframe(keyframe), pts(pts), dts(dts), data(std::move(data)) {} bool Keyframe() { return keyframe; } BYTE *Data() { return data.get()->data(); } DWORD DataLength() { return (DWORD)data.get()->size(); } INT64 Pts() { return pts; } INT64 Dts() { return dts; } private: H264Frame(H264Frame const&) = delete; H264Frame& operator=(H264Frame const&) = delete; private: bool keyframe; INT64 pts; INT64 dts; std::unique_ptr<std::vector<uint8_t>> data; }; class H264Encoder { public: H264Encoder(const obs_encoder_t *encoder, std::shared_ptr<EncoderDescriptor> descriptor, UINT32 width, UINT32 height, UINT32 framerateNum, UINT32 framerateDen, H264Profile profile, UINT32 bitrate); ~H264Encoder(); bool Initialize(std::function<bool(void)> func); bool ProcessInput(UINT8 **data, UINT32 *linesize, UINT64 pts, Status *status); bool ProcessOutput(UINT8 **data, UINT32 *dataLength, UINT64 *pts, UINT64 *dts, bool *keyframe, Status *status); bool ExtraData(UINT8 **data, UINT32 *dataLength); const obs_encoder_t *ObsEncoder() { return encoder; } public: bool SetBitrate(UINT32 bitrate); bool SetQP(H264QP &qp); bool SetMaxBitrate(UINT32 maxBitrate); bool SetRateControl(H264RateControl rateControl); bool SetKeyframeInterval(UINT32 seconds); bool SetLowLatency(bool lowLatency); bool SetBufferSize(UINT32 bufferSize); bool SetBFrameCount(UINT32 bFrames); bool SetEntropyEncoding(H264EntropyEncoding entropyEncoding); bool SetMinQP(UINT32 minQp); bool SetMaxQP(UINT32 maxQp); private: H264Encoder(H264Encoder const&) = delete; H264Encoder& operator=(H264Encoder const&) = delete; private: HRESULT InitializeEventGenerator(); HRESULT InitializeExtraData(); HRESULT CreateMediaTypes(ComPtr<IMFMediaType> &inputType, ComPtr<IMFMediaType> &outputType); HRESULT EnsureCapacity(ComPtr<IMFSample> &sample, DWORD length); HRESULT CreateEmptySample(ComPtr<IMFSample> &sample, ComPtr<IMFMediaBuffer> &buffer, DWORD length); HRESULT ProcessInput(ComPtr<IMFSample> &sample); HRESULT ProcessOutput(); HRESULT DrainEvent(bool block); HRESULT DrainEvents(); private: const obs_encoder_t *encoder; std::shared_ptr<EncoderDescriptor> descriptor; const UINT32 width; const UINT32 height; const UINT32 framerateNum; const UINT32 framerateDen; const UINT32 initialBitrate; const H264Profile profile; bool createOutputSample; ComPtr<IMFTransform> transform; ComPtr<ICodecAPI> codecApi; std::vector<BYTE> extraData; // The frame returned by ProcessOutput // Valid until the next call to ProcessOutput std::unique_ptr<H264Frame> activeFrame; // Queued input samples that the encoder was not ready // to process std::queue<ComPtr<IMFSample>> inputSamples; // Queued output samples that have not been returned from // ProcessOutput yet std::queue<std::unique_ptr<H264Frame>> encodedFrames; ComPtr<IMFMediaEventGenerator> eventGenerator; std::atomic<UINT32> inputRequests = 0; std::atomic<UINT32> outputRequests = 0; std::atomic<UINT32> pendingRequests = 0; }; }
[ "liukehua880123@163.com" ]
liukehua880123@163.com
2064e495a303c97258b26928402ee7e732ec827e
37f93566e9f86c197dd2aeb735c59e2d5ebe0f15
/library_gui/CActiveZoneItem.cpp
c239323910460da6b16c9966bed92cfbca3f7eeb
[]
no_license
ProvisionLab/Tracker
7485471a0b4a37fda3245e0db4a48d3d27a49e52
6bf331e364f106d3ea59732355c014c760ff34d8
refs/heads/master
2021-03-24T09:14:05.224024
2020-12-14T15:22:23
2020-12-14T15:22:23
56,514,020
2
0
null
null
null
null
UTF-8
C++
false
false
2,989
cpp
#include "CActiveZoneItem.h" #include <QDebug> #include <QFile> #include <QPainter> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> CActiveZoneItem::CActiveZoneItem(QFileInfo const & f_etalon) { const int tag_len = sizeof("YY_MM_DD_HH_mm_ss")-1; QString fn = f_etalon.fileName(); if ( fn.size() <= tag_len ) return; if( QStringRef(&fn, tag_len, fn.size()-tag_len) != "__etalon.png" ) return; path = f_etalon.absolutePath(); tag = fn.left(tag_len); } bool CActiveZoneItem::exists() const { if (isEmpty()) return false; QDir dir(path); if ( !dir.exists() ) return false; if (!exist_file(get_path_etalon())) return false; if (!exist_file(get_path_left())) return false; if (!exist_file(get_path_right())) return false; if (!exist_file(get_path_left_txt())) return false; if (!exist_file(get_path_right_txt())) return false; return true; } void CActiveZoneItem::deleteFiles() { qDebug() << __FUNCTION__ << path << tag; QFile::remove(get_path_etalon()); QFile::remove(get_path_left()); QFile::remove(get_path_left_txt()); QFile::remove(get_path_right()); QFile::remove(get_path_right_txt()); } QPixmap CActiveZoneItem::getImageCV(QSize iconSize, bool bFixedSize) const { qDebug() << __FUNCTION__ << iconSize << bFixedSize; cv::Mat ref = cv::imread( get_path_etalon().toStdString() ); if (ref.empty()) { return {}; } float scale = std::min(iconSize.height() / (float)ref.rows, iconSize.width() / (float)ref.cols); cv::Mat resized; cv::resize(ref, resized, cv::Size(ref.cols * scale, ref.rows * scale)); cv::Mat resizedRgb; if ( bFixedSize ) { cv::Mat m3(iconSize.width(), iconSize.height(), resized.type()); m3.setTo(0); resized.copyTo(m3(cv::Rect( (m3.cols-resized.cols)/2, (m3.rows-resized.rows)/2, resized.cols, resized.rows)) ); cvtColor(m3, resizedRgb, CV_BGR2RGB); } else { cvtColor(resized, resizedRgb, CV_BGR2RGB); } QImage img((unsigned char*)resizedRgb.data, resizedRgb.cols, resizedRgb.rows, resizedRgb.step, QImage::Format_RGB888); return QPixmap::fromImage(img); } QPixmap CActiveZoneItem::getImageQt(QSize iconSize, bool bFixedSize, QColor bgColor) const { if ( !bFixedSize ) return QPixmap::fromImage( QImage(get_path_etalon()) .scaled(iconSize) ); auto img = QImage(get_path_etalon()) .scaled(iconSize, Qt::KeepAspectRatio); QImage img2(iconSize, img.format()); img2.fill(bgColor); QPainter paint; paint.begin(&img2); paint.drawImage( (iconSize.width()-img.width())/2, (iconSize.height()-img.height())/2, img); paint.end(); return QPixmap::fromImage(img2); }
[ "bondarets.ivan@gmail.com" ]
bondarets.ivan@gmail.com
d5230a230750c88dfe1108ddedcf020df9980172
af1223d95655dc6e23ffa51402755a9b9c47271f
/376_WiggleSubsequence.cpp
5171ce9040aa3e658bb86e958a3d1d34e700da8e
[]
no_license
royyjzhang/leetcode_cpp
85352fbd2374a03298f0e8bace354d1408354f96
183c82dabb05f1090cc6855b7f6e18bcd9d4f2b9
refs/heads/master
2021-01-21T22:44:14.147933
2017-09-04T05:05:26
2017-09-04T05:05:26
102,170,232
0
0
null
null
null
null
UTF-8
C++
false
false
911
cpp
#include<iostream> #include<vector> #include<queue> #include<stdlib.h> #include<string> #include<algorithm> #include<map> #include<math.h> #include<stdint.h> #include<stack> #include<sstream> #include<unordered_map> using namespace std; class Solution { public: int wiggleMaxLength(vector<int>& nums) { int n, i, flag = 0, result = 0; n = nums.size(); if (n == 0) { return 0; } if (n == 1) { return 1; } for (i = 1; i < n; i++) { if (nums[i] < nums[i - 1]) { if ((flag == 0) || (flag == 1)) { result++; flag = -1; } } else if (nums[i] > nums[i - 1]) { if ((flag == 0) || (flag == -1)) { result++; flag = 1; } } } return result + 1; } }; int main() { Solution solution; vector<int> nums = { 1,7,4,9,2,5 }; cout << solution.wiggleMaxLength(nums) << endl; system("PAUSE"); return 0; }
[ "royyjzhang@outlook.com" ]
royyjzhang@outlook.com
f75c00dd2e5446790232244127e9edec0e9741ef
d4cdc06cdef352add4c6bcd9b300e419d03b7568
/BGPsource/OpenGL 3.0/chapter_3/lines/src/glwindow.cpp
2e7c8fdcf6477e44c3ec69d2b488b93941c08e21
[]
no_license
QtOpenGL/Animation-Retargeter-Qt-2
f2ce024c6895a9640b92057bb2ae2f7d253f123a
1619072d0aed8073fa5311a33ac9523aa0d95e20
refs/heads/master
2021-04-15T10:59:36.433919
2018-01-26T01:06:10
2018-01-26T01:06:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,761
cpp
#include <ctime> #include <iostream> #include <windows.h> #include <GL/gl.h> #include "wglext.h" #include "glwindow.h" #include "example.h" typedef HGLRC (APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int*); PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; GLWindow::GLWindow(HINSTANCE hInstance): m_isRunning(false), m_example(NULL), m_hinstance(hInstance), m_lastTime(0) { } bool GLWindow::create(int width, int height, int bpp, bool fullscreen) { DWORD dwExStyle; // Window Extended Style DWORD dwStyle; // Window Style m_isFullscreen = fullscreen; //Store the fullscreen flag m_windowRect.left = (long)0; // Set Left Value To 0 m_windowRect.right = (long)width; // Set Right Value To Requested Width m_windowRect.top = (long)0; // Set Top Value To 0 m_windowRect.bottom = (long)height; // Set Bottom Value To Requested Height // fill out the window class structure m_windowClass.cbSize = sizeof(WNDCLASSEX); m_windowClass.style = CS_HREDRAW | CS_VREDRAW; m_windowClass.lpfnWndProc = GLWindow::StaticWndProc; //We set our static method as the event handler m_windowClass.cbClsExtra = 0; m_windowClass.cbWndExtra = 0; m_windowClass.hInstance = m_hinstance; m_windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); // default icon m_windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); // default arrow m_windowClass.hbrBackground = NULL; // don't need background m_windowClass.lpszMenuName = NULL; // no menu m_windowClass.lpszClassName = "GLClass"; m_windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO); // windows logo small icon // register the windows class if (!RegisterClassEx(&m_windowClass)) { return false; } if (m_isFullscreen) //If we are fullscreen, we need to change the display mode { DEVMODE dmScreenSettings; // device mode memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); dmScreenSettings.dmSize = sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = width; // screen width dmScreenSettings.dmPelsHeight = height; // screen height dmScreenSettings.dmBitsPerPel = bpp; // bits per pixel dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { // setting display mode failed, switch to windowed MessageBox(NULL, "Display mode failed", NULL, MB_OK); m_isFullscreen = false; } } if (m_isFullscreen) // Are We Still In Fullscreen Mode? { dwExStyle = WS_EX_APPWINDOW; // Window Extended Style dwStyle = WS_POPUP; // Windows Style ShowCursor(false); // Hide Mouse Pointer } else { dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window Extended Style dwStyle = WS_OVERLAPPEDWINDOW; // Windows Style } AdjustWindowRectEx(&m_windowRect, dwStyle, false, dwExStyle); // Adjust Window To True Requested Size // class registered, so now create our window m_hwnd = CreateWindowEx(NULL, // extended style "GLClass", // class name "BOGLGP - Chapter 3 - Lines", // app name dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, // x,y coordinate m_windowRect.right - m_windowRect.left, m_windowRect.bottom - m_windowRect.top, // width, height NULL, // handle to parent NULL, // handle to menu m_hinstance, // application instance this); // we pass a pointer to the GLWindow here // check if window creation failed (hwnd would equal NULL) if (!m_hwnd) return 0; m_hdc = GetDC(m_hwnd); ShowWindow(m_hwnd, SW_SHOW); // display the window UpdateWindow(m_hwnd); // update the window m_lastTime = GetTickCount() / 1000.0f; //Initialize the time return true; } void GLWindow::destroy() { if (m_isFullscreen) { ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop ShowCursor(true); // Show Mouse Pointer } } void GLWindow::attachExample(Example* example) { m_example = example; } bool GLWindow::isRunning() { return m_isRunning; } void GLWindow::processEvents() { MSG msg; //While there are messages in the queue, store them in msg while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { //Process the messages one-by-one TranslateMessage(&msg); DispatchMessage(&msg); } } void GLWindow::setupPixelFormat(void) { int pixelFormat; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size 1, // version PFD_SUPPORT_OPENGL | // OpenGL window PFD_DRAW_TO_WINDOW | // render to window PFD_DOUBLEBUFFER, // support double-buffering PFD_TYPE_RGBA, // color type 32, // prefered color depth 0, 0, 0, 0, 0, 0, // color bits (ignored) 0, // no alpha buffer 0, // alpha bits (ignored) 0, // no accumulation buffer 0, 0, 0, 0, // accum bits (ignored) 16, // depth buffer 0, // no stencil buffer 0, // no auxiliary buffers PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0, // no layer, visible, damage masks }; pixelFormat = ChoosePixelFormat(m_hdc, &pfd); SetPixelFormat(m_hdc, pixelFormat, &pfd); } LRESULT GLWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_CREATE: // window creation { m_hdc = GetDC(hWnd); setupPixelFormat(); //Set the version that we want, in this case 3.0 int attribs[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, WGL_CONTEXT_MINOR_VERSION_ARB, 0, 0}; //zero indicates the end of the array //Create temporary context so we can get a pointer to the function HGLRC tmpContext = wglCreateContext(m_hdc); //Make it current wglMakeCurrent(m_hdc, tmpContext); //Get the function pointer wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB"); //If this is NULL then OpenGL 3.0 is not supported if (!wglCreateContextAttribsARB) { std::cerr << "OpenGL 3.0 is not supported, falling back to GL 2.1" << std::endl; m_hglrc = tmpContext; } else { // Create an OpenGL 3.0 context using the new function m_hglrc = wglCreateContextAttribsARB(m_hdc, 0, attribs); //Delete the temporary context wglDeleteContext(tmpContext); } //Make the GL3 context current wglMakeCurrent(m_hdc, m_hglrc); m_isRunning = true; //Mark our window as running } break; case WM_DESTROY: // window destroy case WM_CLOSE: // windows is closing wglMakeCurrent(m_hdc, NULL); wglDeleteContext(m_hglrc); m_isRunning = false; //Stop the main loop PostQuitMessage(0); //Send a WM_QUIT message return 0; break; case WM_SIZE: { int height = HIWORD(lParam); // retrieve width and height int width = LOWORD(lParam); getAttachedExample()->onResize(width, height); //Call the example's resize method } break; case WM_KEYDOWN: if (wParam == VK_ESCAPE) //If the escape key was pressed { DestroyWindow(m_hwnd); //Send a WM_DESTROY message } break; default: break; } return DefWindowProc(hWnd, uMsg, wParam, lParam); } LRESULT CALLBACK GLWindow::StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { GLWindow* window = NULL; //If this is the create message if(uMsg == WM_CREATE) { //Get the pointer we stored during create window = (GLWindow*)((LPCREATESTRUCT)lParam)->lpCreateParams; //Associate the window pointer with the hwnd for the other events to access SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG_PTR)window); } else { //If this is not a creation event, then we should have stored a pointer to the window window = (GLWindow*)GetWindowLongPtr(hWnd, GWL_USERDATA); if(!window) { return DefWindowProc(hWnd, uMsg, wParam, lParam); } } //Call our window's member WndProc (allows us to access member variables) return window->WndProc(hWnd, uMsg, wParam, lParam); } float GLWindow::getElapsedSeconds() { float currentTime = float(GetTickCount()) / 1000.0f; float seconds = float(currentTime - m_lastTime); m_lastTime = currentTime; return seconds; }
[ "alex.handby@gmail.com" ]
alex.handby@gmail.com
cab7c242fe920af9118ad8897f65c41de3cf8620
088deb3c9b0f6365a813b0c6a87d33e67ffb916c
/base/hyperneat/HyperNEAT/Hypercube_NEAT/include/Experiments/HCUBE_CheckersExperimentOriginalFogel.h
dcae029b543a06d5d94c27498e8ee9cdef86af9e
[]
no_license
CreativeMachinesLab/softbotEscape
d47b0cb416bfb489af2f73e31ddb9b7d126249b9
e552c8dff2a95ab9b9b64065deda2102ff9f2388
refs/heads/master
2021-01-01T15:37:01.484182
2015-04-27T10:25:32
2015-04-27T10:25:32
34,642,315
3
1
null
null
null
null
UTF-8
C++
false
false
1,100
h
#ifndef HCUBE_CHECKERSEXPERIMENTORIGINALFOGEL_H_INCLUDED #define HCUBE_CHECKERSEXPERIMENTORIGINALFOGEL_H_INCLUDED #include "Experiments/HCUBE_Experiment.h" #include "Experiments/HCUBE_CheckersCommon.h" #include "Experiments/HCUBE_CheckersExperiment.h" namespace HCUBE { class CheckersExperimentOriginalFogel : public CheckersExperiment { public: protected: public: CheckersExperimentOriginalFogel(string _experimentName); virtual ~CheckersExperimentOriginalFogel() {} virtual NEAT::GeneticPopulation* createInitialPopulation(int populationSize); virtual void generateSubstrate(int substrateNum=0); virtual void populateSubstrate( shared_ptr<const NEAT::GeneticIndividual> individual, int substrateNum=0 ); virtual CheckersNEATDatatype evaluateLeafHyperNEAT(uchar b[8][8]); virtual CheckersNEATDatatype getSpatialInput(uchar b[8][8],int x,int y,int sizex,int sizey); virtual Experiment* clone(); }; } #endif // HCUBE_CHECKERSEXPERIMENTORIGINALFOGEL_H_INCLUDED
[ "nac93@cornell.edu" ]
nac93@cornell.edu
1cd94061cea2fe4d1daa82d6d860335105ba20f0
855ca9e93e9bf15fde74fe66c1991920605011e4
/video/GLX11Screen.cpp
c44d81e58bafcf7b2c4c6952b9e1a04ec62b4c4e
[ "SGI-B-1.1", "BSD-2-Clause" ]
permissive
szk/reprize
0526959a4affa87ec926c31b7f71c3f925c9a470
a827aa0247f7954f9f36ae573f97db1397645bf5
refs/heads/master
2016-09-06T01:53:33.862334
2016-01-28T15:09:33
2016-01-28T15:09:33
11,900,571
0
1
null
null
null
null
UTF-8
C++
false
false
15,166
cpp
#include "Common.hpp" #include "misc/X11DepInfo.hpp" #include "GLX11Screen.hpp" using namespace reprize; using namespace vid; Int32 sb_config[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_RED_SIZE, 0, GLX_BLUE_SIZE, 0, GLX_GREEN_SIZE, 0, None }; Int32 db_config[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_RED_SIZE, 0, GLX_BLUE_SIZE, 0, GLX_GREEN_SIZE, 0, GLX_DOUBLEBUFFER, None }; PFNGLATTACHSHADERPROC glAttachShader; PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation; PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate; PFNGLCOMPILESHADERPROC glCompileShader; PFNGLCREATEPROGRAMPROC glCreateProgram; PFNGLCREATESHADERPROC glCreateShader; PFNGLDELETEPROGRAMPROC glDeleteProgram; PFNGLDELETESHADERPROC glDeleteShader; PFNGLDETACHSHADERPROC glDetachShader; PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray; PFNGLDRAWBUFFERSPROC glDrawBuffers; PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib; PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform; PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders; PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation; PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; PFNGLGETPROGRAMIVPROC glGetProgramiv; PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; PFNGLGETSHADERIVPROC glGetShaderiv; PFNGLGETSHADERSOURCEPROC glGetShaderSource; PFNGLGETUNIFORMFVPROC glGetUniformfv; PFNGLGETUNIFORMIVPROC glGetUniformiv; PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; PFNGLGETVERTEXATTRIBDVPROC glGetVertexAttribdv; PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv; PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv; PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv; PFNGLISPROGRAMPROC glIsProgram; PFNGLISSHADERPROC glIsShader; PFNGLLINKPROGRAMPROC glLinkProgram; PFNGLSHADERSOURCEPROC glShaderSource; PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate; PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate; PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate; PFNGLUNIFORM1FPROC glUniform1f; PFNGLUNIFORM1FVPROC glUniform1fv; PFNGLUNIFORM1IPROC glUniform1i; PFNGLUNIFORM1IVPROC glUniform1iv; PFNGLUNIFORM2FPROC glUniform2f; PFNGLUNIFORM2FVPROC glUniform2fv; PFNGLUNIFORM2IPROC glUniform2i; PFNGLUNIFORM2IVPROC glUniform2iv; PFNGLUNIFORM3FPROC glUniform3f; PFNGLUNIFORM3FVPROC glUniform3fv; PFNGLUNIFORM3IPROC glUniform3i; PFNGLUNIFORM3IVPROC glUniform3iv; PFNGLUNIFORM4FPROC glUniform4f; PFNGLUNIFORM4FVPROC glUniform4fv; PFNGLUNIFORM4IPROC glUniform4i; PFNGLUNIFORM4IVPROC glUniform4iv; PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv; PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv; PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv; PFNGLUSEPROGRAMPROC glUseProgram; PFNGLVALIDATEPROGRAMPROC glValidateProgram; PFNGLVERTEXATTRIB1DPROC glVertexAttrib1d; PFNGLVERTEXATTRIB1DVPROC glVertexAttrib1dv; PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f; PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv; PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s; PFNGLVERTEXATTRIB1SVPROC glVertexAttrib1sv; PFNGLVERTEXATTRIB2DPROC glVertexAttrib2d; PFNGLVERTEXATTRIB2DVPROC glVertexAttrib2dv; PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f; PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv; PFNGLVERTEXATTRIB2SPROC glVertexAttrib2s; PFNGLVERTEXATTRIB2SVPROC glVertexAttrib2sv; PFNGLVERTEXATTRIB3DPROC glVertexAttrib3d; PFNGLVERTEXATTRIB3DVPROC glVertexAttrib3dv; PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f; PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv; PFNGLVERTEXATTRIB3SPROC glVertexAttrib3s; PFNGLVERTEXATTRIB3SVPROC glVertexAttrib3sv; PFNGLVERTEXATTRIB4BVPROC glVertexAttrib4bv; PFNGLVERTEXATTRIB4DPROC glVertexAttrib4d; PFNGLVERTEXATTRIB4DVPROC glVertexAttrib4dv; PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f; PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv; PFNGLVERTEXATTRIB4IVPROC glVertexAttrib4iv; PFNGLVERTEXATTRIB4NBVPROC glVertexAttrib4Nbv; PFNGLVERTEXATTRIB4NIVPROC glVertexAttrib4Niv; PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv; PFNGLVERTEXATTRIB4NUBPROC glVertexAttrib4Nub; PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv; PFNGLVERTEXATTRIB4NUIVPROC glVertexAttrib4Nuiv; PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv; PFNGLVERTEXATTRIB4SPROC glVertexAttrib4s; PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv; PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv; PFNGLVERTEXATTRIB4UIVPROC glVertexAttrib4uiv; PFNGLVERTEXATTRIB4USVPROC glVertexAttrib4usv; PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer; GLX11Screen::GLX11Screen(X11DepInfo* depinfo_) : Screen(depinfo_), x11_info(depinfo_), vi(NULL), sz_hints(NULL), wm_hints(NULL), doublebuffer(false) { if (!(sz_hints = XAllocSizeHints())) { g_log->printf("Could not alloc XSizeHints"); } if (!(wm_hints = XAllocWMHints())) { g_log->printf("Could not alloc XWMHints"); } } GLX11Screen::~GLX11Screen(void) { XFree(vi); XFree(sz_hints); XFree(wm_hints); } void GLX11Screen::init(void) { Int32 dummy; if (!glXQueryExtension(x11_info->get_dpy(), &dummy, &dummy)) { g_log->printf("Can't get query extension"); g_log->printf("X server doesn't have glx extension"); return; } if ((vi = glXChooseVisual(x11_info->get_dpy(), x11_info->get_scr(), db_config))) { doublebuffer = true; } else if ((vi = glXChooseVisual(x11_info->get_dpy(), x11_info->get_scr(), sb_config))) { doublebuffer = false; } else { g_log->printf("No RGB visual with depth buffer"); return; } GLXContext cx; // if (!(cx = glXCreateContext(x11_info->get_dpy(), vi, None, GL_FALSE))) // { g_log->printf("Could not create rendering context"); } if (!(cx = glXCreateContext(x11_info->get_dpy(), vi, None, GL_TRUE))) { g_log->printf("Could not create rendering context"); } Colormap cmap; cmap = XCreateColormap(x11_info->get_dpy(), RootWindow(x11_info->get_dpy(), vi->screen), vi->visual, AllocNone); XSetWindowAttributes win_att; win_att.colormap = cmap; win_att.border_pixel = 0; win_att.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask; sz_hints->flags = USSize | USPosition | PMaxSize | PMinSize | PBaseSize; sz_hints->base_width = SCREEN_WIDTH; sz_hints->base_height = SCREEN_HEIGHT; sz_hints->min_width = SCREEN_WIDTH; sz_hints->min_height = SCREEN_HEIGHT; sz_hints->max_width = SCREEN_WIDTH; sz_hints->max_height = SCREEN_HEIGHT; x11_info->set_win(XCreateWindow(x11_info->get_dpy(), RootWindow(x11_info->get_dpy(), vi->screen), 0, 0, sz_hints->base_width, sz_hints->base_height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &win_att)); XSetStandardProperties(x11_info->get_dpy(), x11_info->get_win(), TITLE, TITLE, None, x11_info->get_argv(), x11_info->get_argc(), sz_hints); wm_hints->initial_state = NormalState; wm_hints->flags = StateHint; XSetWMHints(x11_info->get_dpy(), x11_info->get_win(), wm_hints); XSelectInput(x11_info->get_dpy(), x11_info->get_win(), (ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask)); x11_info->set_del_atom(XInternAtom(x11_info->get_dpy(), "WM_DELETE_WINDOW", False)); XSetWMProtocols(x11_info->get_dpy(), x11_info->get_win(), x11_info->get_del_atom(), 1); glXMakeCurrent(x11_info->get_dpy(), x11_info->get_win(), cx); kill_cursor(); alloc_extension(); Screen::init(); } void GLX11Screen::appear(void) { //show the window XMapWindow(x11_info->get_dpy(), x11_info->get_win()); } void GLX11Screen::begin_paint(void) { } void GLX11Screen::finish_paint(void) { } const bool GLX11Screen::flip(void) { if (doublebuffer) { glXSwapBuffers(x11_info->get_dpy(), x11_info->get_win()); } else { glFlush(); } return true; } void GLX11Screen::release(void) { } #define PADDR(functype, funcname) \ ((funcname = (functype) glXGetProcAddress( #funcname )) == 0) const bool GLX11Screen::alloc_extension(void) { // XXX Str ext_str(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); // we need pbo or fbo or vbo, and shaders // std::cerr << ext_str << std::endl; int err = 0; // glXGetProcAddressARB #ifdef UNDEF err |= PADDR(PFNGLATTACHSHADERPROC, glAttachShader); err |= PADDR(PFNGLBINDATTRIBLOCATIONPROC, glBindAttribLocation); err |= PADDR(PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate); err |= PADDR(PFNGLCOMPILESHADERPROC, glCompileShader); err |= PADDR(PFNGLCREATEPROGRAMPROC, glCreateProgram); err |= PADDR(PFNGLCREATESHADERPROC, glCreateShader); err |= PADDR(PFNGLDELETEPROGRAMPROC, glDeleteProgram); err |= PADDR(PFNGLDELETESHADERPROC, glDeleteShader); err |= PADDR(PFNGLDETACHSHADERPROC, glDetachShader); err |= PADDR(PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray); err |= PADDR(PFNGLDRAWBUFFERSPROC, glDrawBuffers); err |= PADDR(PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray); err |= PADDR(PFNGLGETACTIVEATTRIBPROC, glGetActiveAttrib); err |= PADDR(PFNGLGETACTIVEUNIFORMPROC, glGetActiveUniform); err |= PADDR(PFNGLGETATTACHEDSHADERSPROC, glGetAttachedShaders); err |= PADDR(PFNGLGETATTRIBLOCATIONPROC, glGetAttribLocation); err |= PADDR(PFNGLGETPROGRAMINFOLOGPROC, glGetProgramInfoLog); err |= PADDR(PFNGLGETPROGRAMIVPROC, glGetProgramiv); err |= PADDR(PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog); err |= PADDR(PFNGLGETSHADERIVPROC, glGetShaderiv); err |= PADDR(PFNGLGETSHADERSOURCEPROC, glGetShaderSource); err |= PADDR(PFNGLGETUNIFORMFVPROC, glGetUniformfv); err |= PADDR(PFNGLGETUNIFORMIVPROC, glGetUniformiv); err |= PADDR(PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation); err |= PADDR(PFNGLGETVERTEXATTRIBDVPROC, glGetVertexAttribdv); err |= PADDR(PFNGLGETVERTEXATTRIBFVPROC, glGetVertexAttribfv); err |= PADDR(PFNGLGETVERTEXATTRIBIVPROC, glGetVertexAttribiv); err |= PADDR(PFNGLGETVERTEXATTRIBPOINTERVPROC, glGetVertexAttribPointerv); err |= PADDR(PFNGLISPROGRAMPROC, glIsProgram); err |= PADDR(PFNGLISSHADERPROC, glIsShader); err |= PADDR(PFNGLLINKPROGRAMPROC, glLinkProgram); err |= PADDR(PFNGLSHADERSOURCEPROC, glShaderSource); err |= PADDR(PFNGLSTENCILFUNCSEPARATEPROC, glStencilFuncSeparate); err |= PADDR(PFNGLSTENCILMASKSEPARATEPROC, glStencilMaskSeparate); err |= PADDR(PFNGLSTENCILOPSEPARATEPROC, glStencilOpSeparate); err |= PADDR(PFNGLUNIFORM1FPROC, glUniform1f); err |= PADDR(PFNGLUNIFORM1FVPROC, glUniform1fv); err |= PADDR(PFNGLUNIFORM1IPROC, glUniform1i); err |= PADDR(PFNGLUNIFORM1IVPROC, glUniform1iv); err |= PADDR(PFNGLUNIFORM2FPROC, glUniform2f); err |= PADDR(PFNGLUNIFORM2FVPROC, glUniform2fv); err |= PADDR(PFNGLUNIFORM2IPROC, glUniform2i); err |= PADDR(PFNGLUNIFORM2IVPROC, glUniform2iv); err |= PADDR(PFNGLUNIFORM3FPROC, glUniform3f); err |= PADDR(PFNGLUNIFORM3FVPROC, glUniform3fv); err |= PADDR(PFNGLUNIFORM3IPROC, glUniform3i); err |= PADDR(PFNGLUNIFORM3IVPROC, glUniform3iv); err |= PADDR(PFNGLUNIFORM4FPROC, glUniform4f); err |= PADDR(PFNGLUNIFORM4FVPROC, glUniform4fv); err |= PADDR(PFNGLUNIFORM4IPROC, glUniform4i); err |= PADDR(PFNGLUNIFORM4IVPROC, glUniform4iv); err |= PADDR(PFNGLUNIFORMMATRIX2FVPROC, glUniformMatrix2fv); err |= PADDR(PFNGLUNIFORMMATRIX3FVPROC, glUniformMatrix3fv); err |= PADDR(PFNGLUNIFORMMATRIX4FVPROC, glUniformMatrix4fv); err |= PADDR(PFNGLUSEPROGRAMPROC, glUseProgram); err |= PADDR(PFNGLVALIDATEPROGRAMPROC, glValidateProgram); err |= PADDR(PFNGLVERTEXATTRIB1DPROC, glVertexAttrib1d); err |= PADDR(PFNGLVERTEXATTRIB1DVPROC, glVertexAttrib1dv); err |= PADDR(PFNGLVERTEXATTRIB1FPROC, glVertexAttrib1f); err |= PADDR(PFNGLVERTEXATTRIB1FVPROC, glVertexAttrib1fv); err |= PADDR(PFNGLVERTEXATTRIB1SPROC, glVertexAttrib1s); err |= PADDR(PFNGLVERTEXATTRIB1SVPROC, glVertexAttrib1sv); err |= PADDR(PFNGLVERTEXATTRIB2DPROC, glVertexAttrib2d); err |= PADDR(PFNGLVERTEXATTRIB2DVPROC, glVertexAttrib2dv); err |= PADDR(PFNGLVERTEXATTRIB2FPROC, glVertexAttrib2f); err |= PADDR(PFNGLVERTEXATTRIB2FVPROC, glVertexAttrib2fv); err |= PADDR(PFNGLVERTEXATTRIB2SPROC, glVertexAttrib2s); err |= PADDR(PFNGLVERTEXATTRIB2SVPROC, glVertexAttrib2sv); err |= PADDR(PFNGLVERTEXATTRIB3DPROC, glVertexAttrib3d); err |= PADDR(PFNGLVERTEXATTRIB3DVPROC, glVertexAttrib3dv); err |= PADDR(PFNGLVERTEXATTRIB3FPROC, glVertexAttrib3f); err |= PADDR(PFNGLVERTEXATTRIB3FVPROC, glVertexAttrib3fv); err |= PADDR(PFNGLVERTEXATTRIB3SPROC, glVertexAttrib3s); err |= PADDR(PFNGLVERTEXATTRIB3SVPROC, glVertexAttrib3sv); err |= PADDR(PFNGLVERTEXATTRIB4BVPROC, glVertexAttrib4bv); err |= PADDR(PFNGLVERTEXATTRIB4DPROC, glVertexAttrib4d); err |= PADDR(PFNGLVERTEXATTRIB4DVPROC, glVertexAttrib4dv); err |= PADDR(PFNGLVERTEXATTRIB4FPROC, glVertexAttrib4f); err |= PADDR(PFNGLVERTEXATTRIB4FVPROC, glVertexAttrib4fv); err |= PADDR(PFNGLVERTEXATTRIB4IVPROC, glVertexAttrib4iv); err |= PADDR(PFNGLVERTEXATTRIB4NBVPROC, glVertexAttrib4Nbv); err |= PADDR(PFNGLVERTEXATTRIB4NIVPROC, glVertexAttrib4Niv); err |= PADDR(PFNGLVERTEXATTRIB4NSVPROC, glVertexAttrib4Nsv); err |= PADDR(PFNGLVERTEXATTRIB4NUBPROC, glVertexAttrib4Nub); err |= PADDR(PFNGLVERTEXATTRIB4NUBVPROC, glVertexAttrib4Nubv); err |= PADDR(PFNGLVERTEXATTRIB4NUIVPROC, glVertexAttrib4Nuiv); err |= PADDR(PFNGLVERTEXATTRIB4NUSVPROC, glVertexAttrib4Nusv); err |= PADDR(PFNGLVERTEXATTRIB4SPROC, glVertexAttrib4s); err |= PADDR(PFNGLVERTEXATTRIB4SVPROC, glVertexAttrib4sv); err |= PADDR(PFNGLVERTEXATTRIB4UBVPROC, glVertexAttrib4ubv); err |= PADDR(PFNGLVERTEXATTRIB4UIVPROC, glVertexAttrib4uiv); err |= PADDR(PFNGLVERTEXATTRIB4USVPROC, glVertexAttrib4usv); err |= PADDR(PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer); #endif return false; } void GLX11Screen::kill_cursor(void) { static Cursor empty_cursor = static_cast<Cursor>(NULL); if (empty_cursor == static_cast<Cursor>(NULL)) { static char bits[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; Pixmap pm = XCreateBitmapFromData(x11_info->get_dpy(), x11_info->get_win(), bits, 8, 8); XColor color; color.pixel = color.red = color.green = color.blue = 0; color.flags = DoGreen | DoRed | DoBlue; empty_cursor = XCreatePixmapCursor(x11_info->get_dpy(), pm, pm, &color, &color, 0, 0); } XDefineCursor(x11_info->get_dpy(), x11_info->get_win(), empty_cursor); }
[ "s@vram.org" ]
s@vram.org
4845247a17fe6f981c7739667eb353b23c7e1f5e
afc255608753ab472bb0c8d953fb0361bc4ab635
/BLUE_ENGINE/Object.cpp
6b3187495c23c34c04b2e1ee19675251cb8e5973
[]
no_license
Nero-TheThrill/-Game-waybackhome_built-with-customengine
23e8e9866c5e822ed6c507232a9ca25e4a7746ad
70beab0fb81c203701a143244d65aff89b08d104
refs/heads/master
2023-08-21T03:02:28.904343
2021-11-02T11:01:50
2021-11-02T11:01:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,114
cpp
/* * File Name : Object.cpp * Primary Author : Choi Jinwoo * Secondary Author : Park Jinwon, Hyun Jina * Brief: Components will be add in this class. * * Copyright (C) 2019 DigiPen Institute of Technology. */ #include"Object.h" #include <cassert> #include "ObjectFactory.h" #include <iostream> #include "Graphics.h" namespace BLUE { Object::Object() { objectID = 0; objType = ObjectType_NULL; shapeType = ShapeType_NULL; transform = nullptr; sprite = nullptr; collision = nullptr; line = nullptr; circle = nullptr; rectangle = nullptr; rigidbody = nullptr; spritetext = nullptr; obb = nullptr; allocatedchart.clear(); allocatedchart[SPRITE] = false; allocatedchart[COLLISION] = false; allocatedchart[RIGIDBODY] = false; allocatedchart[TRANSFORM] = false; allocatedchart[LINE] = false; allocatedchart[CIRCLE] = false; allocatedchart[RECTANGLE] = false; allocatedchart[SPRITETEXT] = false; allocatedchart[OBB] = false; } Object::~Object() { //delete the pointer of components that allocated /* delete particle; particle = nullptr; delete transform; transform = nullptr; delete sprite; sprite = nullptr; delete collision; collision = nullptr; delete line; line = nullptr; delete circle; circle = nullptr; delete rectangle; rectangle = nullptr;*/ } void Object::Init() { //call Init() function for all existing pointer if (transform != nullptr) transform->Init(); if (sprite != nullptr) sprite->Init(); if (collision != nullptr) collision->Init(); if (line != nullptr) line->Init(); if (circle != nullptr) circle->Init(); if (rectangle != nullptr) rectangle->Init(); if (rigidbody != nullptr) rigidbody->Init(); if (spritetext != nullptr) spritetext->Init(); if (obb != nullptr) obb->Init(); } void Object::Destroy(Object* obj) { //std::cout << "Destroy called" << std::endl; OBJECT_FACTORY->Destroy(obj); } bool Object::AddComponent(Component* component) { //<example of using this function> //component_transform=dynamic_cast<Transform*>(component); component->SetOwner(this); switch (component->GetComponentType()) { case ComponentType_SPRITE: sprite = dynamic_cast<Sprite*>(component); GRAPHICS->AddSprite(sprite); allocatedchart[SPRITE]= true; return true; case ComponentType_COLLISION: collision = dynamic_cast<Collision*>(component); allocatedchart[COLLISION] = true; return true; case ComponentType_RIGIDBODY: rigidbody = dynamic_cast<Rigidbody*>(component); allocatedchart[RIGIDBODY] = true; return true; case ComponentType_TRANSFORM: transform = dynamic_cast<Transform*>(component); allocatedchart[TRANSFORM] = true; return true; case ComponentType_LINE: line = dynamic_cast<Line2D*>(component); allocatedchart[LINE] = true; return true; case ComponentType_CIRCLE: circle = dynamic_cast<Circle*>(component); allocatedchart[CIRCLE] = true; return true; case ComponentType_RECTANGLE: rectangle = dynamic_cast<Rectangle*>(component); allocatedchart[RECTANGLE] = true; return true; case ComponentType_SPRITETEXT: spritetext = dynamic_cast<SpriteText*>(component); allocatedchart[SPRITETEXT] = true; return true; case ComponentType_OBB: obb = dynamic_cast<OBB_Collision*>(component); allocatedchart[OBB] = true; return true; default: assert(!"Can't add an unknown component"); break; } return false; } Component* Object::GetComponent(ComponentType ctype) {//<example of using this function> switch (ctype) { case ComponentType_TRANSFORM: return transform; case ComponentType_SPRITE: return sprite; case ComponentType_COLLISION: return collision; case ComponentType_LINE: return line; case ComponentType_CIRCLE: return circle; case ComponentType_RECTANGLE: return rectangle; case ComponentType_RIGIDBODY: return rigidbody; case ComponentType_SPRITETEXT: return spritetext; case ComponentType_OBB: return obb; default: assert(!"Can't get an unknown component"); } return nullptr; } }
[ "imjinwoo98@gmail.com" ]
imjinwoo98@gmail.com
76593f5604a80c025231badd951dae9454b7b022
a62342d6359a88b0aee911e549a4973fa38de9ea
/0.6.0.3/Internal/SDK/BP_Chroma_classes.h
071ff38108ac68335ab834eb39e1d21a32f725fb
[]
no_license
zanzo420/Medieval-Dynasty-SDK
d020ad634328ee8ee612ba4bd7e36b36dab740ce
d720e49ae1505e087790b2743506921afb28fc18
refs/heads/main
2023-06-20T03:00:17.986041
2021-07-15T04:51:34
2021-07-15T04:51:34
386,165,085
0
0
null
null
null
null
UTF-8
C++
false
false
8,905
h
#pragma once // Name: Medieval Dynasty, Version: 0.6.0.3 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BP_Chroma.BP_Chroma_C // 0x00E0 (FullSize[0x0300] - InheritedSize[0x0220]) class ABP_Chroma_C : public AActor { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x0220(0x0008) (ZeroConstructor, Transient, DuplicateTransient, UObjectWrapper) class USceneComponent* DefaultSceneRoot; // 0x0228(0x0008) (BlueprintVisible, ZeroConstructor, InstancedReference, IsPlainOldData, NonTransactional, NoDestructor, UObjectWrapper, HasGetValueTypeHash) int MainID; // 0x0230(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int HealthBarID; // 0x0234(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int FoodBarID; // 0x0238(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int WaterBarID; // 0x023C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int QuickslotBarID; // 0x0240(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int HealthAnimChoicer; // 0x0244(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int FoodAnimChoicer; // 0x0248(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int WaterAnimChoicer; // 0x024C(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int HealthThreshold; // 0x0250(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int FoodThreshold; // 0x0254(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) int WaterThreshold; // 0x0258(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) unsigned char UnknownData_SK4S[0x4]; // 0x025C(0x0004) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) TArray<TEnumAsByte<ChromaSDKPlugin_EChromaSDKKeyboardKey>> HealthBarKeys; // 0x0260(0x0010) (Edit, BlueprintVisible, DisableEditOnInstance) TArray<TEnumAsByte<ChromaSDKPlugin_EChromaSDKKeyboardKey>> FoodBarKeys; // 0x0270(0x0010) (Edit, BlueprintVisible, DisableEditOnInstance) TArray<TEnumAsByte<ChromaSDKPlugin_EChromaSDKKeyboardKey>> WaterBarKeys; // 0x0280(0x0010) (Edit, BlueprintVisible, DisableEditOnInstance) TArray<TEnumAsByte<ChromaSDKPlugin_EChromaSDKKeyboardKey>> QuickslotBarKeys; // 0x0290(0x0010) (Edit, BlueprintVisible, DisableEditOnInstance) struct FLinearColor InactiveKeyColor; // 0x02A0(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) struct FLinearColor BackgroundColor; // 0x02B0(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) struct FLinearColor EquippedColor; // 0x02C0(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) struct FLinearColor SelectedColor; // 0x02D0(0x0010) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) bool HealthUpdate; // 0x02E0(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) bool FoodUpdate; // 0x02E1(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) bool WaterUpdate; // 0x02E2(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) bool ShowBars; // 0x02E3(0x0001) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor) float AnimEffectTimer; // 0x02E4(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) float AnimTickTimer; // 0x02E8(0x0004) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) unsigned char UnknownData_Q67K[0x4]; // 0x02EC(0x0004) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) class APC_Player_C* PCPlayerReference; // 0x02F0(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnTemplate, DisableEditOnInstance, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash) struct FName CurrentEffectRow; // 0x02F8(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData, NoDestructor, HasGetValueTypeHash) static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_Chroma.BP_Chroma_C"); return ptr; } void PrepareHealthFrames(); void PrepareFoodFrames(); void PrepareWaterFrames(); void UpdateQuickslots(); void CheckIfWaterUpdateNeeded(float water); void CheckIfFoodUpdateNeeded(float Food); void CheckIfHealthUpdateNeeded(float Health); void HandleInactiveKeys(int Animation_ID, TArray<TEnumAsByte<ChromaSDKPlugin_EChromaSDKKeyboardKey>>* Keys, int Threshold); void UpdateChromaAnimationEffect(); void UpdateChromaAnimation(); void InitChromaHealthBar(float Health_Percentage); void InitChromaFoodBar(float Food_Percentage); void InitChromaWaterBar(float Water_Percentage); void ReceiveBeginPlay(); void UpdateChromaWaterBar(float Water_Percentage); void UpdateQuickslotBar(); void BindChromaQuickslotEvent(class APC_Player_C* PCPlayerReference); void UpdateChromaFoodBar(float Food_Percentage); void ChromaHitEffect(TEnumAsByte<E_DamageType_E_DamageType> Damage_Type); void ReceiveTick(float DeltaSeconds); void UpdateChromaHealthBar(float Health_Percentage); void InitChromaBars(); void ExecuteUbergraph_BP_Chroma(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "zp2kshield@gmail.com" ]
zp2kshield@gmail.com
ef71d5da8d5ec09037011191d2b6ac7023424cb3
fbbc663c607c9687452fa3192b02933b9eb3656d
/branches/OpenMPT-1.24/soundlib/Mmcmp.cpp
751833f59f94523a34137322a48f2418749c669f
[ "BSD-3-Clause" ]
permissive
svn2github/OpenMPT
594837f3adcb28ba92a324e51c6172a8c1e8ea9c
a2943f028d334a8751b9f16b0512a5e0b905596a
refs/heads/master
2021-07-10T05:07:18.298407
2019-01-19T10:27:21
2019-01-19T10:27:21
106,434,952
2
1
null
null
null
null
UTF-8
C++
false
false
19,175
cpp
/* * mmcmp.cpp * --------- * Purpose: Handling of compressed modules (MMCMP, XPK, PowerPack PP20) * Notes : (currently none) * Authors: Olivier Lapicque * OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #include "stdafx.h" #include "Sndfile.h" #include "../common/FileReader.h" #include <stdexcept> OPENMPT_NAMESPACE_BEGIN //#define MMCMP_LOG #ifdef NEEDS_PRAGMA_PACK #pragma pack(push, 1) #endif struct PACKED MMCMPFILEHEADER { char id[8]; // "ziRCONia" uint16 hdrsize; void ConvertEndianness(); }; STATIC_ASSERT(sizeof(MMCMPFILEHEADER) == 10); struct PACKED MMCMPHEADER { uint16 version; uint16 nblocks; uint32 filesize; uint32 blktable; uint8 glb_comp; uint8 fmt_comp; void ConvertEndianness(); }; STATIC_ASSERT(sizeof(MMCMPHEADER) == 14); struct PACKED MMCMPBLOCK { uint32 unpk_size; uint32 pk_size; uint32 xor_chk; uint16 sub_blk; uint16 flags; uint16 tt_entries; uint16 num_bits; void ConvertEndianness(); }; STATIC_ASSERT(sizeof(MMCMPBLOCK) == 20); struct PACKED MMCMPSUBBLOCK { uint32 unpk_pos; uint32 unpk_size; void ConvertEndianness(); }; STATIC_ASSERT(sizeof(MMCMPSUBBLOCK) == 8); #ifdef NEEDS_PRAGMA_PACK #pragma pack(pop) #endif void MMCMPFILEHEADER::ConvertEndianness() //--------------------------------------- { SwapBytesLE(hdrsize); } void MMCMPHEADER::ConvertEndianness() //----------------------------------- { SwapBytesLE(version); SwapBytesLE(nblocks); SwapBytesLE(filesize); SwapBytesLE(blktable); SwapBytesLE(glb_comp); SwapBytesLE(fmt_comp); } void MMCMPBLOCK::ConvertEndianness() //---------------------------------- { SwapBytesLE(unpk_size); SwapBytesLE(pk_size); SwapBytesLE(xor_chk); SwapBytesLE(sub_blk); SwapBytesLE(flags); SwapBytesLE(tt_entries); SwapBytesLE(num_bits); } void MMCMPSUBBLOCK::ConvertEndianness() //------------------------------------- { SwapBytesLE(unpk_pos); SwapBytesLE(unpk_size); } #define MMCMP_COMP 0x0001 #define MMCMP_DELTA 0x0002 #define MMCMP_16BIT 0x0004 #define MMCMP_STEREO 0x0100 #define MMCMP_ABS16 0x0200 #define MMCMP_ENDIAN 0x0400 struct MMCMPBITBUFFER { uint32 bitcount; uint32 bitbuffer; const uint8 *pSrc; const uint8 *pEnd; uint32 GetBits(uint32 nBits); }; uint32 MMCMPBITBUFFER::GetBits(uint32 nBits) //------------------------------------------ { uint32 d; if (!nBits) return 0; while (bitcount < 24) { bitbuffer |= ((pSrc < pEnd) ? *pSrc++ : 0) << bitcount; bitcount += 8; } d = bitbuffer & ((1 << nBits) - 1); bitbuffer >>= nBits; bitcount -= nBits; return d; } static const uint32 MMCMP8BitCommands[8] = { 0x01, 0x03, 0x07, 0x0F, 0x1E, 0x3C, 0x78, 0xF8 }; static const uint32 MMCMP8BitFetch[8] = { 3, 3, 3, 3, 2, 1, 0, 0 }; static const uint32 MMCMP16BitCommands[16] = { 0x01, 0x03, 0x07, 0x0F, 0x1E, 0x3C, 0x78, 0xF0, 0x1F0, 0x3F0, 0x7F0, 0xFF0, 0x1FF0, 0x3FF0, 0x7FF0, 0xFFF0 }; static const uint32 MMCMP16BitFetch[16] = { 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static bool MMCMP_IsDstBlockValid(const std::vector<char> &unpackedData, uint32 pos, uint32 len) //---------------------------------------------------------------------------------------------- { if(pos >= unpackedData.size()) return false; if(len > unpackedData.size()) return false; if(len > unpackedData.size() - pos) return false; return true; } static bool MMCMP_IsDstBlockValid(const std::vector<char> &unpackedData, const MMCMPSUBBLOCK &subblk) //--------------------------------------------------------------------------------------------------- { return MMCMP_IsDstBlockValid(unpackedData, subblk.unpk_pos, subblk.unpk_size); } bool UnpackMMCMP(std::vector<char> &unpackedData, FileReader &file) //----------------------------------------------------------------- { file.Rewind(); unpackedData.clear(); MMCMPFILEHEADER mfh; if(!file.ReadConvertEndianness(mfh)) return false; if(std::memcmp(mfh.id, "ziRCONia", 8) != 0) return false; if(mfh.hdrsize != sizeof(MMCMPHEADER)) return false; MMCMPHEADER mmh; if(!file.ReadConvertEndianness(mmh)) return false; if(mmh.nblocks == 0) return false; if(mmh.filesize == 0) return false; if(mmh.filesize > 0x80000000) return false; if(mmh.blktable > file.GetLength()) return false; if(mmh.blktable + 4 * mmh.nblocks > file.GetLength()) return false; unpackedData.resize(mmh.filesize); for (uint32 nBlock=0; nBlock<mmh.nblocks; nBlock++) { if(!file.Seek(mmh.blktable + 4*nBlock)) return false; if(!file.CanRead(4)) return false; uint32 blkPos = file.ReadUint32LE(); if(!file.Seek(blkPos)) return false; MMCMPBLOCK blk; if(!file.ReadConvertEndianness(blk)) return false; std::vector<MMCMPSUBBLOCK> subblks(blk.sub_blk); for(uint32 i=0; i<blk.sub_blk; ++i) { if(!file.ReadConvertEndianness(subblks[i])) return false; } MMCMPSUBBLOCK *psubblk = blk.sub_blk > 0 ? &(subblks[0]) : nullptr; if(blkPos + sizeof(MMCMPBLOCK) + blk.sub_blk * sizeof(MMCMPSUBBLOCK) >= file.GetLength()) return false; uint32 memPos = blkPos + sizeof(MMCMPBLOCK) + blk.sub_blk * sizeof(MMCMPSUBBLOCK); #ifdef MMCMP_LOG Log("block %d: flags=%04X sub_blocks=%d", nBlock, (uint32)pblk->flags, (uint32)pblk->sub_blk); Log(" pksize=%d unpksize=%d", pblk->pk_size, pblk->unpk_size); Log(" tt_entries=%d num_bits=%d\n", pblk->tt_entries, pblk->num_bits); #endif // Data is not packed if (!(blk.flags & MMCMP_COMP)) { for (uint32 i=0; i<blk.sub_blk; i++) { if(!MMCMP_IsDstBlockValid(unpackedData, *psubblk)) return false; #ifdef MMCMP_LOG Log(" Unpacked sub-block %d: offset %d, size=%d\n", i, psubblk->unpk_pos, psubblk->unpk_size); #endif if(!file.Seek(memPos)) return false; if(file.ReadRaw(&(unpackedData[psubblk->unpk_pos]), psubblk->unpk_size) != psubblk->unpk_size) return false; psubblk++; } } else // Data is 16-bit packed if (blk.flags & MMCMP_16BIT) { MMCMPBITBUFFER bb; uint32 subblk = 0; if(!MMCMP_IsDstBlockValid(unpackedData, psubblk[subblk])) return false; char *pDest = &(unpackedData[psubblk[subblk].unpk_pos]); uint32 dwSize = psubblk[subblk].unpk_size >> 1; uint32 dwPos = 0; uint32 numbits = blk.num_bits; uint32 oldval = 0; #ifdef MMCMP_LOG Log(" 16-bit block: pos=%d size=%d ", psubblk->unpk_pos, psubblk->unpk_size); if (pblk->flags & MMCMP_DELTA) Log("DELTA "); if (pblk->flags & MMCMP_ABS16) Log("ABS16 "); Log("\n"); #endif bb.bitcount = 0; bb.bitbuffer = 0; if(!file.Seek(memPos + blk.tt_entries)) return false; if(!file.CanRead(blk.pk_size - blk.tt_entries)) return false; bb.pSrc = reinterpret_cast<const uint8 *>(file.GetRawData()); bb.pEnd = reinterpret_cast<const uint8 *>(file.GetRawData() - blk.tt_entries + blk.pk_size); while (subblk < blk.sub_blk) { uint32 newval = 0x10000; uint32 d = bb.GetBits(numbits+1); if (d >= MMCMP16BitCommands[numbits]) { uint32 nFetch = MMCMP16BitFetch[numbits]; uint32 newbits = bb.GetBits(nFetch) + ((d - MMCMP16BitCommands[numbits]) << nFetch); if (newbits != numbits) { numbits = newbits & 0x0F; } else { if ((d = bb.GetBits(4)) == 0x0F) { if (bb.GetBits(1)) break; newval = 0xFFFF; } else { newval = 0xFFF0 + d; } } } else { newval = d; } if (newval < 0x10000) { newval = (newval & 1) ? (uint32)(-(int32)((newval+1) >> 1)) : (uint32)(newval >> 1); if (blk.flags & MMCMP_DELTA) { newval += oldval; oldval = newval; } else if (!(blk.flags & MMCMP_ABS16)) { newval ^= 0x8000; } pDest[dwPos*2 + 0] = (uint8)(((uint16)newval) & 0xff); pDest[dwPos*2 + 1] = (uint8)(((uint16)newval) >> 8); dwPos++; } if (dwPos >= dwSize) { subblk++; dwPos = 0; if(!(subblk < blk.sub_blk)) break; if(!MMCMP_IsDstBlockValid(unpackedData, psubblk[subblk])) return false; dwSize = psubblk[subblk].unpk_size >> 1; pDest = &(unpackedData[psubblk[subblk].unpk_pos]); } } } else // Data is 8-bit packed { MMCMPBITBUFFER bb; uint32 subblk = 0; if(!MMCMP_IsDstBlockValid(unpackedData, psubblk[subblk])) return false; char *pDest = &(unpackedData[psubblk[subblk].unpk_pos]); uint32 dwSize = psubblk[subblk].unpk_size; uint32 dwPos = 0; uint32 numbits = blk.num_bits; uint32 oldval = 0; if(!file.Seek(memPos)) return false; const uint8 *ptable = reinterpret_cast<const uint8 *>(file.GetRawData()); bb.bitcount = 0; bb.bitbuffer = 0; if(!file.Seek(memPos + blk.tt_entries)) return false; if(!file.CanRead(blk.pk_size - blk.tt_entries)) return false; bb.pSrc = reinterpret_cast<const uint8 *>(file.GetRawData()); bb.pEnd = reinterpret_cast<const uint8 *>(file.GetRawData() - blk.tt_entries + blk.pk_size); while (subblk < blk.sub_blk) { uint32 newval = 0x100; uint32 d = bb.GetBits(numbits+1); if (d >= MMCMP8BitCommands[numbits]) { uint32 nFetch = MMCMP8BitFetch[numbits]; uint32 newbits = bb.GetBits(nFetch) + ((d - MMCMP8BitCommands[numbits]) << nFetch); if (newbits != numbits) { numbits = newbits & 0x07; } else { if ((d = bb.GetBits(3)) == 7) { if (bb.GetBits(1)) break; newval = 0xFF; } else { newval = 0xF8 + d; } } } else { newval = d; } if (newval < 0x100) { int n = ptable[newval]; if (blk.flags & MMCMP_DELTA) { n += oldval; oldval = n; } pDest[dwPos++] = (uint8)n; } if (dwPos >= dwSize) { subblk++; dwPos = 0; if(!(subblk < blk.sub_blk)) break; if(!MMCMP_IsDstBlockValid(unpackedData, psubblk[subblk])) return false; dwSize = psubblk[subblk].unpk_size; pDest = &(unpackedData[psubblk[subblk].unpk_pos]); } } } } return true; } ///////////////////////////////////////////////////////////////////////////// // // XPK unpacker // #ifdef NEEDS_PRAGMA_PACK #pragma pack(push, 1) #endif struct PACKED XPKFILEHEADER { char XPKF[4]; uint32 SrcLen; char SQSH[4]; uint32 DstLen; char Name[16]; uint32 Reserved; void ConvertEndianness(); }; STATIC_ASSERT(sizeof(XPKFILEHEADER) == 36); #ifdef NEEDS_PRAGMA_PACK #pragma pack(pop) #endif void XPKFILEHEADER::ConvertEndianness() //------------------------------------- { SwapBytesBE(SrcLen); SwapBytesBE(DstLen); SwapBytesBE(Reserved); } struct XPK_BufferBounds { const uint8 *pSrcBeg; const uint8 *pSrcEnd; uint8 *pDstBeg; uint8 *pDstEnd; }; struct XPK_error : public std::range_error { XPK_error() : std::range_error("invalid XPK data") { } }; static int32 bfextu(const uint8 *p, int32 bo, int32 bc, XPK_BufferBounds &bufs) //----------------------------------------------------------------------------- { int32 r; p += bo / 8; if(p < bufs.pSrcBeg || p >= bufs.pSrcEnd) throw XPK_error(); r = *(p++); r <<= 8; if(p < bufs.pSrcBeg || p >= bufs.pSrcEnd) throw XPK_error(); r |= *(p++); r <<= 8; r |= *p; r <<= bo % 8; r &= 0xffffff; r >>= 24 - bc; return r; } static int32 bfexts(const uint8 *p, int32 bo, int32 bc, XPK_BufferBounds &bufs) //----------------------------------------------------------------------------- { int32 r; p += bo / 8; if(p < bufs.pSrcBeg || p >= bufs.pSrcEnd) throw XPK_error(); r = *(p++); r <<= 8; if(p < bufs.pSrcBeg || p >= bufs.pSrcEnd) throw XPK_error(); r |= *(p++); r <<= 8; r |= *p; r <<= (bo % 8) + 8; r >>= 32 - bc; return r; } static bool XPK_DoUnpack(const uint8 *src, uint32 srcLen, uint8 *dst, int32 len) //------------------------------------------------------------------------------ { if(len <= 0) return false; static const uint8 xpk_table[] = { 2,3,4,5,6,7,8,0,3,2,4,5,6,7,8,0,4,3,5,2,6,7,8,0,5,4,6,2,3,7,8,0,6,5,7,2,3,4,8,0,7,6,8,2,3,4,5,0,8,7,6,2,3,4,5,0 }; int32 d0,d1,d2,d3,d4,d5,d6,a2,a5; int32 cp, cup1, type; const uint8 *c; uint8 *phist = nullptr; uint8 *dstmax = dst + len; XPK_BufferBounds bufs; bufs.pSrcBeg = src; bufs.pSrcEnd = src + srcLen; bufs.pDstBeg = dst; bufs.pDstEnd = dst + len; c = src; while (len > 0) { if(&(c[0]) < bufs.pSrcBeg || &(c[0]) >= bufs.pSrcEnd) throw XPK_error(); if(&(c[7]) < bufs.pSrcBeg || &(c[7]) >= bufs.pSrcEnd) throw XPK_error(); type = c[0]; cp = (c[4]<<8) | (c[5]); // packed cup1 = (c[6]<<8) | (c[7]); // unpacked //Log(" packed=%6d unpacked=%6d bytes left=%d dst=%08X(%d)\n", cp, cup1, len, dst, dst); c += 8; src = c+2; if (type == 0) { // RAW chunk if(c < bufs.pSrcBeg || c >= bufs.pSrcEnd) throw XPK_error(); if(c + cp > bufs.pSrcEnd) throw XPK_error(); if(dst < bufs.pDstBeg || dst >= bufs.pDstEnd) throw XPK_error(); if(dst + cp > bufs.pDstEnd) throw XPK_error(); memcpy(dst,c,cp); dst+=cp; c+=cp; len -= cp; continue; } if (type != 1) { #ifdef MMCMP_LOG Log("Invalid XPK type! (%d bytes left)\n", len); #endif break; } len -= cup1; cp = (cp + 3) & 0xfffc; c += cp; d0 = d1 = d2 = a2 = 0; d3 = *(src++); if(dst < bufs.pDstBeg || dst >= bufs.pDstEnd) throw XPK_error(); *dst = (uint8)d3; if (dst < dstmax) dst++; cup1--; while (cup1 > 0) { if (d1 >= 8) goto l6dc; if (bfextu(src,d0,1,bufs)) goto l75a; d0 += 1; d5 = 0; d6 = 8; goto l734; l6dc: if (bfextu(src,d0,1,bufs)) goto l726; d0 += 1; if (! bfextu(src,d0,1,bufs)) goto l75a; d0 += 1; if (bfextu(src,d0,1,bufs)) goto l6f6; d6 = 2; goto l708; l6f6: d0 += 1; if (!bfextu(src,d0,1,bufs)) goto l706; d6 = bfextu(src,d0,3,bufs); d0 += 3; goto l70a; l706: d6 = 3; l708: d0 += 1; l70a: d6 = xpk_table[(8*a2) + d6 -17]; if (d6 != 8) goto l730; l718: if (d2 >= 20) { d5 = 1; goto l732; } d5 = 0; goto l734; l726: d0 += 1; d6 = 8; if (d6 == a2) goto l718; d6 = a2; l730: d5 = 4; l732: d2 += 8; l734: while ((d5 >= 0) && (cup1 > 0)) { d4 = bfexts(src,d0,d6,bufs); d0 += d6; d3 -= d4; if(dst < bufs.pDstBeg || dst >= bufs.pDstEnd) throw XPK_error(); *dst = (uint8)d3; if (dst < dstmax) dst++; cup1--; d5--; } if (d1 != 31) d1++; a2 = d6; l74c: d6 = d2; d6 >>= 3; d2 -= d6; } } return true; l75a: d0 += 1; if (bfextu(src,d0,1,bufs)) goto l766; d4 = 2; goto l79e; l766: d0 += 1; if (bfextu(src,d0,1,bufs)) goto l772; d4 = 4; goto l79e; l772: d0 += 1; if (bfextu(src,d0,1,bufs)) goto l77e; d4 = 6; goto l79e; l77e: d0 += 1; if (bfextu(src,d0,1,bufs)) goto l792; d0 += 1; d6 = bfextu(src,d0,3,bufs); d0 += 3; d6 += 8; goto l7a8; l792: d0 += 1; d6 = bfextu(src,d0,5,bufs); d0 += 5; d4 = 16; goto l7a6; l79e: d0 += 1; d6 = bfextu(src,d0,1,bufs); d0 += 1; l7a6: d6 += d4; l7a8: if (bfextu(src,d0,1,bufs)) goto l7c4; d0 += 1; if (bfextu(src,d0,1,bufs)) goto l7bc; d5 = 8; a5 = 0; goto l7ca; l7bc: d5 = 14; a5 = -0x1100; goto l7ca; l7c4: d5 = 12; a5 = -0x100; l7ca: d0 += 1; d4 = bfextu(src,d0,d5,bufs); d0 += d5; d6 -= 3; if (d6 >= 0) { if (d6 > 0) d1 -= 1; d1 -= 1; if (d1 < 0) d1 = 0; } d6 += 2; phist = dst + a5 - d4 - 1; while ((d6 >= 0) && (cup1 > 0)) { if(phist < bufs.pDstBeg || phist >= bufs.pDstEnd) throw XPK_error(); d3 = *phist++; if(dst < bufs.pDstBeg || dst >= bufs.pDstEnd) throw XPK_error(); *dst = (uint8)d3; if (dst < dstmax) dst++; cup1--; d6--; } goto l74c; } bool UnpackXPK(std::vector<char> &unpackedData, FileReader &file) //--------------------------------------------------------------- { file.Rewind(); unpackedData.clear(); XPKFILEHEADER header; if(!file.ReadConvertEndianness(header)) return false; if(std::memcmp(header.XPKF, "XPKF", 4) != 0) return false; if(std::memcmp(header.SQSH, "SQSH", 4) != 0) return false; if(header.SrcLen == 0) return false; if(header.DstLen == 0) return false; if(!file.CanRead(header.SrcLen + 8 - sizeof(XPKFILEHEADER))) return false; #ifdef MMCMP_LOG Log("XPK detected (SrcLen=%d DstLen=%d) filesize=%d\n", header.SrcLen, header.DstLen, file.GetLength()); #endif unpackedData.resize(header.DstLen); bool result = false; try { result = XPK_DoUnpack(reinterpret_cast<const uint8 *>(file.GetRawData()), header.SrcLen + 8 - sizeof(XPKFILEHEADER), reinterpret_cast<uint8 *>(&(unpackedData[0])), header.DstLen); } catch(XPK_error&) { return false; } return result; } ////////////////////////////////////////////////////////////////////////////// // // PowerPack PP20 Unpacker // static const uint32 PP20_PACKED_SIZE_MIN = 8; struct PPBITBUFFER { uint32 bitcount; uint32 bitbuffer; const uint8 *pStart; const uint8 *pSrc; uint32 GetBits(uint32 n); }; uint32 PPBITBUFFER::GetBits(uint32 n) //----------------------------------- { uint32 result = 0; for (uint32 i=0; i<n; i++) { if (!bitcount) { bitcount = 8; if (pSrc != pStart) pSrc--; bitbuffer = *pSrc; } result = (result<<1) | (bitbuffer&1); bitbuffer >>= 1; bitcount--; } return result; } static bool PP20_DoUnpack(const uint8 *pSrc, uint32 nSrcLen, uint8 *pDst, uint32 nDstLen) //--------------------------------------------------------------------------------------- { PPBITBUFFER BitBuffer; uint32 nBytesLeft; BitBuffer.pStart = pSrc; BitBuffer.pSrc = pSrc + nSrcLen - 4; BitBuffer.bitbuffer = 0; BitBuffer.bitcount = 0; BitBuffer.GetBits(pSrc[nSrcLen-1]); nBytesLeft = nDstLen; while (nBytesLeft > 0) { if (!BitBuffer.GetBits(1)) { uint32 n = 1; while (n < nBytesLeft) { uint32 code = BitBuffer.GetBits(2); n += code; if (code != 3) break; } for (uint32 i=0; i<n; i++) { pDst[--nBytesLeft] = (uint8)BitBuffer.GetBits(8); } if (!nBytesLeft) break; } { uint32 n = BitBuffer.GetBits(2)+1; if(n < 1 || n-1 >= nSrcLen) return false; uint32 nbits = pSrc[n-1]; uint32 nofs; if (n==4) { nofs = BitBuffer.GetBits( (BitBuffer.GetBits(1)) ? nbits : 7 ); while (n < nBytesLeft) { uint32 code = BitBuffer.GetBits(3); n += code; if (code != 7) break; } } else { nofs = BitBuffer.GetBits(nbits); } for (uint32 i=0; i<=n; i++) { pDst[nBytesLeft-1] = (nBytesLeft+nofs < nDstLen) ? pDst[nBytesLeft+nofs] : 0; if (!--nBytesLeft) break; } } } return true; } bool UnpackPP20(std::vector<char> &unpackedData, FileReader &file) //---------------------------------------------------------------- { file.Rewind(); unpackedData.clear(); if(!Util::TypeCanHoldValue<uint32>(file.GetLength())) return false; if(!file.CanRead(PP20_PACKED_SIZE_MIN)) return false; if(!file.ReadMagic("PP20")) return false; file.Seek(file.GetLength() - 4); uint32 dstLen = 0; dstLen |= file.ReadUint8() << 16; dstLen |= file.ReadUint8() << 8; dstLen |= file.ReadUint8() << 0; if(dstLen == 0) return false; unpackedData.resize(dstLen); file.Seek(4); bool result = PP20_DoUnpack(reinterpret_cast<const uint8 *>(file.GetRawData()), static_cast<uint32>(file.GetLength() - 4), reinterpret_cast<uint8 *>(&(unpackedData[0])), dstLen); return result; } OPENMPT_NAMESPACE_END
[ "manxorist@56274372-70c3-4bfc-bfc3-4c3a0b034d27" ]
manxorist@56274372-70c3-4bfc-bfc3-4c3a0b034d27
e0dac87779c1f9f76438f164f54895d5b156bd48
fea945b64253bb62e3512536f85b44eadd5a0186
/utils/testgen.hxx
e4ecd93a05f223f637c85f78f9978ccd403f3a6c
[ "MIT" ]
permissive
moskupols/image-labeling-benchmark
ec56e17f5d34cd0a0b1dc0ff21e69ea7310ddcb8
8babc97969ea7e557dd07acf98a6e2bcf7a7ee4a
refs/heads/master
2021-01-19T03:53:52.061757
2016-07-31T22:10:43
2016-07-31T22:10:43
49,582,180
1
0
null
null
null
null
UTF-8
C++
false
false
1,518
hxx
#ifndef TESTGEN_HXX #define TESTGEN_HXX #include <random> #include <vector> #include <algorithm> #include <cstring> #include <cassert> using std::vector; using std::begin; using std::end; using std::shuffle; template<class Matrix> class RandomMatrixGenerator { public: explicit RandomMatrixGenerator(int seed): rng(seed) {} void setSeed(int newSeed) { rng = std::mt19937(newSeed); } Matrix next(size_t rows, size_t cols) { return nextWithOnes(rows, cols, rng() % (rows * cols + 1)); } Matrix nextWithOnes(size_t rows, size_t cols, size_t ones) { size_t size = rows * cols; assert(ones <= size); char perm[size]; memset(perm, 0, size); memset(perm, 1, ones); shuffle(perm, perm + size, rng); return Matrix(rows, cols, perm, perm + size); } Matrix nextWithDensity(size_t rows, size_t cols, double density) { return nextWithOnes(rows, cols, rows * cols * density); } Matrix nextNotLargerThan(size_t n) { size_t rows = unsigned(rng()) % n + 1; size_t cols = unsigned(rng()) % n + 1; return next(rows, cols); } private: std::mt19937 rng; }; template<class Matrix, size_t ROWS, size_t COLS, int SEED=1, int DENSITY=50> struct RandomMatrixGeneratorFunctor { public: Matrix operator()() const { RandomMatrixGenerator<Matrix> g(SEED); return g.nextWithDensity(ROWS, COLS, DENSITY / 100.); } }; #endif
[ "feodor.alexeev@gmail.com" ]
feodor.alexeev@gmail.com
762462b8a047abc58df44efb5634eef124dfd7d4
4186169f4f19eedc54ea9552ad04a07462370b3d
/CSVReader.cpp
1af2569db26b6c3758e280a81a928261d5c4b954
[]
no_license
SamanthaChia/OOPCoursework_1
22f484893fb83b55c16ae2199105a68c333ecfe0
e4b4773cd400333203df23eb34d3d7007e18d187
refs/heads/master
2023-02-19T09:29:22.106444
2021-01-10T10:48:43
2021-01-10T10:48:43
325,569,559
0
0
null
null
null
null
UTF-8
C++
false
false
3,050
cpp
#include "CSVReader.h" #include <iostream> #include <fstream> CSVReader::CSVReader(){ } std::vector<OrderBookEntry> CSVReader::readCSV(std::string csvFilename){ std::vector<OrderBookEntry> entries; std::ifstream csvFile{csvFilename}; std::string line; if(csvFile.is_open()) { while(std::getline(csvFile, line)) { try{ OrderBookEntry obe = stringsToOBE(tokenise(line, ',')); entries.push_back(obe); } catch(const std::exception& e){ std::cout << "CSVReader::readCSV bad data " << std::endl; } } } std::cout << "CSVReader::readCSV read " << entries.size() << " entries" << std::endl; return entries; } std::vector<std::string> CSVReader::tokenise(std::string csvLine, char separator){ std::vector<std::string> tokens; signed int start, end; std::string token; start = csvLine.find_first_not_of(separator, 0); do { end = csvLine.find_first_of(separator, start); if (start == csvLine.length() || start == end) { break; } if( end>=0 ) { token = csvLine.substr( start, end - start); } else { token = csvLine.substr(start, csvLine.length() - start); } tokens.push_back(token); start = end + 1; } while(end > 0); return tokens; } OrderBookEntry CSVReader::stringsToOBE(std::vector<std::string> tokens){ double price, amount; if(tokens.size() != 5) { std::cout << "Bad line" << std::endl; throw std::exception{}; } try{ // stod = string to double. price = std::stod(tokens[3]); amount = std::stod(tokens[4]); }catch(const std::exception& e) { std::cout << "CSVReader::stringsToOBE Bad float! " << tokens[3] << std::endl; std::cout << "CSVReader::stringsToOBE Bad float! " << tokens[4] << std::endl; throw; } OrderBookEntry obe{ price, amount, tokens[0], tokens[1], OrderBookEntry::stringToOrderBookType(tokens[2]) }; return obe; } OrderBookEntry CSVReader::stringsToOBE(std::string priceString, std::string amountString, std::string timestamp, std::string product, OrderBookType OrderType) { double price,amount; try{ // stod = string to double. price = std::stod(priceString); amount = std::stod(amountString); }catch(const std::exception& e) { std::cout << "CSVReader::stringsToOBE Bad float! " << priceString << std::endl; std::cout << "CSVReader::stringsToOBE Bad float! " << amountString << std::endl; throw; } OrderBookEntry obe{ price, amount, timestamp, product, OrderType}; return obe; }
[ "samantha1999@live.com.sg" ]
samantha1999@live.com.sg
554e3368db5bc1bcdf5856b7e3265d5c6f200ca3
af0ecafb5428bd556d49575da2a72f6f80d3d14b
/CodeJamCrawler/dataset/09_8288_23.cpp
86e4a2462f60089969af7c310c2c730a4a2378ad
[]
no_license
gbrlas/AVSP
0a2a08be5661c1b4a2238e875b6cdc88b4ee0997
e259090bf282694676b2568023745f9ffb6d73fd
refs/heads/master
2021-06-16T22:25:41.585830
2017-06-09T06:32:01
2017-06-09T06:32:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
917
cpp
#include <fstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <vector> #include <iostream> #include <string> #include <queue> #include <map> #include <sstream> #include <set> using namespace std; int m[25600]; int main() { freopen("A.in", "rt", stdin); freopen("A.out", "wt", stdout); string x; int test; cin >> test; for(int T = 1; T <= test; T++) { cin >> x; memset(m, -1, sizeof(m)); m[x[0]] = 1; int b = 2; bool ok = true; int i = 1; while(i < x.length() && x[i] == x[0]) i++; for(; i < x.length(); i++) { if(m[x[i]] == -1 && ok) { m[x[i]] = 0; ok = false; } else { if(m[x[i]] == -1) m[x[i]] = b++; } } long long res = 0; long long j = 1; for(int i = x.length() - 1; i >= 0; i--, j *= b) { int mm = m[x[i]]; res += j * mm; } cout << "Case #" << T << ": " << res << endl; } return 0; }
[ "nikola.mrzljak@fer.hr" ]
nikola.mrzljak@fer.hr
853c84e50b9ca47a0ab0bbb95313ee4b2649b374
c15ca123b29e1b57e18a0126dfca13d5f03770ec
/Codeforces/cf_new/easy/892A.cpp
70e0e2ead06141846feacd52e3635061f09aaba4
[]
no_license
iamnidheesh/MyCodes
738547efaf7d36705db921eb644596bc4686d847
13e6878573cd478020f860e431dc1310257583a2
refs/heads/master
2021-09-06T08:05:59.325369
2018-02-04T05:22:00
2018-02-04T05:22:00
94,070,404
2
2
null
2017-09-16T15:39:49
2017-06-12T07:58:25
C++
UTF-8
C++
false
false
377
cpp
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; int main() { long int a[100001],b[100001],n; cin>>n; long long int x = 0; for(int i = 0;i < n;i++) { scanf("%ld",&a[i]); x += (long long int)a[i]; } for(int i = 0;i < n;i++) scanf("%ld",&b[i]); sort(b,b+n); if(x <= (long long int)(b[n-1]+b[n-2])) cout<<"YES"; else cout<<"NO"; }
[ "nidheeshpandey@gmail.com" ]
nidheeshpandey@gmail.com
eb9b97bfa78f4e29d5ae7c391b9a474ff708ed2c
e41d3561f1dc7b1c71f03e5c407cc359e23e59c8
/ch-3/ex-3.9-random-triangles-areas.cpp
614b771211e65104ec5c12469dec6cd07b95a582
[]
no_license
tischsoic/algorithms-in-Cpp-EN
d660545cae758724ff3e3ff00150b328a19bbd6f
0e4af0a497ac79be532bd34a5bcc0e649d04787b
refs/heads/master
2021-05-05T16:59:19.434769
2018-02-08T18:14:03
2018-02-08T18:14:03
117,374,816
1
0
null
null
null
null
UTF-8
C++
false
false
479
cpp
#include <iostream> #include <cstdlib> #include "Point.h" #include "Triangle.h" float randomFromUnitSquare() { return (float)std::rand() / RAND_MAX; } Point randomPoint() { return Point {randomFromUnitSquare(), randomFromUnitSquare()}; } int main() { for (int i = 3; i > 0; --i) { Triangle randTriangle{randomPoint(), randomPoint(), randomPoint()}; std::cout << "Random triangle area: " << area(randTriangle) << std::endl; } return 0; }
[ "symfiz@gmail.com" ]
symfiz@gmail.com
fd35890cf265a31c0b05328307ccf8c8a82d61c3
2dc3bbb7b51dce3e10332f25672516eff3ad1347
/Benh_Vien/Benh_Nhan_CV.cpp
06f6b2d2a0071f4b4b7cddb2d3939c6ff2412a38
[]
no_license
lam267/BenhVien
20e57219554773ea3d4fe14b9b72eaeab2b870b2
08e84394caedceb6f3ad2c2a4ab43c73774b5b88
refs/heads/master
2022-07-23T12:25:03.116011
2020-05-18T08:11:59
2020-05-18T08:11:59
262,305,018
0
0
null
null
null
null
UTF-8
C++
false
false
407
cpp
#include "Benh_Nhan_CV.h" void Benh_Nhan_CV::Nhap() { BenhNhan::Nhap(); cout << "Ma benh nhan:"; BenhNhan::Mahs; cout << "Ngay chuyen:";CNgay::Nhap(); fflush(stdin); cout << "Noi Chuyen:";getline(cin, Noichuyen); } void Benh_Nhan_CV::Hienthi(ostream & os) { BenhNhan::Hienthi(os);cout << "Ma benh nhan:" << BenhNhan::Mahs << "Ngay chuyen:";CNgay::Hienthi(os); cout << "Noi chuyen:" << Noichuyen ; }
[ "lamnguyen9964@gmail.com" ]
lamnguyen9964@gmail.com
c325d557028485636c36466912db15eb71f0e22c
7b4878e9d41c29696323222200964ddbfa726dda
/Khrysalis.Engine/Source/Khrysalis/Debug/Assert.h
00c0a24f6bc9aaa68b7df94766f5f18036e05233
[]
no_license
Kukuun/Khrysalis
649a945d1cbff2291dbe03fcca8c16716c352fa2
e2c623281d2b6c794e81635f69b5cf96e73963c0
refs/heads/master
2023-03-11T22:24:45.366202
2020-12-18T17:00:00
2020-12-18T17:00:39
319,071,145
0
0
null
null
null
null
UTF-8
C++
false
false
1,148
h
#pragma once #include "Khrysalis/Core/Base.h" #include "Khrysalis/Debug/Log.h" #include <filesystem> #ifdef KAL_ENABLE_ASSERTS #define KAL_INTERNAL_ASSERT_IMPL(type, check, msg, ...) { if(!(check)) { KAL##type##ERROR(msg, __VA_ARGS__); KAL_DEBUGBREAK(); } } #define KAL_INTERNAL_ASSERT_WITH_MSG(type, check, ...) KAL_INTERNAL_ASSERT_IMPL(type, check, "Assertion failed: {0}", __VA_ARGS__) #define KAL_INTERNAL_ASSERT_NO_MSG(type, check) KAL_INTERNAL_ASSERT_IMPL(type, check, "Assertion '{0}' failed at {1}:{2}", KAL_STRINGIFY_MACRO(check), std::filesystem::path(__FILE__).filename().string(), __LINE__) #define KAL_INTERNAL_ASSERT_GET_MACRO_NAME(arg1, arg2, macro, ...) macro #define KAL_INTERNAL_ASSERT_GET_MACRO(...) KAL_EXPAND_MACRO( KAL_INTERNAL_ASSERT_GET_MACRO_NAME(__VA_ARGS__, KAL_INTERNAL_ASSERT_WITH_MSG, KAL_INTERNAL_ASSERT_NO_MSG) ) #define KAL_ENGINE_ASSERT(...) KAL_EXPAND_MACRO( KAL_INTERNAL_ASSERT_GET_MACRO(__VA_ARGS__)(_ENGINE_, __VA_ARGS__) ) #define KAL_ASSERT(...) KAL_EXPAND_MACRO( KAL_INTERNAL_ASSERT_GET_MACRO(__VA_ARGS__)(_, __VA_ARGS__) ) #else #define KAL_ENGINE_ASSERT(...) #define KAL_ASSERT(...) #endif
[ "pmunk87@gmail.com" ]
pmunk87@gmail.com
cb61bcb0a618c6ac2858817bdbf212cc051b03c6
decefb13f8a603c1f5cc7eb00634b4649915204f
/packages/electron/shell/browser/ui/accelerator_util.cc
c9c5fb511e82412cb9fe73563dcedd1fce09b412
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
open-pwa/open-pwa
f092b377dc6cb04123a16ef96811ad09a9956c26
4c88c8520b4f6e7af8701393fd2cedbe1b209e8f
refs/heads/master
2022-05-28T22:05:19.514921
2022-05-20T07:27:10
2022-05-20T07:27:10
247,925,596
24
1
Apache-2.0
2021-08-10T07:38:42
2020-03-17T09:13:00
C++
UTF-8
C++
false
false
3,262
cc
// Copyright (c) 2013 GitHub, Inc. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "shell/browser/ui/accelerator_util.h" #include <stdio.h> #include <string> #include <vector> #include "base/logging.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "shell/common/keyboard_util.h" namespace accelerator_util { bool StringToAccelerator(const std::string& shortcut, ui::Accelerator* accelerator) { if (!base::IsStringASCII(shortcut)) { LOG(ERROR) << "The accelerator string can only contain ASCII characters"; return false; } std::vector<std::string> tokens = base::SplitString( shortcut, "+", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); // Now, parse it into an accelerator. int modifiers = ui::EF_NONE; ui::KeyboardCode key = ui::VKEY_UNKNOWN; absl::optional<char16_t> shifted_char; for (const auto& token : tokens) { ui::KeyboardCode code = electron::KeyboardCodeFromStr(token, &shifted_char); if (shifted_char) modifiers |= ui::EF_SHIFT_DOWN; switch (code) { // The token can be a modifier. case ui::VKEY_SHIFT: modifiers |= ui::EF_SHIFT_DOWN; break; case ui::VKEY_CONTROL: modifiers |= ui::EF_CONTROL_DOWN; break; case ui::VKEY_MENU: modifiers |= ui::EF_ALT_DOWN; break; case ui::VKEY_COMMAND: modifiers |= ui::EF_COMMAND_DOWN; break; case ui::VKEY_ALTGR: modifiers |= ui::EF_ALTGR_DOWN; break; // Or it is a normal key. default: key = code; } } if (key == ui::VKEY_UNKNOWN) { LOG(WARNING) << shortcut << " doesn't contain a valid key"; return false; } *accelerator = ui::Accelerator(key, modifiers); accelerator->shifted_char = shifted_char; return true; } void GenerateAcceleratorTable(AcceleratorTable* table, electron::ElectronMenuModel* model) { int count = model->GetItemCount(); for (int i = 0; i < count; ++i) { electron::ElectronMenuModel::ItemType type = model->GetTypeAt(i); if (type == electron::ElectronMenuModel::TYPE_SUBMENU) { auto* submodel = model->GetSubmenuModelAt(i); GenerateAcceleratorTable(table, submodel); } else { ui::Accelerator accelerator; if (model->ShouldRegisterAcceleratorAt(i)) { if (model->GetAcceleratorAtWithParams(i, true, &accelerator)) { MenuItem item = {i, model}; (*table)[accelerator] = item; } } } } } bool TriggerAcceleratorTableCommand(AcceleratorTable* table, const ui::Accelerator& accelerator) { const auto iter = table->find(accelerator); if (iter != std::end(*table)) { const accelerator_util::MenuItem& item = iter->second; if (item.model->IsEnabledAt(item.position)) { const auto event_flags = accelerator.MaskOutKeyEventFlags(accelerator.modifiers()); item.model->ActivatedAt(item.position, event_flags); return true; } } return false; } } // namespace accelerator_util
[ "frank@lemanschik.com" ]
frank@lemanschik.com
2dc35ab6111d52feb4bbcdddb3ac38a2521d7f2b
523efb3280f92ac83e2c6247798690e6ce343c18
/StellarTrace/src/Math/Color.h
abcec525e26ce53376b5314732e4dc309b6be746
[ "Apache-2.0" ]
permissive
sarkararpan710/StellarTrace
8ec93aaa0b6dca9352fd797bd56aeb89b795673f
208ee5b53ff22e309dffb93418a2cad86d6bf971
refs/heads/master
2020-04-22T11:21:49.978859
2019-02-11T11:18:51
2019-02-11T11:18:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
354
h
#pragma once #include "Vector3f.h" #include "../Core.h" namespace StellarTrace { class Color { public: Color(const vec3& color, float alpha) :data(color), alpha(alpha) { }; inline float operator[](uint32 index)const; private: vec3 data; float alpha; }; inline float Color::operator[](uint32 index)const { return data[index]; } }
[ "alimilhim5@gmail.com" ]
alimilhim5@gmail.com
047df4c19d42475a2f2ca7e9e5608c567ada632c
d4386cdd1bf16a903b8e4dfc3484eb19eef80b5c
/VEXU2020-2021/AsyncBot/.vscode/cquery_cached_index/c@@users@7429165@desktop@robot stuff@matt's github stuff@vex-robotics-sdsmt@vexu2020-2021@asyncbot/src@twinrun.cpp
659b92dee7747dab9014f4d6eaadf8bb906c1821
[]
no_license
TheRevilo2018/VEX-Robotics-SDSMT
1535b21b77ba35493ee7b9c1d22ae23ae173b150
b80a2ef00a2c4cf76301b81ce3ee3b3ec48db54f
refs/heads/master
2023-08-15T07:34:05.839114
2021-09-27T04:18:15
2021-09-27T04:18:15
109,911,898
1
0
null
2021-05-24T19:59:30
2017-11-08T01:30:23
C++
UTF-8
C++
false
false
3,325
cpp
#include "../include/twinRun.h" namespace twin { void opcontrolTask(void* param) { int pairIndex = (int)param; // Screen posting might break async, check it pros::lcd::set_text(5, "Calling op_control: " + std::to_string(pros::millis())); const int inserterConst = 110; const int inserterRestingConst = -40; const int intakeConst = 85; int turnThreshold = 10; int driveThreshold = 10; int leftMotorPercent = 0; int rightMotorPercent = 0; int intakePercent = 0; int inserterPercent = inserterRestingConst; std::uint32_t debounceButtonA = 0; std::uint32_t debounceButtonB = 0; std::uint32_t debounceButtonX = 0; std::uint32_t debounceButtonY = 0; std::uint32_t debounceButtonDOWN = 0; std::uint32_t debounceButtonUP = 0; std::uint32_t debounceButtonLEFT = 0; std::uint32_t debounceButtonRIGHT = 0; std::uint32_t debounceButtonR1 = 0; std::uint32_t debounceButtonR2 = 0; std::uint32_t debounceButtonL1 = 0; int loopDelay = 20; while (true) { //ball controls // Outakes for bottom if(alpha.get_digital(pros::E_CONTROLLER_DIGITAL_R1)) { if(pressButton(debounceButtonR1)) { if (intakePercent <= 0) { intakePercent = intakeConst; } else { intakePercent = 0; } } } else if (alpha.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) { if(pressButton(debounceButtonR2)) { if ( intakePercent >= 0) { intakePercent = -intakeConst; } else { intakePercent = 0; } } } if(alpha.get_digital(pros::E_CONTROLLER_DIGITAL_L1)) { if(pressButton(debounceButtonL1)) { if (inserterPercent <= 0) { inserterPercent = inserterConst; } else { inserterPercent = inserterRestingConst; } } } //drive controls if(abs(alpha.get_analog(ANALOG_LEFT_Y)) > driveThreshold || abs(alpha.get_analog(ANALOG_RIGHT_X)) > turnThreshold) { leftMotorPercent = alpha.get_analog(ANALOG_LEFT_Y); rightMotorPercent = alpha.get_analog(ANALOG_LEFT_Y); if(alpha.get_analog(ANALOG_RIGHT_X) > turnThreshold) { leftMotorPercent += abs(alpha.get_analog(ANALOG_RIGHT_X)); rightMotorPercent -= abs(alpha.get_analog(ANALOG_RIGHT_X)); } else { leftMotorPercent -= abs(alpha.get_analog(ANALOG_RIGHT_X)); rightMotorPercent += abs(alpha.get_analog(ANALOG_RIGHT_X)); } } else { leftMotorPercent = 0; rightMotorPercent = 0; } setMotors(leftWheelMotorVector, leftMotorPercent); setMotors(rightWheelMotorVector, rightMotorPercent); setMotors(intakeMotorVector, intakePercent); bottomRoller = intakePercent; inserter = inserterPercent; pros::delay(loopDelay); } } }
[ "7429165@T-SMD1030026" ]
7429165@T-SMD1030026
d97977fd0ec8ac543e6accb48a09c1998fe9427d
dc6335308a793b7ac35a80a761f9c87c6cef8d07
/include/OperatingSystems/Processor/ErrorCounter.h
046d055d4ef0a1e64578eb2033c8944065f8dddc
[]
no_license
Dzordzu/OperatingSystemsV2
bf149c1ce697d2608833e014e0e2c4d1e11de20b
e5a19dd216089dd09b3fb5c38b6a78891b79896c
refs/heads/master
2020-05-24T13:16:35.461293
2019-05-22T19:08:43
2019-05-22T19:08:43
187,285,942
0
0
null
null
null
null
UTF-8
C++
false
false
791
h
// // Created by dzordzu on 5/18/19. // #ifndef OPERATINGSYSTEMSS_PROCESSOR_ERRORSCOUNTER_H #define OPERATINGSYSTEMSS_PROCESSOR_ERRORSCOUNTER_H #include <cstdint> #include <string> namespace OperatingSystems { namespace Processor { class ErrorCounter { std::string counterName; uint_fast64_t errors = 0; public: explicit ErrorCounter(const std::string &counterName) : counterName(counterName) {} void add(int amount = 1) { errors+=amount; } uint_fast64_t getErrors() const {return errors;} void reset() {errors = 0;} const std::string &getCounterName() const { return counterName; } }; } } #endif //OPERATINGSYSTEMSS_PROCESSOR_ERRORSCOUNTER_H
[ "tomekdur@wp.pl" ]
tomekdur@wp.pl
6d10ff953b873c6efc9a27a700a8f566b6ad3844
757f949fd92e6986d287e54257e65b6a05506d10
/src/hwcomponents/caros_universalrobot/src/ursafe_main.cpp
809b19d8872b96fdb1eaeec67913a336785c4fb9
[ "Apache-2.0" ]
permissive
tlund80/MARVIN
5a5d7da37aaa1e901a6e493589c4d7b3cb9802ae
9fddfd4c8e298850fc8ce49c02ff437f139309d0
refs/heads/master
2021-05-01T02:57:47.572095
2015-03-27T13:51:07
2015-03-27T13:51:07
23,161,076
0
1
null
null
null
null
UTF-8
C++
false
false
2,288
cpp
#include "UniversalRobots.hpp" #include <rw/common/PropertyMap.hpp> #include <rw/loaders/xml/XMLPropertyLoader.hpp> #include <rw/loaders/WorkCellLoader.hpp> #include <boost/bind.hpp> using namespace rwhw; using namespace rw::common; using namespace rw::loaders; using namespace rw::models; using namespace rw::kinematics; int main(int argc, char **argv) { if (argc <= 2) { std::cout<<"Usage: ursafe <workcell> <propertyfile.prop.xml>"<<std::endl; return 0; } WorkCell::Ptr workcell = WorkCellLoader::load(argv[1]); if (workcell == NULL) { std::cout<<"Unable to load workcell: "<<argv[1]<<std::endl; return 0; } PropertyMap properties = XMLPropertyLoader::load(argv[2]); if (!properties.has("Name")) { std::cout<<"No property named 'Name' found in property file"<<std::endl; return 0; } std::string deviceName = properties.get<std::string>("Name"); Device::Ptr dev = workcell->findDevice(deviceName); if (dev == NULL) { std::cout<<"Unable to find device "<<deviceName<<" in work cell"<<std::endl; return 0; } ros::init(argc, argv, properties.get<std::string>("Name").c_str()); std::string host = properties.get<std::string>("NetFTHost"); int updateRate = properties.get<int>("NetFTUpdateRate"); std::string calibfile = properties.get<std::string>("NetFTCalibrationFile"); std::cout<<"Calibration File = "<<calibfile<<std::endl; NetFTLogging netft(host); FTCompensation ftCompensation(dev, workcell->getDefaultState(), calibfile); UniversalRobots ur(workcell, properties, updateRate, &netft, &ftCompensation); ur.run(); // while (ros::ok()) // { // /** // * This is a message object. You stuff it with data, and then publish it. // */ // sensor_data msg; // // std::stringstream ss; // ss << "hello";// << count; // msg.name = ss.str(); // // ROS_INFO("%s", msg.name.c_str()); // // /** // * The publish() function is how you send messages. The parameter // * is the message object. The type of this object must agree with the type // * given as a template parameter to the advertise<>() call, as was done // * in the constructor above. // */ // chatter_pub.publish(msg); // // ros::spinOnce(); // // loop_rate.sleep(); // ++count; // } return 0; }
[ "soelund@mail.dk" ]
soelund@mail.dk
252da1bfc8fe23506da9eb340d07d7982a4f27ec
8f421001634923dbfb032389ecd094d4880e958a
/modules/cudastereo/src/stereocsbp.cpp
bc5a230f63e41e27be94243af301f23026cfd8a3
[ "Apache-2.0" ]
permissive
opencv/opencv_contrib
ccf47a2a97022e20d936eb556aa9bc63bc9bdb90
9e134699310c81ea470445b4888fce5c9de6abc7
refs/heads/4.x
2023-08-22T05:58:21.266673
2023-08-11T16:28:20
2023-08-11T16:28:20
12,756,992
8,611
6,099
Apache-2.0
2023-09-14T17:35:22
2013-09-11T13:28:04
C++
UTF-8
C++
false
false
15,906
cpp
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #include "precomp.hpp" using namespace cv; using namespace cv::cuda; #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) void cv::cuda::StereoConstantSpaceBP::estimateRecommendedParams(int, int, int&, int&, int&, int&) { throw_no_cuda(); } Ptr<cuda::StereoConstantSpaceBP> cv::cuda::createStereoConstantSpaceBP(int, int, int, int, int) { throw_no_cuda(); return Ptr<cuda::StereoConstantSpaceBP>(); } #else /* !defined (HAVE_CUDA) */ #include "cuda/stereocsbp.hpp" namespace { class StereoCSBPImpl : public cuda::StereoConstantSpaceBP { public: StereoCSBPImpl(int ndisp, int iters, int levels, int nr_plane, int msg_type); void compute(InputArray left, InputArray right, OutputArray disparity); void compute(InputArray left, InputArray right, OutputArray disparity, Stream& stream); void compute(InputArray data, OutputArray disparity, Stream& stream); int getMinDisparity() const { return min_disp_th_; } void setMinDisparity(int minDisparity) { min_disp_th_ = minDisparity; } int getNumDisparities() const { return ndisp_; } void setNumDisparities(int numDisparities) { ndisp_ = numDisparities; } int getBlockSize() const { return 0; } void setBlockSize(int /*blockSize*/) {} int getSpeckleWindowSize() const { return 0; } void setSpeckleWindowSize(int /*speckleWindowSize*/) {} int getSpeckleRange() const { return 0; } void setSpeckleRange(int /*speckleRange*/) {} int getDisp12MaxDiff() const { return 0; } void setDisp12MaxDiff(int /*disp12MaxDiff*/) {} int getNumIters() const { return iters_; } void setNumIters(int iters) { iters_ = iters; } int getNumLevels() const { return levels_; } void setNumLevels(int levels) { levels_ = levels; } double getMaxDataTerm() const { return max_data_term_; } void setMaxDataTerm(double max_data_term) { max_data_term_ = (float) max_data_term; } double getDataWeight() const { return data_weight_; } void setDataWeight(double data_weight) { data_weight_ = (float) data_weight; } double getMaxDiscTerm() const { return max_disc_term_; } void setMaxDiscTerm(double max_disc_term) { max_disc_term_ = (float) max_disc_term; } double getDiscSingleJump() const { return disc_single_jump_; } void setDiscSingleJump(double disc_single_jump) { disc_single_jump_ = (float) disc_single_jump; } int getMsgType() const { return msg_type_; } void setMsgType(int msg_type) { msg_type_ = msg_type; } int getNrPlane() const { return nr_plane_; } void setNrPlane(int nr_plane) { nr_plane_ = nr_plane; } bool getUseLocalInitDataCost() const { return use_local_init_data_cost_; } void setUseLocalInitDataCost(bool use_local_init_data_cost) { use_local_init_data_cost_ = use_local_init_data_cost; } private: int min_disp_th_; int ndisp_; int iters_; int levels_; float max_data_term_; float data_weight_; float max_disc_term_; float disc_single_jump_; int msg_type_; int nr_plane_; bool use_local_init_data_cost_; GpuMat mbuf_; GpuMat temp_; GpuMat outBuf_; }; const float DEFAULT_MAX_DATA_TERM = 30.0f; const float DEFAULT_DATA_WEIGHT = 1.0f; const float DEFAULT_MAX_DISC_TERM = 160.0f; const float DEFAULT_DISC_SINGLE_JUMP = 10.0f; StereoCSBPImpl::StereoCSBPImpl(int ndisp, int iters, int levels, int nr_plane, int msg_type) : min_disp_th_(0), ndisp_(ndisp), iters_(iters), levels_(levels), max_data_term_(DEFAULT_MAX_DATA_TERM), data_weight_(DEFAULT_DATA_WEIGHT), max_disc_term_(DEFAULT_MAX_DISC_TERM), disc_single_jump_(DEFAULT_DISC_SINGLE_JUMP), msg_type_(msg_type), nr_plane_(nr_plane), use_local_init_data_cost_(true) { } void StereoCSBPImpl::compute(InputArray left, InputArray right, OutputArray disparity) { compute(left, right, disparity, Stream::Null()); } void StereoCSBPImpl::compute(InputArray _left, InputArray _right, OutputArray disp, Stream& _stream) { using namespace cv::cuda::device::stereocsbp; CV_Assert( msg_type_ == CV_32F || msg_type_ == CV_16S ); CV_Assert( 0 < ndisp_ && 0 < iters_ && 0 < levels_ && 0 < nr_plane_ && levels_ <= 8 ); GpuMat left = _left.getGpuMat(); GpuMat right = _right.getGpuMat(); CV_Assert( left.type() == CV_8UC1 || left.type() == CV_8UC3 || left.type() == CV_8UC4 ); CV_Assert( left.size() == right.size() && left.type() == right.type() ); cudaStream_t stream = StreamAccessor::getStream(_stream); //////////////////////////////////////////////////////////////////////////////////////////// // Init int rows = left.rows; int cols = left.cols; levels_ = std::min(levels_, int(log((double)ndisp_) / log(2.0))); // compute sizes AutoBuffer<int> buf(levels_ * 3); int* cols_pyr = buf.data(); int* rows_pyr = cols_pyr + levels_; int* nr_plane_pyr = rows_pyr + levels_; cols_pyr[0] = cols; rows_pyr[0] = rows; nr_plane_pyr[0] = nr_plane_; for (int i = 1; i < levels_; i++) { cols_pyr[i] = cols_pyr[i-1] / 2; rows_pyr[i] = rows_pyr[i-1] / 2; nr_plane_pyr[i] = nr_plane_pyr[i-1] * 2; } GpuMat u[2], d[2], l[2], r[2], disp_selected_pyr[2], data_cost, data_cost_selected; //allocate buffers int buffers_count = 10; // (up + down + left + right + disp_selected_pyr) * 2 buffers_count += 2; // data_cost has twice more rows than other buffers, what's why +2, not +1; buffers_count += 1; // data_cost_selected mbuf_.create(rows * nr_plane_ * buffers_count, cols, msg_type_); data_cost = mbuf_.rowRange(0, rows * nr_plane_ * 2); data_cost_selected = mbuf_.rowRange(data_cost.rows, data_cost.rows + rows * nr_plane_); for(int k = 0; k < 2; ++k) // in/out { GpuMat sub1 = mbuf_.rowRange(data_cost.rows + data_cost_selected.rows, mbuf_.rows); GpuMat sub2 = sub1.rowRange((k+0)*sub1.rows/2, (k+1)*sub1.rows/2); GpuMat *buf_ptrs[] = { &u[k], &d[k], &l[k], &r[k], &disp_selected_pyr[k] }; for(int _r = 0; _r < 5; ++_r) { *buf_ptrs[_r] = sub2.rowRange(_r * sub2.rows/5, (_r+1) * sub2.rows/5); CV_DbgAssert( buf_ptrs[_r]->cols == cols && buf_ptrs[_r]->rows == rows * nr_plane_ ); } }; size_t elem_step = mbuf_.step / mbuf_.elemSize(); Size temp_size = data_cost.size(); if ((size_t)temp_size.area() < elem_step * rows_pyr[levels_ - 1] * ndisp_) temp_size = Size(static_cast<int>(elem_step), rows_pyr[levels_ - 1] * ndisp_); temp_.create(temp_size, msg_type_); //////////////////////////////////////////////////////////////////////////// // Compute l[0].setTo(0, _stream); d[0].setTo(0, _stream); r[0].setTo(0, _stream); u[0].setTo(0, _stream); l[1].setTo(0, _stream); d[1].setTo(0, _stream); r[1].setTo(0, _stream); u[1].setTo(0, _stream); data_cost.setTo(0, _stream); data_cost_selected.setTo(0, _stream); int cur_idx = 0; if (msg_type_ == CV_32F) { for (int i = levels_ - 1; i >= 0; i--) { if (i == levels_ - 1) { init_data_cost(left.ptr<uchar>(), right.ptr<uchar>(), temp_.ptr<uchar>(), left.step, left.rows, left.cols, disp_selected_pyr[cur_idx].ptr<float>(), data_cost_selected.ptr<float>(), elem_step, rows_pyr[i], cols_pyr[i], i, nr_plane_pyr[i], ndisp_, left.channels(), data_weight_, max_data_term_, min_disp_th_, use_local_init_data_cost_, stream); } else { compute_data_cost(left.ptr<uchar>(), right.ptr<uchar>(), left.step, disp_selected_pyr[cur_idx].ptr<float>(), data_cost.ptr<float>(), elem_step, left.rows, left.cols, rows_pyr[i], cols_pyr[i], rows_pyr[i+1], i, nr_plane_pyr[i+1], left.channels(), data_weight_, max_data_term_, min_disp_th_, stream); int new_idx = (cur_idx + 1) & 1; init_message(temp_.ptr<uchar>(), u[new_idx].ptr<float>(), d[new_idx].ptr<float>(), l[new_idx].ptr<float>(), r[new_idx].ptr<float>(), u[cur_idx].ptr<float>(), d[cur_idx].ptr<float>(), l[cur_idx].ptr<float>(), r[cur_idx].ptr<float>(), disp_selected_pyr[new_idx].ptr<float>(), disp_selected_pyr[cur_idx].ptr<float>(), data_cost_selected.ptr<float>(), data_cost.ptr<float>(), elem_step, rows_pyr[i], cols_pyr[i], nr_plane_pyr[i], rows_pyr[i+1], cols_pyr[i+1], nr_plane_pyr[i+1], stream); cur_idx = new_idx; } calc_all_iterations(temp_.ptr<uchar>(), u[cur_idx].ptr<float>(), d[cur_idx].ptr<float>(), l[cur_idx].ptr<float>(), r[cur_idx].ptr<float>(), data_cost_selected.ptr<float>(), disp_selected_pyr[cur_idx].ptr<float>(), elem_step, rows_pyr[i], cols_pyr[i], nr_plane_pyr[i], iters_, max_disc_term_, disc_single_jump_, stream); } } else { for (int i = levels_ - 1; i >= 0; i--) { if (i == levels_ - 1) { init_data_cost(left.ptr<uchar>(), right.ptr<uchar>(), temp_.ptr<uchar>(), left.step, left.rows, left.cols, disp_selected_pyr[cur_idx].ptr<short>(), data_cost_selected.ptr<short>(), elem_step, rows_pyr[i], cols_pyr[i], i, nr_plane_pyr[i], ndisp_, left.channels(), data_weight_, max_data_term_, min_disp_th_, use_local_init_data_cost_, stream); } else { compute_data_cost(left.ptr<uchar>(), right.ptr<uchar>(), left.step, disp_selected_pyr[cur_idx].ptr<short>(), data_cost.ptr<short>(), elem_step, left.rows, left.cols, rows_pyr[i], cols_pyr[i], rows_pyr[i+1], i, nr_plane_pyr[i+1], left.channels(), data_weight_, max_data_term_, min_disp_th_, stream); int new_idx = (cur_idx + 1) & 1; init_message(temp_.ptr<uchar>(), u[new_idx].ptr<short>(), d[new_idx].ptr<short>(), l[new_idx].ptr<short>(), r[new_idx].ptr<short>(), u[cur_idx].ptr<short>(), d[cur_idx].ptr<short>(), l[cur_idx].ptr<short>(), r[cur_idx].ptr<short>(), disp_selected_pyr[new_idx].ptr<short>(), disp_selected_pyr[cur_idx].ptr<short>(), data_cost_selected.ptr<short>(), data_cost.ptr<short>(), elem_step, rows_pyr[i], cols_pyr[i], nr_plane_pyr[i], rows_pyr[i+1], cols_pyr[i+1], nr_plane_pyr[i+1], stream); cur_idx = new_idx; } calc_all_iterations(temp_.ptr<uchar>(), u[cur_idx].ptr<short>(), d[cur_idx].ptr<short>(), l[cur_idx].ptr<short>(), r[cur_idx].ptr<short>(), data_cost_selected.ptr<short>(), disp_selected_pyr[cur_idx].ptr<short>(), elem_step, rows_pyr[i], cols_pyr[i], nr_plane_pyr[i], iters_, max_disc_term_, disc_single_jump_, stream); } } const int dtype = disp.fixedType() ? disp.type() : CV_16SC1; disp.create(rows, cols, dtype); GpuMat out = disp.getGpuMat(); if (dtype != CV_16SC1) { outBuf_.create(rows, cols, CV_16SC1); out = outBuf_; } out.setTo(0, _stream); if (msg_type_ == CV_32F) { compute_disp(u[cur_idx].ptr<float>(), d[cur_idx].ptr<float>(), l[cur_idx].ptr<float>(), r[cur_idx].ptr<float>(), data_cost_selected.ptr<float>(), disp_selected_pyr[cur_idx].ptr<float>(), elem_step, out, nr_plane_pyr[0], stream); } else { compute_disp(u[cur_idx].ptr<short>(), d[cur_idx].ptr<short>(), l[cur_idx].ptr<short>(), r[cur_idx].ptr<short>(), data_cost_selected.ptr<short>(), disp_selected_pyr[cur_idx].ptr<short>(), elem_step, out, nr_plane_pyr[0], stream); } if (dtype != CV_16SC1) out.convertTo(disp, dtype, _stream); } void StereoCSBPImpl::compute(InputArray /*data*/, OutputArray /*disparity*/, Stream& /*stream*/) { CV_Error(Error::StsNotImplemented, "Not implemented"); } } Ptr<cuda::StereoConstantSpaceBP> cv::cuda::createStereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, int msg_type) { return makePtr<StereoCSBPImpl>(ndisp, iters, levels, nr_plane, msg_type); } void cv::cuda::StereoConstantSpaceBP::estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane) { ndisp = (int) ((float) width / 3.14f); if ((ndisp & 1) != 0) ndisp++; int mm = std::max(width, height); iters = mm / 100 + ((mm > 1200)? - 4 : 4); levels = (int)::log(static_cast<double>(mm)) * 2 / 3; if (levels == 0) levels++; nr_plane = (int) ((float) ndisp / std::pow(2.0, levels + 1)); } #endif /* !defined (HAVE_CUDA) */
[ "alexander.alekhin@intel.com" ]
alexander.alekhin@intel.com
65244b996c7e0e02d14e8b52ef2025840a480750
9a6a3ed03bddce848dbeb0a983ca058695025620
/projects/biogears/libBiogears/src/cdm/properties/SEScalarPowerPerAreaTemperatureToTheFourth.cpp
b885cd8a37fdf80b615887ed2a18dbbd7d23bf94
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
amodhs619/core
0da9a123c283eb63be17b3bb4ad921986fe9283e
149bef063d364a7fb19e74f5907abdc7dda2e4e9
refs/heads/master
2023-08-18T05:45:29.197416
2021-01-29T08:17:42
2021-04-28T18:20:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,820
cpp
/************************************************************************************** Copyright 2015 Applied Research Associates, Inc. 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 <biogears/cdm/properties/SEScalarPowerPerAreaTemperatureToTheFourth.h> namespace biogears { const PowerPerAreaTemperatureToTheFourthUnit PowerPerAreaTemperatureToTheFourthUnit::W_Per_m2_K4("W/ m^2 K^4"); PowerPerAreaTemperatureToTheFourthUnit::PowerPerAreaTemperatureToTheFourthUnit(const char* u) : PowerPerAreaTemperatureToTheFourthUnit(std::string{ u }) { } //------------------------------------------------------------------------------- PowerPerAreaTemperatureToTheFourthUnit::PowerPerAreaTemperatureToTheFourthUnit(const std::string& u) : CCompoundUnit(u) { } //------------------------------------------------------------------------------- CDM::ScalarPowerPerAreaTemperatureToTheFourthData* SEScalarPowerPerAreaTemperatureToTheFourth::Unload() const { if (!IsValid()) return nullptr; CDM::ScalarPowerPerAreaTemperatureToTheFourthData* data(new CDM::ScalarPowerPerAreaTemperatureToTheFourthData()); SEScalarQuantity::Unload(*data); return data; } //------------------------------------------------------------------------------- bool PowerPerAreaTemperatureToTheFourthUnit::IsValidUnit(const char* unit) { if (strcmp(W_Per_m2_K4.GetString(),unit) == 0) return true; return false; } //------------------------------------------------------------------------------- bool PowerPerAreaTemperatureToTheFourthUnit::IsValidUnit(const std::string& unit) { return IsValidUnit(unit.c_str()); } //------------------------------------------------------------------------------- const PowerPerAreaTemperatureToTheFourthUnit& PowerPerAreaTemperatureToTheFourthUnit::GetCompoundUnit(const char* unit) { if (strcmp(W_Per_m2_K4.GetString(),unit) == 0) return W_Per_m2_K4; std::stringstream err; err << unit << " is not a valid PowerPerAreaTemperatureToTheFourth unit"; throw CommonDataModelException(err.str()); } //------------------------------------------------------------------------------- const PowerPerAreaTemperatureToTheFourthUnit& PowerPerAreaTemperatureToTheFourthUnit::GetCompoundUnit(const std::string& unit) { return GetCompoundUnit(unit.c_str()); } //------------------------------------------------------------------------------- bool PowerPerAreaTemperatureToTheFourthUnit::operator==(const PowerPerAreaTemperatureToTheFourthUnit& obj) const { return GetString() == obj.GetString(); } //------------------------------------------------------------------------------- bool PowerPerAreaTemperatureToTheFourthUnit::operator!=(const PowerPerAreaTemperatureToTheFourthUnit& obj) const { return !(*this == obj); } //------------------------------------------------------------------------------- bool SEScalarPowerPerAreaTemperatureToTheFourth::operator==(const SEScalarPowerPerAreaTemperatureToTheFourth& obj) const { return m_unit == obj.m_unit && m_value == obj.m_value; } //------------------------------------------------------------------------------- bool SEScalarPowerPerAreaTemperatureToTheFourth::operator!=(const SEScalarPowerPerAreaTemperatureToTheFourth& obj) const { return !(*this == obj); } }
[ "sawhite@ara.com" ]
sawhite@ara.com
2398050f3ecd3914dc7f779b061cd6fcbbc03ef8
5207348f2e7bf486ab942969a61293bb6f603aef
/MaxFactor.cpp
e59ed6bc67ff9c462f3b96aa5a48c620a5ed1fcb
[]
no_license
butorin75/maxfactor
48d7f0beed3618459b43fc1f8c3b317906f2ccfb
bbfbf7a43f157ce246693ca545c5258dd8f5dde6
refs/heads/master
2023-08-10T21:17:45.494011
2021-09-29T12:09:17
2021-09-29T12:09:17
411,658,399
0
0
null
null
null
null
UTF-8
C++
false
false
1,309
cpp
// MaxFactor.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include <iostream> std::uint64_t sqrt64(uint64_t a) { uint64_t min = 0; uint64_t max = ((uint64_t)1) << 32; while (1) { if (max <= 1 + min) return min; uint64_t sqt = min + (max - min) / 2; uint64_t sq = sqt * sqt; if (sq == a) return sqt; if (sq > a) max = sqt; else min = sqt; } return 1ULL; } bool is_prime(std::uint64_t x) { std::uint64_t max = sqrt64(x); for (std::uint64_t i = 2; i <= max; i++) { if (x % i == 0) { return false; } } return true; } std::uint64_t max_factor(std::uint64_t n) { std::uint64_t max_val = n/2 + 1; if ((max_val % 2) == 0) ++max_val; for (std::uint64_t i = max_val; i >= 2; i -= 2) { if (is_prime(i) && (n % i) == 0) return i; } return 1; } int main() { std::cout << "MaxFactor 1.0\nPlease enter the number:"; std::uint64_t n; std::cin >> n; std::cout << "Maximum simple divider: " << max_factor(n); }
[ "mvc94104@gmail.com" ]
mvc94104@gmail.com
31eb10b3721863b1faa18e9e00c76b1024de6447
0c012fdfe2aca4da7bb99587c22f1d0323316157
/notebook_app.hpp
279b40dcd22edbfb55051c4f4ae78abda3777c86
[]
no_license
sjocher/plotscript
c059f455e6892b8aeed4342a899e44d7764ea5b8
48c50e10727098a14d16bb85bd7e0b6d9ed08185
refs/heads/master
2020-04-11T17:19:01.255861
2018-12-03T23:01:48
2018-12-03T23:01:48
161,956,219
0
0
null
null
null
null
UTF-8
C++
false
false
1,011
hpp
#ifndef NOTEBOOK_APP_HPP #define NOTEBOOK_APP_HPP #include <QWidget> #include <atomic> #include "input_widget.hpp" #include "output_widget.hpp" #include "cpanel.hpp" #include "interpreter.hpp" #include "semantic_error.hpp" #include "startup_config.hpp" #include "guiParseInterp.hpp" class NotebookApp: public QWidget { Q_OBJECT public: NotebookApp(); ~NotebookApp(); void repl(QString data); private: QString m_parseData; void loadStartup(); InputWidget * input; OutputWidget * output; cPanel * controlpanel; bool kernalRunning = true; Interpreter interp; parseQueue pQ; resultQueue rQ; messageQueue mQ; guiParseInterp pI; std::atomic_bool solved; void closeEvent(QCloseEvent *event); public slots: void setData(QString data); void handleStart(); void handleStop(); void handleReset(); void handleinterrupt(); signals: void plotscriptResult(Expression result); void plotscriptError(std::string error); }; #endif
[ "sjocher@vt.edu" ]
sjocher@vt.edu
7d8a879029340804e89c995bc4f7e0b78a227286
6ae3ac751afd23568725edddc0b02938ce80a0c6
/catkin_ws/devel/include/beginner_tutorials/valueMatrix.h
886911715760b33153e14e33a6eff15079eb16ee
[ "MIT" ]
permissive
lies98/ROS_chasing_ball
ee0514b62605eea8c68dc17ef1355b2165a1bfed
6e1f08ed51a5b5f0c7b0bdebfb1bef2d3fe61949
refs/heads/main
2023-04-05T18:28:55.579984
2021-04-18T18:46:21
2021-04-18T18:46:21
359,225,462
0
0
null
null
null
null
UTF-8
C++
false
false
6,784
h
// Generated by gencpp from file beginner_tutorials/valueMatrix.msg // DO NOT EDIT! #ifndef BEGINNER_TUTORIALS_MESSAGE_VALUEMATRIX_H #define BEGINNER_TUTORIALS_MESSAGE_VALUEMATRIX_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> #include <std_msgs/Header.h> namespace beginner_tutorials { template <class ContainerAllocator> struct valueMatrix_ { typedef valueMatrix_<ContainerAllocator> Type; valueMatrix_() : header() , value(0.0) , tick(false) , option() { } valueMatrix_(const ContainerAllocator& _alloc) : header(_alloc) , value(0.0) , tick(false) , option(_alloc) { (void)_alloc; } typedef ::std_msgs::Header_<ContainerAllocator> _header_type; _header_type header; typedef float _value_type; _value_type value; typedef uint8_t _tick_type; _tick_type tick; typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _option_type; _option_type option; typedef boost::shared_ptr< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::beginner_tutorials::valueMatrix_<ContainerAllocator> const> ConstPtr; }; // struct valueMatrix_ typedef ::beginner_tutorials::valueMatrix_<std::allocator<void> > valueMatrix; typedef boost::shared_ptr< ::beginner_tutorials::valueMatrix > valueMatrixPtr; typedef boost::shared_ptr< ::beginner_tutorials::valueMatrix const> valueMatrixConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::beginner_tutorials::valueMatrix_<ContainerAllocator> & v) { ros::message_operations::Printer< ::beginner_tutorials::valueMatrix_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace beginner_tutorials namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True} // {'beginner_tutorials': ['/root/catkin_ws/src/beginner_tutorials/msg'], 'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::beginner_tutorials::valueMatrix_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::beginner_tutorials::valueMatrix_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::beginner_tutorials::valueMatrix_<ContainerAllocator> const> : TrueType { }; template<class ContainerAllocator> struct MD5Sum< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > { static const char* value() { return "bc1cd923f6f816fbd3a3ec5219a648ae"; } static const char* value(const ::beginner_tutorials::valueMatrix_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0xbc1cd923f6f816fbULL; static const uint64_t static_value2 = 0xd3a3ec5219a648aeULL; }; template<class ContainerAllocator> struct DataType< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > { static const char* value() { return "beginner_tutorials/valueMatrix"; } static const char* value(const ::beginner_tutorials::valueMatrix_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > { static const char* value() { return "Header header\n\ \n\ float32 value\n\ \n\ bool tick\n\ \n\ string option\n\ ================================================================================\n\ MSG: std_msgs/Header\n\ # Standard metadata for higher-level stamped data types.\n\ # This is generally used to communicate timestamped data \n\ # in a particular coordinate frame.\n\ # \n\ # sequence ID: consecutively increasing ID \n\ uint32 seq\n\ #Two-integer timestamp that is expressed as:\n\ # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\ # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\ # time-handling sugar is provided by the client library\n\ time stamp\n\ #Frame this data is associated with\n\ # 0: no frame\n\ # 1: global frame\n\ string frame_id\n\ "; } static const char* value(const ::beginner_tutorials::valueMatrix_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.header); stream.next(m.value); stream.next(m.tick); stream.next(m.option); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct valueMatrix_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::beginner_tutorials::valueMatrix_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::beginner_tutorials::valueMatrix_<ContainerAllocator>& v) { s << indent << "header: "; s << std::endl; Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header); s << indent << "value: "; Printer<float>::stream(s, indent + " ", v.value); s << indent << "tick: "; Printer<uint8_t>::stream(s, indent + " ", v.tick); s << indent << "option: "; Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.option); } }; } // namespace message_operations } // namespace ros #endif // BEGINNER_TUTORIALS_MESSAGE_VALUEMATRIX_H
[ "liesamarouche@MacBook-Pro-de-Lies.local" ]
liesamarouche@MacBook-Pro-de-Lies.local
65361a258ddec04eb07cb9e94ea902dca30352b8
bebd4f4ed50b0fa55ed1a867bf41ab45ff96c6fa
/src/semantics/drawing_helpers.cpp
41f7f8aff25d845b7652d41db8df5cb0f168ef9f
[ "MIT" ]
permissive
tomaszmj/lturtle
a9b91859fa278735c8c02e45afd08b6f2701bbd3
e8fff3c0393697b69f4985cdccf74491eb7c88c9
refs/heads/master
2022-04-16T06:46:40.475997
2020-04-11T11:42:21
2020-04-11T11:42:21
254,855,507
0
0
null
null
null
null
UTF-8
C++
false
false
2,621
cpp
#include "drawing_helpers.h" #include "exception.h" #ifdef DEBUG #include <iostream> #endif using namespace semantics_namespace; TurtleState::TurtleState() : pencolour(0, 0, 0), pendown(true), position(0.0f, 0.0f), rotation(90.0f), pensize(1.0f), scale(1.0f) {} UtmostTurtleCoordinates::UtmostTurtleCoordinates(const std::pair<float, float> &starting_pos) : maxX(starting_pos.first), minX(starting_pos.first), maxY(starting_pos.second), minY(starting_pos.second), margin(1.0) {} void UtmostTurtleCoordinates::update(const std::pair<float, float> &position) { if(position.first < minX) minX = position.first; if(position.first > maxX) maxX = position.first; if(position.second < minY) minY = position.second; if(position.second > maxY) maxY = position.second; } void UtmostTurtleCoordinates::update(float pensize) { if(pensize > margin) margin = pensize; } const sf::Color DrawingContext::defaultColour(255, 255, 255); DrawingContext::DrawingContext(const UtmostTurtleCoordinates &coord) : xNegativeOffset(coord.getMinX() - coord.getMargin()), yPositiveOffset(coord.getMaxY() + coord.getMargin()) { unsigned width = static_cast<unsigned>(coord.getMaxX() - coord.getMinX() + 2*coord.getMargin()); unsigned height = static_cast<unsigned>(coord.getMaxY() - coord.getMinY() + 2*coord.getMargin()); target.create(width, height); target.clear(defaultColour); target.setSmooth(true); } void DrawingContext::save(const std::string &filename) { target.getTexture().copyToImage().saveToFile(filename); // SFML "witout asking" itself prints error message } void DrawingContext::drawLine(const TurtleState &state, float length) { if(!state.pendown) return; sf::RectangleShape line(sf::Vector2f(state.scale * length, state.scale * state.pensize)); line.setRotation(-state.rotation); // setRotation(number of DEGREES), clockwise (state.rotation is counter-clockwise) line.setFillColor(state.pencolour); std::pair<float, float> point = transfromTurtleCoordinatesToImageCoordinates(state.position); line.setPosition(point.first, point.second); target.draw(line); } std::pair<float, float> DrawingContext::transfromTurtleCoordinatesToImageCoordinates(const std::pair<float, float> &point) const { #ifdef DEBUG std::cerr << "transfrom coordinates (" << point.first << ", " << point.second << ") -> (" << point.first - xNegativeOffset << ", " << yPositiveOffset - point.second << ")\n"; #endif return std::pair<float, float>(point.first - xNegativeOffset, yPositiveOffset - point.second); }
[ "tomasz.m.j.nowak@gmail.com" ]
tomasz.m.j.nowak@gmail.com
57d8200f790b3735c8cd228c52c4b48081a8b708
9d1e48f5746830082fec687a120f93ee182d59bb
/Vid_4.0/Vid_4.0.ino
95f7622a4c8be265c72f3e591687342b8f87054c
[]
no_license
Ankit-Sidana/Arduino
8d259d94256a3f10a3b867218716b10e5a89ce3f
010aacc024a81867556448788dc38ed1ee5ea164
refs/heads/master
2023-05-10T20:33:19.503863
2021-05-27T17:03:59
2021-05-27T17:03:59
371,437,625
2
0
null
null
null
null
UTF-8
C++
false
false
174
ino
// C++ code // int sensepin = 0; void setup() { analogReference(DEFAULT); Serial.begin(9600); } void loop() { Serial.println(analogRead(sensepin)); delay(500); }
[ "ankitsidana27@gmail.com" ]
ankitsidana27@gmail.com
13041cc246ceb23a710d1a8e041f96eb0e204e43
085e03878f982a59185cc91581d1c61b0eba7ecc
/BattleTank/Source/BattleTank/TankBattle_UserWidget.h
0c08b0f857441f3881903493326c6ffd2061a2de
[]
no_license
fogeZombie/BattleTankTutorial
c1a0dcf1ef34cb09c2c0ebb81085f19d0a391bde
71b1967c86953c927adeff5329cc0b169c55b219
refs/heads/master
2020-03-23T10:42:53.596795
2018-08-31T19:52:54
2018-08-31T19:52:54
141,458,046
0
0
null
null
null
null
UTF-8
C++
false
false
316
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" #include "TankBattle_UserWidget.generated.h" /** * */ UCLASS() class BATTLETANK_API UTankBattle_UserWidget : public UUserWidget { GENERATED_BODY() };
[ "fogezombie@gmail.com" ]
fogezombie@gmail.com
cba5929c832ea545e1b0cbac6e947f020b8a5054
ff0df31236e1402e073a22f46aa739e8f88c35bb
/LastAlive/OldECS/Component.h
4dde7e5f13a6dc454afb7fd169cd554a1aa9bb39
[]
no_license
redtoorange/lastalive
11e71cd16db64f5f8978f1748f89826bae0325cd
5edef2322f5a2870e463acba1d99064753be8c1e
refs/heads/master
2020-03-28T13:24:59.548372
2018-06-23T13:18:09
2018-06-23T13:18:09
148,393,714
0
0
null
null
null
null
UTF-8
C++
false
false
597
h
#pragma once #include "BatchRenderer.h" namespace sf { class RenderWindow; class Event; } namespace Engine { class Component { public: Component() = default; virtual ~Component() = default; virtual void Update(float p_delta); virtual void Render(sf::RenderWindow& p_window); virtual void Render(BatchRenderer& p_window); virtual void HandleInput(sf::Event& p_event); bool GetsInput() const; bool GetsUpdate() const; bool GetsRender() const; protected: bool m_getsInput = true; bool m_getsUpdate = true; bool m_getsRender = true; }; } // namespace Engine
[ "redtoorange@gmail.com" ]
redtoorange@gmail.com
0460f336abdb7c1cbb2c7f2a2d2338d1a93a2e16
e2a4ddb143bfc57b08c6062f88ff9271923001ad
/55.JumpGame.cpp
4e631ce837afce6c7524fbcf9ff60609827e69cb
[]
no_license
jo-qzy/LeetCode
d99bdf6f73c3e081059f4bcb0c781580f1c7b644
47081a328481c14074173cd481f3b8241f45b9e3
refs/heads/master
2021-06-27T18:28:55.779325
2019-03-12T16:15:19
2019-03-12T16:15:19
134,131,932
0
1
null
null
null
null
UTF-8
C++
false
false
934
cpp
// 评论提供的,从后往前遍历,n为到前一个记录的点的需要的步长 class Solution { public: bool canJump(vector<int>& nums) { int n = 1; for (int i = nums.size() - 2; i >= 0; i--) { if (nums[i] >= n) n = 1; else n++; if (i == 0 && n > 1) return false; } return true; } }; // 递归超时,但是我认为可行,因为我是差不多类似贪心写的 // 虽然他超时了。。。 class Solution { public: bool canJump(vector<int>& nums) { return canJump(nums, 0); } private: bool canJump(vector<int>& nums, size_t index) { if (index + nums[index] >= nums.size() - 1) return true; for (size_t i = nums[index]; i > 0; i--) { if (canJump(nums, index + i)) return true; } return false; } };
[ "2651933495@qq.com" ]
2651933495@qq.com