Skip to content

Instantly share code, notes, and snippets.

@tkymx
tkymx / Dxlib_template.cpp
Created March 19, 2015 15:12
Dxlib のテンプレート(自分用)
#include "DxLib.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
int Key;
SetGraphMode(640, 480, 16);
ChangeWindowMode(true);
if (DxLib_Init() == -1)
@tkymx
tkymx / OpenGLViewer.cpp
Last active December 11, 2015 13:38
実験で得たデータを三次元的に視覚できるようなツールを作ってみた z,xで拡大、縮小 マウスでカメラ操作 drawの中で描画することができます
#include <GL/glut.h>
#include<windows.h>
#include"Vector.h"
using namespace std;
#define WINDOW_WIDTH (640.0)
#define WINDOW_HEIGHT (480.0)
@tkymx
tkymx / Vector.h
Created January 25, 2013 04:42
ベクトル表現のために使用
#pragma once
#include<math.h>
#define D3DX_PI ((double) 3.141592654f)
#define D3DX_1BYPI ((double) 0.318309886f)
#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f))
#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI))
@tkymx
tkymx / KdTreeMulti.cpp
Created January 25, 2013 04:37
KdTreeを汎用化して使おうかなと思って作成した。
#include"Vector.h"
#include<vector>
using namespace std;
/*
KdTreeMulti
@tkymx
tkymx / Task.cpp
Last active December 15, 2015 21:49
CTask CTaskManager タスクの概念を実装するために用いる
#include "Task.h"
CTask::CTask(void)
{
}
CTask::~CTask(void)
{
}
std::wstring_convert<std::codecvt_utf8<wchar_t> > m_codecvt_utf8;
return m_codecvt_utf8.from_bytes(str.c_str());
std::vector<std::string> split(std::string text,std::string delim )
{
int index = 0, current = 0;
std::vector<std::string> strs;
while ((index = text.find_first_of(delim, current)) != std::string::npos)
{
strs.push_back(text.substr(current, index - current));
current = index + 1;
}
@tkymx
tkymx / get_dir_path.cpp
Last active May 22, 2016 10:19
ファイル読み込みダイアログ
#include <Windows.h>
#include <shlobj.h>
#include <map>
#include <iostream>
#include <fstream>
#include <string>
#include "utillity.h"
static int CALLBACK SHBrowseProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
@tkymx
tkymx / Depth.h
Last active June 19, 2016 09:19
キネクトから取得されたデプス情報を格納する テキストベースでちょっと重い
struct Depth
{
int m_w, m_h;
std::vector<std::vector<double>> depth;
public:
bool load_depth(std::string name)
{
//delete
if (!depth.empty())
@tkymx
tkymx / Delaunay.cpp
Created October 21, 2016 09:41
ドロネイ三角形の作成
#include "opencv\cv.h"
#include "opencv\highgui.h"
#if CV_MAJOR_VERSION > 1
#include <opencv2/legacy/legacy.hpp>
#endif
//============================================================================
bool IsEdgeIn(int ind1, int ind2,
const std::vector<std::vector<int> > &edges)