针对私设网中网、私接AP和随身Wifi的安全解决方案
2016-03-28 16:27
274 查看
自从LOD地形第一节推出以来,受到不少朋友的关注,本人真是受宠若惊,无奈自己水平有限,怕写不好让大家对自己失望,我只能勉为其难,努力去写,同时欢迎高人能手给于指正,大家共同学习,共同提高!
LOD地形的四叉树算法原理就是对地形进行四叉树分割,同时检查该节点是否位于视截体内部,如果在视截体内部且满足视距,周围点高程误差等条件时,则对该节点继续分割,否则不予分割。其中重点是视截体的计算,以及地形的分割及渲染。下面介绍几个系统中用到的类。
首先介绍标志节点是否分割的类Bit
类定义:
//该类根据节点的位置,为每个节点在标志段里相应位设一个标识。
/***********************************************************************
* Copyrights Reserved by QinGeSoftware
* Author : Qinge
* Filename : Bit.h 1.0
* Date: 2008-1-10
************************************************************************/
#pragma once
class Bit
{
public:
void SetScale(int nScale); //伸缩系数
void Set(int x, int y, BOOL bFlog=TRUE); //设置标志位
void Reset(); //标志清零
BOOL CreateBits(int nXBites, int nRows); //创建标志数组
BOOL IsTrue(int x, int y); //查询该位标志
public:
Bit();
virtual ~Bit(void);
private:
unsigned char *m_pBits; //存储位标志的指针
int m_nXBytes; //X方向的字节数
int m_nZRows; //Z方向的行数
int m_nScale; //伸缩系数
};
//类实现文件
/***********************************************************************
* Copyrights Reserved by QinGeSoftware
* Author : Qinge
* Filename : Bit.cpp 1.0
* Date: 2008-1-10
************************************************************************/
#include "StdAfx.h"
#include "Bit.h"
Bit::Bit(void)
{
m_pBits = NULL; //指针初始化为NULL
m_nXBytes = 0;
m_nZRows = 0;
m_nScale = 1; //不能初始化为0,因为是除数
}
Bit::~Bit(void)
{
if(m_pBits != NULL)
{
delete [] m_pBits; //释放指针
m_pBits = NULL; //置为空,否则会成为野指针
}
}
BOOL Bit::CreateBits(int nXBites, int nRows)
{
//nXBits 必须是8的倍数
m_nXBytes = nXBites/8+1; //想想为什么加1
m_nZRows = nRows;
m_pBits = new unsigned char[m_nXBytes * m_nZRows]; //分配空间
memset(m_pBits, 0, m_nZRows * m_nXBytes); //标志段全部初始化0
return 0;
}
void Bit::SetScale(int nScale)
{
m_nScale = nScale; //提供操作私有变量的接口
}
void Bit::Set(int x, int y, BOOL bFlog )
{
x = x / m_nScale; //每隔m_nScale采样
y = y / m_nScale;
unsigned char &c = m_pBits[y * m_nXBytes + x/8]; //获得某字符的引用,注意赋值方式,否则
unsigned char d = 0x80; //后面改了白该。
d = d >>(x%8); //根据X值得不同,首位右移相应位数。移位
// 使得每个节点对应一位。
if(bFlog)
{
c|=d; //把字符C与X相应的位置为1
}
else
{
d = ~d; //和某节点对应的位为0,其余位为1
c &= d; //把字符C与X相应的位置为0
}
}
void Bit::Reset()
{
memset(m_pBits, 0, m_nXBytes * m_nZRows);
}
BOOL Bit::IsTrue(int x, int y)
{
x = x/m_nScale;
y = y/m_nScale;
unsigned char c = m_pBits[y*m_nXBytes+x/8]; //这次不是引用,想想为什么
unsigned char d = 0x80;
c = c
LOD地形的四叉树算法原理就是对地形进行四叉树分割,同时检查该节点是否位于视截体内部,如果在视截体内部且满足视距,周围点高程误差等条件时,则对该节点继续分割,否则不予分割。其中重点是视截体的计算,以及地形的分割及渲染。下面介绍几个系统中用到的类。
首先介绍标志节点是否分割的类Bit
类定义:
//该类根据节点的位置,为每个节点在标志段里相应位设一个标识。
/***********************************************************************
* Copyrights Reserved by QinGeSoftware
* Author : Qinge
* Filename : Bit.h 1.0
* Date: 2008-1-10
************************************************************************/
#pragma once
class Bit
{
public:
void SetScale(int nScale); //伸缩系数
void Set(int x, int y, BOOL bFlog=TRUE); //设置标志位
void Reset(); //标志清零
BOOL CreateBits(int nXBites, int nRows); //创建标志数组
BOOL IsTrue(int x, int y); //查询该位标志
public:
Bit();
virtual ~Bit(void);
private:
unsigned char *m_pBits; //存储位标志的指针
int m_nXBytes; //X方向的字节数
int m_nZRows; //Z方向的行数
int m_nScale; //伸缩系数
};
//类实现文件
/***********************************************************************
* Copyrights Reserved by QinGeSoftware
* Author : Qinge
* Filename : Bit.cpp 1.0
* Date: 2008-1-10
************************************************************************/
#include "StdAfx.h"
#include "Bit.h"
Bit::Bit(void)
{
m_pBits = NULL; //指针初始化为NULL
m_nXBytes = 0;
m_nZRows = 0;
m_nScale = 1; //不能初始化为0,因为是除数
}
Bit::~Bit(void)
{
if(m_pBits != NULL)
{
delete [] m_pBits; //释放指针
m_pBits = NULL; //置为空,否则会成为野指针
}
}
BOOL Bit::CreateBits(int nXBites, int nRows)
{
//nXBits 必须是8的倍数
m_nXBytes = nXBites/8+1; //想想为什么加1
m_nZRows = nRows;
m_pBits = new unsigned char[m_nXBytes * m_nZRows]; //分配空间
memset(m_pBits, 0, m_nZRows * m_nXBytes); //标志段全部初始化0
return 0;
}
void Bit::SetScale(int nScale)
{
m_nScale = nScale; //提供操作私有变量的接口
}
void Bit::Set(int x, int y, BOOL bFlog )
{
x = x / m_nScale; //每隔m_nScale采样
y = y / m_nScale;
unsigned char &c = m_pBits[y * m_nXBytes + x/8]; //获得某字符的引用,注意赋值方式,否则
unsigned char d = 0x80; //后面改了白该。
d = d >>(x%8); //根据X值得不同,首位右移相应位数。移位
// 使得每个节点对应一位。
if(bFlog)
{
c|=d; //把字符C与X相应的位置为1
}
else
{
d = ~d; //和某节点对应的位为0,其余位为1
c &= d; //把字符C与X相应的位置为0
}
}
void Bit::Reset()
{
memset(m_pBits, 0, m_nXBytes * m_nZRows);
}
BOOL Bit::IsTrue(int x, int y)
{
x = x/m_nScale;
y = y/m_nScale;
unsigned char c = m_pBits[y*m_nXBytes+x/8]; //这次不是引用,想想为什么
unsigned char d = 0x80;
c = c
相关文章推荐
- 笔/面试题1--同友笔试
- 让你的web应用更安全
- 安装配置PLSQL Developer
- 链表中环的入口结点
- JAVA基础--接口 interface
- HTML,CSS,font-family:中文字体的英文名称 (宋体 微软雅黑)
- android开发游记:meterial design 5.0 新增控件介绍及使用方法
- runbook
- 用TextView实现button点击效果
- Thinking in Java之衍生类和基础类的初始化顺序
- 智能电网学习2---Section 4和5
- neo4j入门教程-java中使用Cypher操作数据库
- HashMap实现原理分析
- css3 iphone开关 移动端开关、按钮、input
- cookie实时存储 设置cookie值 获取cookie值 删除cookie
- javascript中window.open()与window.location.href的区别
- 1000行代码写小游戏(三)
- pyspider的一个诡异问题
- JavaScript之基础-12 JavaScript 错误处理
- struts2文件下载