プログレス。。。
This commit is contained in:
parent
19a188e059
commit
fe87e22b16
include
lib
osmparser
include
src
triangle
src
|
@ -4,11 +4,24 @@
|
||||||
|
|
||||||
#include <osmrelation.hpp>
|
#include <osmrelation.hpp>
|
||||||
|
|
||||||
|
struct SDL_FPoint;
|
||||||
|
struct SDL_Renderer;
|
||||||
|
|
||||||
class Multipolygon
|
class Multipolygon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Multipolygon(const std::shared_ptr<osmp::Relation>& relation, int width, int height, osmp::Bounds bounds);
|
Multipolygon(const std::shared_ptr<osmp::Relation>& relation, int width, int height, osmp::Bounds bounds);
|
||||||
|
|
||||||
|
void Draw(SDL_Renderer* renderer, int r, int g, int b);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct Vertex {
|
||||||
|
double x, y;
|
||||||
|
};
|
||||||
|
struct Polygon {
|
||||||
|
std::vector<Vertex> vertices;
|
||||||
|
std::vector<int> indices;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Polygon> polygons;
|
||||||
};
|
};
|
|
@ -40,7 +40,7 @@ namespace osmp
|
||||||
// std::map<std::string, std::string> tags;
|
// std::map<std::string, std::string> tags;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned int id;
|
uint64_t id;
|
||||||
std::string user;
|
std::string user;
|
||||||
unsigned int uid;
|
unsigned int uid;
|
||||||
bool visible;
|
bool visible;
|
||||||
|
|
|
@ -15,6 +15,6 @@ namespace osmp
|
||||||
Node(const tinyxml2::XMLElement* xml, Object* parent);
|
Node(const tinyxml2::XMLElement* xml, Object* parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float lat, lon;
|
double lat, lon;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -20,15 +20,15 @@ namespace osmp
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Node>> GetNodes() const;
|
std::vector<std::shared_ptr<Node>> GetNodes() const;
|
||||||
size_t GetNodesSize() const;
|
size_t GetNodesSize() const;
|
||||||
std::shared_ptr<Node> GetNode(unsigned int id) const;
|
std::shared_ptr<Node> GetNode(uint64_t id) const;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Way>> GetWays() const;
|
std::vector<std::shared_ptr<Way>> GetWays() const;
|
||||||
size_t GetWaysSize() const;
|
size_t GetWaysSize() const;
|
||||||
std::shared_ptr<Way> GetWay(unsigned int id) const;
|
std::shared_ptr<Way> GetWay(uint64_t id) const;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Relation>> GetRelations() const;
|
std::vector<std::shared_ptr<Relation>> GetRelations() const;
|
||||||
size_t GetRelationsSize() const;
|
size_t GetRelationsSize() const;
|
||||||
std::shared_ptr<Relation> GetRelation(unsigned int id) const;
|
std::shared_ptr<Relation> GetRelation(uint64_t id) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const std::string version;
|
const std::string version;
|
||||||
|
@ -37,8 +37,8 @@ namespace osmp
|
||||||
Bounds bounds;
|
Bounds bounds;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<unsigned int, std::shared_ptr<Node>> nodes;
|
std::map<uint64_t, std::shared_ptr<Node>> nodes;
|
||||||
std::map<unsigned int, std::shared_ptr<Way>> ways;
|
std::map<uint64_t, std::shared_ptr<Way>> ways;
|
||||||
std::map<unsigned int, std::shared_ptr<Relation>> relations;
|
std::map<uint64_t, std::shared_ptr<Relation>> relations;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -11,11 +11,11 @@ namespace osmp
|
||||||
{
|
{
|
||||||
typedef struct sBounds
|
typedef struct sBounds
|
||||||
{
|
{
|
||||||
float minlat, minlon, maxlat, maxlon;
|
double minlat, minlon, maxlat, maxlon;
|
||||||
} Bounds;
|
} Bounds;
|
||||||
|
|
||||||
std::string GetSafeAttributeString(const tinyxml2::XMLElement* elem, const std::string& name);
|
std::string GetSafeAttributeString(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||||
float GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
|
double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||||
unsigned int GetSafeAttributeUint(const tinyxml2::XMLElement* elem, const std::string& name);
|
uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||||
bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
|
bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||||
}
|
}
|
|
@ -11,12 +11,12 @@ namespace osmp
|
||||||
type(type), parent(parent)
|
type(type), parent(parent)
|
||||||
{
|
{
|
||||||
// Get Attribute
|
// Get Attribute
|
||||||
id = GetSafeAttributeUint(element, "id");
|
id = GetSafeAttributeUint64(element, "id");
|
||||||
user = GetSafeAttributeString(element, "user");
|
user = GetSafeAttributeString(element, "user");
|
||||||
uid = GetSafeAttributeUint(element, "uid");
|
uid = GetSafeAttributeUint64(element, "uid");
|
||||||
visible = GetSafeAttributeBool(element, "visible");
|
visible = GetSafeAttributeBool(element, "visible");
|
||||||
version = GetSafeAttributeString(element, "version");
|
version = GetSafeAttributeString(element, "version");
|
||||||
changeset = GetSafeAttributeUint(element, "changeset");
|
changeset = GetSafeAttributeUint64(element, "changeset");
|
||||||
timestamp = GetSafeAttributeString(element, "timestamp");
|
timestamp = GetSafeAttributeString(element, "timestamp");
|
||||||
|
|
||||||
const xml::XMLElement* tag_element = element->FirstChildElement("tag");
|
const xml::XMLElement* tag_element = element->FirstChildElement("tag");
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace osmp
|
||||||
std::vector<std::shared_ptr<Node>> Object::GetNodes() const
|
std::vector<std::shared_ptr<Node>> Object::GetNodes() const
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<Node>> vecNodes;
|
std::vector<std::shared_ptr<Node>> vecNodes;
|
||||||
for (std::map<unsigned int, std::shared_ptr<Node>>::const_iterator it = nodes.begin(); it != nodes.end(); it++)
|
for (std::map<uint64_t, std::shared_ptr<Node>>::const_iterator it = nodes.begin(); it != nodes.end(); it++)
|
||||||
vecNodes.push_back(it->second);
|
vecNodes.push_back(it->second);
|
||||||
|
|
||||||
return vecNodes;
|
return vecNodes;
|
||||||
|
@ -85,9 +85,9 @@ namespace osmp
|
||||||
return nodes.size();
|
return nodes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Node> Object::GetNode(unsigned int id) const
|
std::shared_ptr<Node> Object::GetNode(uint64_t id) const
|
||||||
{
|
{
|
||||||
std::map<unsigned int, std::shared_ptr<Node>>::const_iterator node = nodes.find(id);
|
std::map<uint64_t, std::shared_ptr<Node>>::const_iterator node = nodes.find(id);
|
||||||
if (node != nodes.end())
|
if (node != nodes.end())
|
||||||
return node->second;
|
return node->second;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace osmp
|
||||||
std::vector<std::shared_ptr<Way>> Object::GetWays() const
|
std::vector<std::shared_ptr<Way>> Object::GetWays() const
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<Way>> vecWays;
|
std::vector<std::shared_ptr<Way>> vecWays;
|
||||||
for (std::map<unsigned int, std::shared_ptr<Way>>::const_iterator it = ways.begin(); it != ways.end(); it++)
|
for (std::map<uint64_t, std::shared_ptr<Way>>::const_iterator it = ways.begin(); it != ways.end(); it++)
|
||||||
vecWays.push_back(it->second);
|
vecWays.push_back(it->second);
|
||||||
|
|
||||||
return vecWays;
|
return vecWays;
|
||||||
|
@ -108,9 +108,9 @@ namespace osmp
|
||||||
return ways.size();
|
return ways.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Way> Object::GetWay(unsigned int id) const
|
std::shared_ptr<Way> Object::GetWay(uint64_t id) const
|
||||||
{
|
{
|
||||||
std::map<unsigned int, std::shared_ptr<Way>>::const_iterator way = ways.find(id);
|
std::map<uint64_t, std::shared_ptr<Way>>::const_iterator way = ways.find(id);
|
||||||
if (way != ways.end())
|
if (way != ways.end())
|
||||||
return way->second;
|
return way->second;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace osmp
|
||||||
std::vector<std::shared_ptr<Relation>> Object::GetRelations() const
|
std::vector<std::shared_ptr<Relation>> Object::GetRelations() const
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<Relation>> vecRelations;
|
std::vector<std::shared_ptr<Relation>> vecRelations;
|
||||||
for (std::map<unsigned int, std::shared_ptr<Relation>>::const_iterator it = relations.begin(); it != relations.end(); it++)
|
for (std::map<uint64_t, std::shared_ptr<Relation>>::const_iterator it = relations.begin(); it != relations.end(); it++)
|
||||||
vecRelations.push_back(it->second);
|
vecRelations.push_back(it->second);
|
||||||
|
|
||||||
return vecRelations;
|
return vecRelations;
|
||||||
|
@ -131,9 +131,9 @@ namespace osmp
|
||||||
return relations.size();
|
return relations.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Relation> Object::GetRelation(unsigned int id) const
|
std::shared_ptr<Relation> Object::GetRelation(uint64_t id) const
|
||||||
{
|
{
|
||||||
std::map<unsigned int, std::shared_ptr<Relation>>::const_iterator relation = relations.find(id);
|
std::map<uint64_t, std::shared_ptr<Relation>>::const_iterator relation = relations.find(id);
|
||||||
if (relation != relations.end())
|
if (relation != relations.end())
|
||||||
return relation->second;
|
return relation->second;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace osmp
|
||||||
while (member_element != nullptr)
|
while (member_element != nullptr)
|
||||||
{
|
{
|
||||||
std::string memberType = GetSafeAttributeString(member_element, "type");
|
std::string memberType = GetSafeAttributeString(member_element, "type");
|
||||||
unsigned int ref = GetSafeAttributeUint(member_element, "ref");
|
uint64_t ref = GetSafeAttributeUint64(member_element, "ref");
|
||||||
std::string role = GetSafeAttributeString(member_element, "role");
|
std::string role = GetSafeAttributeString(member_element, "role");
|
||||||
|
|
||||||
std::shared_ptr<IMember> member = nullptr;
|
std::shared_ptr<IMember> member = nullptr;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace osmp
|
||||||
while (nd_elem != nullptr)
|
while (nd_elem != nullptr)
|
||||||
{
|
{
|
||||||
nodes.push_back(
|
nodes.push_back(
|
||||||
parent->GetNode(GetSafeAttributeUint(nd_elem, "ref"))
|
parent->GetNode(GetSafeAttributeUint64(nd_elem, "ref"))
|
||||||
);
|
);
|
||||||
|
|
||||||
nd_elem = nd_elem->NextSiblingElement("nd");
|
nd_elem = nd_elem->NextSiblingElement("nd");
|
||||||
|
|
|
@ -21,21 +21,20 @@ namespace osmp
|
||||||
return returnStr;
|
return returnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name)
|
double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||||
{
|
{
|
||||||
float returnVal = 0.0f;
|
double returnVal = 0.0f;
|
||||||
|
|
||||||
xml::XMLError result = elem->QueryFloatAttribute(name.c_str(), &returnVal);
|
xml::XMLError result = elem->QueryDoubleAttribute(name.c_str(), &returnVal);
|
||||||
|
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GetSafeAttributeUint(const tinyxml2::XMLElement* elem, const std::string& name)
|
uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||||
{
|
{
|
||||||
unsigned int returnVal = 0;
|
uint64_t returnVal = 0;
|
||||||
|
|
||||||
xml::XMLError result = elem->QueryUnsignedAttribute(name.c_str(), &returnVal);
|
|
||||||
|
|
||||||
|
xml::XMLError result = elem->QueryUnsigned64Attribute(name.c_str(), &returnVal);
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ file(GLOB_RECURSE HPP_FILES
|
||||||
"include/*.h"
|
"include/*.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( ${CPP_FILES} PROPERTIES LANGUAGE CXX )
|
||||||
|
|
||||||
add_library(triangle STATIC
|
add_library(triangle STATIC
|
||||||
${CPP_FILES} ${HPP_FILES}
|
${CPP_FILES} ${HPP_FILES}
|
||||||
)
|
)
|
||||||
|
|
|
@ -381,8 +381,8 @@ enum insertvertexresult {SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX,
|
||||||
|
|
||||||
/* Labels that signify the result of direction finding. The result */
|
/* Labels that signify the result of direction finding. The result */
|
||||||
/* indicates that a segment connecting the two query points falls within */
|
/* indicates that a segment connecting the two query points falls within */
|
||||||
/* the direction triangle, along the left edge of the direction triangle, */
|
/* the direction triangle, a__int64 the left edge of the direction triangle, */
|
||||||
/* or along the right edge of the direction triangle. */
|
/* or a__int64 the right edge of the direction triangle. */
|
||||||
|
|
||||||
enum finddirectionresult {WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR};
|
enum finddirectionresult {WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR};
|
||||||
|
|
||||||
|
@ -586,12 +586,12 @@ struct event {
|
||||||
/* A node in the splay tree. Each node holds an oriented ghost triangle */
|
/* A node in the splay tree. Each node holds an oriented ghost triangle */
|
||||||
/* that represents a boundary edge of the growing triangulation. When a */
|
/* that represents a boundary edge of the growing triangulation. When a */
|
||||||
/* circle event covers two boundary edges with a triangle, so that they */
|
/* circle event covers two boundary edges with a triangle, so that they */
|
||||||
/* are no longer boundary edges, those edges are not immediately deleted */
|
/* are no __int64er boundary edges, those edges are not immediately deleted */
|
||||||
/* from the tree; rather, they are lazily deleted when they are next */
|
/* from the tree; rather, they are lazily deleted when they are next */
|
||||||
/* encountered. (Since only a random sample of boundary edges are kept */
|
/* encountered. (Since only a random sample of boundary edges are kept */
|
||||||
/* in the tree, lazy deletion is faster.) `keydest' is used to verify */
|
/* in the tree, lazy deletion is faster.) `keydest' is used to verify */
|
||||||
/* that a triangle is still the same as when it entered the splay tree; if */
|
/* that a triangle is still the same as when it entered the splay tree; if */
|
||||||
/* it has been rotated (due to a circle event), it no longer represents a */
|
/* it has been rotated (due to a circle event), it no __int64er represents a */
|
||||||
/* boundary edge and should be deleted. */
|
/* boundary edge and should be deleted. */
|
||||||
|
|
||||||
struct splaynode {
|
struct splaynode {
|
||||||
|
@ -633,7 +633,7 @@ struct memorypool {
|
||||||
int itembytes;
|
int itembytes;
|
||||||
int itemsperblock;
|
int itemsperblock;
|
||||||
int itemsfirstblock;
|
int itemsfirstblock;
|
||||||
long items, maxitems;
|
__int64 items, maxitems;
|
||||||
int unallocateditems;
|
int unallocateditems;
|
||||||
int pathitemsleft;
|
int pathitemsleft;
|
||||||
};
|
};
|
||||||
|
@ -650,7 +650,7 @@ REAL o3derrboundA, o3derrboundB, o3derrboundC;
|
||||||
|
|
||||||
/* Random number seed is not constant, but I've made it global anyway. */
|
/* Random number seed is not constant, but I've made it global anyway. */
|
||||||
|
|
||||||
unsigned long randomseed; /* Current random number seed. */
|
unsigned __int64 randomseed; /* Current random number seed. */
|
||||||
|
|
||||||
|
|
||||||
/* Mesh data structure. Triangle operates on only one mesh, but the mesh */
|
/* Mesh data structure. Triangle operates on only one mesh, but the mesh */
|
||||||
|
@ -693,11 +693,11 @@ struct mesh {
|
||||||
int holes; /* Number of input holes. */
|
int holes; /* Number of input holes. */
|
||||||
int regions; /* Number of input regions. */
|
int regions; /* Number of input regions. */
|
||||||
int undeads; /* Number of input vertices that don't appear in the mesh. */
|
int undeads; /* Number of input vertices that don't appear in the mesh. */
|
||||||
long edges; /* Number of output edges. */
|
__int64 edges; /* Number of output edges. */
|
||||||
int mesh_dim; /* Dimension (ought to be 2). */
|
int mesh_dim; /* Dimension (ought to be 2). */
|
||||||
int nextras; /* Number of attributes per vertex. */
|
int nextras; /* Number of attributes per vertex. */
|
||||||
int eextras; /* Number of attributes per triangle. */
|
int eextras; /* Number of attributes per triangle. */
|
||||||
long hullsize; /* Number of edges in convex hull. */
|
__int64 hullsize; /* Number of edges in convex hull. */
|
||||||
int steinerleft; /* Number of Steiner points not yet used. */
|
int steinerleft; /* Number of Steiner points not yet used. */
|
||||||
int vertexmarkindex; /* Index to find boundary marker of a vertex. */
|
int vertexmarkindex; /* Index to find boundary marker of a vertex. */
|
||||||
int vertex2triindex; /* Index to find a triangle adjacent to a vertex. */
|
int vertex2triindex; /* Index to find a triangle adjacent to a vertex. */
|
||||||
|
@ -707,14 +707,14 @@ struct mesh {
|
||||||
int checksegments; /* Are there segments in the triangulation yet? */
|
int checksegments; /* Are there segments in the triangulation yet? */
|
||||||
int checkquality; /* Has quality triangulation begun yet? */
|
int checkquality; /* Has quality triangulation begun yet? */
|
||||||
int readnodefile; /* Has a .node file been read? */
|
int readnodefile; /* Has a .node file been read? */
|
||||||
long samples; /* Number of random samples for point location. */
|
__int64 samples; /* Number of random samples for point location. */
|
||||||
|
|
||||||
long incirclecount; /* Number of incircle tests performed. */
|
__int64 incirclecount; /* Number of incircle tests performed. */
|
||||||
long counterclockcount; /* Number of counterclockwise tests performed. */
|
__int64 counterclockcount; /* Number of counterclockwise tests performed. */
|
||||||
long orient3dcount; /* Number of 3D orientation tests performed. */
|
__int64 orient3dcount; /* Number of 3D orientation tests performed. */
|
||||||
long hyperbolacount; /* Number of right-of-hyperbola tests performed. */
|
__int64 hyperbolacount; /* Number of right-of-hyperbola tests performed. */
|
||||||
long circumcentercount; /* Number of circumcenter calculations performed. */
|
__int64 circumcentercount; /* Number of circumcenter calculations performed. */
|
||||||
long circletopcount; /* Number of circle top calculations performed. */
|
__int64 circletopcount; /* Number of circle top calculations performed. */
|
||||||
|
|
||||||
/* Triangular bounding box vertices. */
|
/* Triangular bounding box vertices. */
|
||||||
|
|
||||||
|
@ -827,8 +827,8 @@ struct behavior {
|
||||||
/* extracting an orientation (in the range 0 to 2) and a pointer to the */
|
/* extracting an orientation (in the range 0 to 2) and a pointer to the */
|
||||||
/* beginning of a triangle. The encode() routine compresses a pointer to a */
|
/* beginning of a triangle. The encode() routine compresses a pointer to a */
|
||||||
/* triangle and an orientation into a single pointer. My assumptions that */
|
/* triangle and an orientation into a single pointer. My assumptions that */
|
||||||
/* triangles are four-byte-aligned and that the `unsigned long' type is */
|
/* triangles are four-byte-aligned and that the `unsigned __int64' type is */
|
||||||
/* long enough to hold a pointer are two of the few kludges in this program.*/
|
/* __int64 enough to hold a pointer are two of the few kludges in this program.*/
|
||||||
/* */
|
/* */
|
||||||
/* Subsegments are manipulated similarly. A pointer to a subsegment */
|
/* Subsegments are manipulated similarly. A pointer to a subsegment */
|
||||||
/* carries both an address and an orientation in the range 0 to 1. */
|
/* carries both an address and an orientation in the range 0 to 1. */
|
||||||
|
@ -938,16 +938,16 @@ int minus1mod3[3] = {2, 0, 1};
|
||||||
/* extracted from the two least significant bits of the pointer. */
|
/* extracted from the two least significant bits of the pointer. */
|
||||||
|
|
||||||
#define decode(ptr, otri) \
|
#define decode(ptr, otri) \
|
||||||
(otri).orient = (int) ((unsigned long) (ptr) & (unsigned long) 3l); \
|
(otri).orient = (int) ((unsigned __int64) (ptr) & (unsigned __int64) 3l); \
|
||||||
(otri).tri = (triangle *) \
|
(otri).tri = (triangle *) \
|
||||||
((unsigned long) (ptr) ^ (unsigned long) (otri).orient)
|
((unsigned __int64) (ptr) ^ (unsigned __int64) (otri).orient)
|
||||||
|
|
||||||
/* encode() compresses an oriented triangle into a single pointer. It */
|
/* encode() compresses an oriented triangle into a single pointer. It */
|
||||||
/* relies on the assumption that all triangles are aligned to four-byte */
|
/* relies on the assumption that all triangles are aligned to four-byte */
|
||||||
/* boundaries, so the two least significant bits of (otri).tri are zero. */
|
/* boundaries, so the two least significant bits of (otri).tri are zero. */
|
||||||
|
|
||||||
#define encode(otri) \
|
#define encode(otri) \
|
||||||
(triangle) ((unsigned long) (otri).tri | (unsigned long) (otri).orient)
|
(triangle) ((unsigned __int64) (otri).tri | (unsigned __int64) (otri).orient)
|
||||||
|
|
||||||
/* The following handle manipulation primitives are all described by Guibas */
|
/* The following handle manipulation primitives are all described by Guibas */
|
||||||
/* and Stolfi. However, Guibas and Stolfi use an edge-based data */
|
/* and Stolfi. However, Guibas and Stolfi use an edge-based data */
|
||||||
|
@ -1111,16 +1111,16 @@ int minus1mod3[3] = {2, 0, 1};
|
||||||
|
|
||||||
#define infect(otri) \
|
#define infect(otri) \
|
||||||
(otri).tri[6] = (triangle) \
|
(otri).tri[6] = (triangle) \
|
||||||
((unsigned long) (otri).tri[6] | (unsigned long) 2l)
|
((unsigned __int64) (otri).tri[6] | (unsigned __int64) 2l)
|
||||||
|
|
||||||
#define uninfect(otri) \
|
#define uninfect(otri) \
|
||||||
(otri).tri[6] = (triangle) \
|
(otri).tri[6] = (triangle) \
|
||||||
((unsigned long) (otri).tri[6] & ~ (unsigned long) 2l)
|
((unsigned __int64) (otri).tri[6] & ~ (unsigned __int64) 2l)
|
||||||
|
|
||||||
/* Test a triangle for viral infection. */
|
/* Test a triangle for viral infection. */
|
||||||
|
|
||||||
#define infected(otri) \
|
#define infected(otri) \
|
||||||
(((unsigned long) (otri).tri[6] & (unsigned long) 2l) != 0l)
|
(((unsigned __int64) (otri).tri[6] & (unsigned __int64) 2l) != 0l)
|
||||||
|
|
||||||
/* Check or set a triangle's attributes. */
|
/* Check or set a triangle's attributes. */
|
||||||
|
|
||||||
|
@ -1158,16 +1158,16 @@ int minus1mod3[3] = {2, 0, 1};
|
||||||
/* are masked out to produce the real pointer. */
|
/* are masked out to produce the real pointer. */
|
||||||
|
|
||||||
#define sdecode(sptr, osub) \
|
#define sdecode(sptr, osub) \
|
||||||
(osub).ssorient = (int) ((unsigned long) (sptr) & (unsigned long) 1l); \
|
(osub).ssorient = (int) ((unsigned __int64) (sptr) & (unsigned __int64) 1l); \
|
||||||
(osub).ss = (subseg *) \
|
(osub).ss = (subseg *) \
|
||||||
((unsigned long) (sptr) & ~ (unsigned long) 3l)
|
((unsigned __int64) (sptr) & ~ (unsigned __int64) 3l)
|
||||||
|
|
||||||
/* sencode() compresses an oriented subsegment into a single pointer. It */
|
/* sencode() compresses an oriented subsegment into a single pointer. It */
|
||||||
/* relies on the assumption that all subsegments are aligned to two-byte */
|
/* relies on the assumption that all subsegments are aligned to two-byte */
|
||||||
/* boundaries, so the least significant bit of (osub).ss is zero. */
|
/* boundaries, so the least significant bit of (osub).ss is zero. */
|
||||||
|
|
||||||
#define sencode(osub) \
|
#define sencode(osub) \
|
||||||
(subseg) ((unsigned long) (osub).ss | (unsigned long) (osub).ssorient)
|
(subseg) ((unsigned __int64) (osub).ss | (unsigned __int64) (osub).ssorient)
|
||||||
|
|
||||||
/* ssym() toggles the orientation of a subsegment. */
|
/* ssym() toggles the orientation of a subsegment. */
|
||||||
|
|
||||||
|
@ -1386,7 +1386,7 @@ REAL area; /* The area of the triangle. */
|
||||||
oalen = dxoa * dxoa + dyoa * dyoa;
|
oalen = dxoa * dxoa + dyoa * dyoa;
|
||||||
dalen = dxda * dxda + dyda * dyda;
|
dalen = dxda * dxda + dyda * dyda;
|
||||||
odlen = dxod * dxod + dyod * dyod;
|
odlen = dxod * dxod + dyod * dyod;
|
||||||
/* Find the square of the length of the longest edge. */
|
/* Find the square of the length of the __int64est edge. */
|
||||||
maxlen = (dalen > oalen) ? dalen : oalen;
|
maxlen = (dalen > oalen) ? dalen : oalen;
|
||||||
maxlen = (odlen > maxlen) ? odlen : maxlen;
|
maxlen = (odlen > maxlen) ? odlen : maxlen;
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ void info()
|
||||||
printf(
|
printf(
|
||||||
" -A Assigns an additional floating-point attribute to each triangle\n");
|
" -A Assigns an additional floating-point attribute to each triangle\n");
|
||||||
printf(
|
printf(
|
||||||
" that identifies what segment-bounded region each triangle belongs\n");
|
" that identifies what segment-bounded region each triangle be__int64s\n");
|
||||||
printf(
|
printf(
|
||||||
" to. Attributes are assigned to regions by the .poly file. If a\n");
|
" to. Attributes are assigned to regions by the .poly file. If a\n");
|
||||||
printf(
|
printf(
|
||||||
|
@ -2277,7 +2277,7 @@ void info()
|
||||||
printf(
|
printf(
|
||||||
" Triangle calculates the intersection points for you and adds them to\n");
|
" Triangle calculates the intersection points for you and adds them to\n");
|
||||||
printf(
|
printf(
|
||||||
" the triangulation--as long as your machine's floating-point precision\n");
|
" the triangulation--as __int64 as your machine's floating-point precision\n");
|
||||||
printf(
|
printf(
|
||||||
" doesn't become a problem. You are tempting the fates if you have three\n"
|
" doesn't become a problem. You are tempting the fates if you have three\n"
|
||||||
);
|
);
|
||||||
|
@ -3143,10 +3143,10 @@ void info()
|
||||||
printf(
|
printf(
|
||||||
" row of evenly spaced, segment-connected vertices? Have you simply\n");
|
" row of evenly spaced, segment-connected vertices? Have you simply\n");
|
||||||
printf(
|
printf(
|
||||||
" defined one long segment connecting the leftmost vertex to the rightmost\n"
|
" defined one __int64 segment connecting the leftmost vertex to the rightmost\n"
|
||||||
);
|
);
|
||||||
printf(
|
printf(
|
||||||
" vertex, and a bunch of vertices lying along it? This method occasionally\n"
|
" vertex, and a bunch of vertices lying a__int64 it? This method occasionally\n"
|
||||||
);
|
);
|
||||||
printf(
|
printf(
|
||||||
" works, especially with horizontal and vertical lines, but often it\n");
|
" works, especially with horizontal and vertical lines, but often it\n");
|
||||||
|
@ -3675,27 +3675,27 @@ struct otri *t;
|
||||||
struct osub printsh;
|
struct osub printsh;
|
||||||
vertex printvertex;
|
vertex printvertex;
|
||||||
|
|
||||||
printf("triangle x%lx with orientation %d:\n", (unsigned long) t->tri,
|
printf("triangle x%lx with orientation %d:\n", (unsigned __int64) t->tri,
|
||||||
t->orient);
|
t->orient);
|
||||||
decode(t->tri[0], printtri);
|
decode(t->tri[0], printtri);
|
||||||
if (printtri.tri == m->dummytri) {
|
if (printtri.tri == m->dummytri) {
|
||||||
printf(" [0] = Outer space\n");
|
printf(" [0] = Outer space\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [0] = x%lx %d\n", (unsigned long) printtri.tri,
|
printf(" [0] = x%lx %d\n", (unsigned __int64) printtri.tri,
|
||||||
printtri.orient);
|
printtri.orient);
|
||||||
}
|
}
|
||||||
decode(t->tri[1], printtri);
|
decode(t->tri[1], printtri);
|
||||||
if (printtri.tri == m->dummytri) {
|
if (printtri.tri == m->dummytri) {
|
||||||
printf(" [1] = Outer space\n");
|
printf(" [1] = Outer space\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [1] = x%lx %d\n", (unsigned long) printtri.tri,
|
printf(" [1] = x%lx %d\n", (unsigned __int64) printtri.tri,
|
||||||
printtri.orient);
|
printtri.orient);
|
||||||
}
|
}
|
||||||
decode(t->tri[2], printtri);
|
decode(t->tri[2], printtri);
|
||||||
if (printtri.tri == m->dummytri) {
|
if (printtri.tri == m->dummytri) {
|
||||||
printf(" [2] = Outer space\n");
|
printf(" [2] = Outer space\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [2] = x%lx %d\n", (unsigned long) printtri.tri,
|
printf(" [2] = x%lx %d\n", (unsigned __int64) printtri.tri,
|
||||||
printtri.orient);
|
printtri.orient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3704,37 +3704,37 @@ struct otri *t;
|
||||||
printf(" Origin[%d] = NULL\n", (t->orient + 1) % 3 + 3);
|
printf(" Origin[%d] = NULL\n", (t->orient + 1) % 3 + 3);
|
||||||
else
|
else
|
||||||
printf(" Origin[%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Origin[%d] = x%lx (%.12g, %.12g)\n",
|
||||||
(t->orient + 1) % 3 + 3, (unsigned long) printvertex,
|
(t->orient + 1) % 3 + 3, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
dest(*t, printvertex);
|
dest(*t, printvertex);
|
||||||
if (printvertex == (vertex) NULL)
|
if (printvertex == (vertex) NULL)
|
||||||
printf(" Dest [%d] = NULL\n", (t->orient + 2) % 3 + 3);
|
printf(" Dest [%d] = NULL\n", (t->orient + 2) % 3 + 3);
|
||||||
else
|
else
|
||||||
printf(" Dest [%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Dest [%d] = x%lx (%.12g, %.12g)\n",
|
||||||
(t->orient + 2) % 3 + 3, (unsigned long) printvertex,
|
(t->orient + 2) % 3 + 3, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
apex(*t, printvertex);
|
apex(*t, printvertex);
|
||||||
if (printvertex == (vertex) NULL)
|
if (printvertex == (vertex) NULL)
|
||||||
printf(" Apex [%d] = NULL\n", t->orient + 3);
|
printf(" Apex [%d] = NULL\n", t->orient + 3);
|
||||||
else
|
else
|
||||||
printf(" Apex [%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Apex [%d] = x%lx (%.12g, %.12g)\n",
|
||||||
t->orient + 3, (unsigned long) printvertex,
|
t->orient + 3, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
|
|
||||||
if (b->usesegments) {
|
if (b->usesegments) {
|
||||||
sdecode(t->tri[6], printsh);
|
sdecode(t->tri[6], printsh);
|
||||||
if (printsh.ss != m->dummysub) {
|
if (printsh.ss != m->dummysub) {
|
||||||
printf(" [6] = x%lx %d\n", (unsigned long) printsh.ss,
|
printf(" [6] = x%lx %d\n", (unsigned __int64) printsh.ss,
|
||||||
printsh.ssorient);
|
printsh.ssorient);
|
||||||
}
|
}
|
||||||
sdecode(t->tri[7], printsh);
|
sdecode(t->tri[7], printsh);
|
||||||
if (printsh.ss != m->dummysub) {
|
if (printsh.ss != m->dummysub) {
|
||||||
printf(" [7] = x%lx %d\n", (unsigned long) printsh.ss,
|
printf(" [7] = x%lx %d\n", (unsigned __int64) printsh.ss,
|
||||||
printsh.ssorient);
|
printsh.ssorient);
|
||||||
}
|
}
|
||||||
sdecode(t->tri[8], printsh);
|
sdecode(t->tri[8], printsh);
|
||||||
if (printsh.ss != m->dummysub) {
|
if (printsh.ss != m->dummysub) {
|
||||||
printf(" [8] = x%lx %d\n", (unsigned long) printsh.ss,
|
printf(" [8] = x%lx %d\n", (unsigned __int64) printsh.ss,
|
||||||
printsh.ssorient);
|
printsh.ssorient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3770,19 +3770,19 @@ struct osub *s;
|
||||||
vertex printvertex;
|
vertex printvertex;
|
||||||
|
|
||||||
printf("subsegment x%lx with orientation %d and mark %d:\n",
|
printf("subsegment x%lx with orientation %d and mark %d:\n",
|
||||||
(unsigned long) s->ss, s->ssorient, mark(*s));
|
(unsigned __int64) s->ss, s->ssorient, mark(*s));
|
||||||
sdecode(s->ss[0], printsh);
|
sdecode(s->ss[0], printsh);
|
||||||
if (printsh.ss == m->dummysub) {
|
if (printsh.ss == m->dummysub) {
|
||||||
printf(" [0] = No subsegment\n");
|
printf(" [0] = No subsegment\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [0] = x%lx %d\n", (unsigned long) printsh.ss,
|
printf(" [0] = x%lx %d\n", (unsigned __int64) printsh.ss,
|
||||||
printsh.ssorient);
|
printsh.ssorient);
|
||||||
}
|
}
|
||||||
sdecode(s->ss[1], printsh);
|
sdecode(s->ss[1], printsh);
|
||||||
if (printsh.ss == m->dummysub) {
|
if (printsh.ss == m->dummysub) {
|
||||||
printf(" [1] = No subsegment\n");
|
printf(" [1] = No subsegment\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [1] = x%lx %d\n", (unsigned long) printsh.ss,
|
printf(" [1] = x%lx %d\n", (unsigned __int64) printsh.ss,
|
||||||
printsh.ssorient);
|
printsh.ssorient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3791,28 +3791,28 @@ struct osub *s;
|
||||||
printf(" Origin[%d] = NULL\n", 2 + s->ssorient);
|
printf(" Origin[%d] = NULL\n", 2 + s->ssorient);
|
||||||
else
|
else
|
||||||
printf(" Origin[%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Origin[%d] = x%lx (%.12g, %.12g)\n",
|
||||||
2 + s->ssorient, (unsigned long) printvertex,
|
2 + s->ssorient, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
sdest(*s, printvertex);
|
sdest(*s, printvertex);
|
||||||
if (printvertex == (vertex) NULL)
|
if (printvertex == (vertex) NULL)
|
||||||
printf(" Dest [%d] = NULL\n", 3 - s->ssorient);
|
printf(" Dest [%d] = NULL\n", 3 - s->ssorient);
|
||||||
else
|
else
|
||||||
printf(" Dest [%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Dest [%d] = x%lx (%.12g, %.12g)\n",
|
||||||
3 - s->ssorient, (unsigned long) printvertex,
|
3 - s->ssorient, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
|
|
||||||
decode(s->ss[6], printtri);
|
decode(s->ss[6], printtri);
|
||||||
if (printtri.tri == m->dummytri) {
|
if (printtri.tri == m->dummytri) {
|
||||||
printf(" [6] = Outer space\n");
|
printf(" [6] = Outer space\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [6] = x%lx %d\n", (unsigned long) printtri.tri,
|
printf(" [6] = x%lx %d\n", (unsigned __int64) printtri.tri,
|
||||||
printtri.orient);
|
printtri.orient);
|
||||||
}
|
}
|
||||||
decode(s->ss[7], printtri);
|
decode(s->ss[7], printtri);
|
||||||
if (printtri.tri == m->dummytri) {
|
if (printtri.tri == m->dummytri) {
|
||||||
printf(" [7] = Outer space\n");
|
printf(" [7] = Outer space\n");
|
||||||
} else {
|
} else {
|
||||||
printf(" [7] = x%lx %d\n", (unsigned long) printtri.tri,
|
printf(" [7] = x%lx %d\n", (unsigned __int64) printtri.tri,
|
||||||
printtri.orient);
|
printtri.orient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3821,14 +3821,14 @@ struct osub *s;
|
||||||
printf(" Segment origin[%d] = NULL\n", 4 + s->ssorient);
|
printf(" Segment origin[%d] = NULL\n", 4 + s->ssorient);
|
||||||
else
|
else
|
||||||
printf(" Segment origin[%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Segment origin[%d] = x%lx (%.12g, %.12g)\n",
|
||||||
4 + s->ssorient, (unsigned long) printvertex,
|
4 + s->ssorient, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
segdest(*s, printvertex);
|
segdest(*s, printvertex);
|
||||||
if (printvertex == (vertex) NULL)
|
if (printvertex == (vertex) NULL)
|
||||||
printf(" Segment dest [%d] = NULL\n", 5 - s->ssorient);
|
printf(" Segment dest [%d] = NULL\n", 5 - s->ssorient);
|
||||||
else
|
else
|
||||||
printf(" Segment dest [%d] = x%lx (%.12g, %.12g)\n",
|
printf(" Segment dest [%d] = x%lx (%.12g, %.12g)\n",
|
||||||
5 - s->ssorient, (unsigned long) printvertex,
|
5 - s->ssorient, (unsigned __int64) printvertex,
|
||||||
printvertex[0], printvertex[1]);
|
printvertex[0], printvertex[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3891,7 +3891,7 @@ struct memorypool *pool;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
|
|
||||||
pool->items = 0;
|
pool->items = 0;
|
||||||
pool->maxitems = 0;
|
pool->maxitems = 0;
|
||||||
|
@ -3899,11 +3899,11 @@ struct memorypool *pool;
|
||||||
/* Set the currently active block. */
|
/* Set the currently active block. */
|
||||||
pool->nowblock = pool->firstblock;
|
pool->nowblock = pool->firstblock;
|
||||||
/* Find the first item in the pool. Increment by the size of (VOID *). */
|
/* Find the first item in the pool. Increment by the size of (VOID *). */
|
||||||
alignptr = (unsigned long) (pool->nowblock + 1);
|
alignptr = (unsigned __int64) (pool->nowblock + 1);
|
||||||
/* Align the item on an `alignbytes'-byte boundary. */
|
/* Align the item on an `alignbytes'-byte boundary. */
|
||||||
pool->nextitem = (VOID *)
|
pool->nextitem = (VOID *)
|
||||||
(alignptr + (unsigned long) pool->alignbytes -
|
(alignptr + (unsigned __int64) pool->alignbytes -
|
||||||
(alignptr % (unsigned long) pool->alignbytes));
|
(alignptr % (unsigned __int64) pool->alignbytes));
|
||||||
/* There are lots of unallocated items left in this block. */
|
/* There are lots of unallocated items left in this block. */
|
||||||
pool->unallocateditems = pool->itemsfirstblock;
|
pool->unallocateditems = pool->itemsfirstblock;
|
||||||
/* The stack of deallocated items is empty. */
|
/* The stack of deallocated items is empty. */
|
||||||
|
@ -4008,7 +4008,7 @@ struct memorypool *pool;
|
||||||
{
|
{
|
||||||
VOID *newitem;
|
VOID *newitem;
|
||||||
VOID **newblock;
|
VOID **newblock;
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
|
|
||||||
/* First check the linked list of dead items. If the list is not */
|
/* First check the linked list of dead items. If the list is not */
|
||||||
/* empty, allocate an item from the list rather than a fresh one. */
|
/* empty, allocate an item from the list rather than a fresh one. */
|
||||||
|
@ -4033,11 +4033,11 @@ struct memorypool *pool;
|
||||||
pool->nowblock = (VOID **) *(pool->nowblock);
|
pool->nowblock = (VOID **) *(pool->nowblock);
|
||||||
/* Find the first item in the block. */
|
/* Find the first item in the block. */
|
||||||
/* Increment by the size of (VOID *). */
|
/* Increment by the size of (VOID *). */
|
||||||
alignptr = (unsigned long) (pool->nowblock + 1);
|
alignptr = (unsigned __int64) (pool->nowblock + 1);
|
||||||
/* Align the item on an `alignbytes'-byte boundary. */
|
/* Align the item on an `alignbytes'-byte boundary. */
|
||||||
pool->nextitem = (VOID *)
|
pool->nextitem = (VOID *)
|
||||||
(alignptr + (unsigned long) pool->alignbytes -
|
(alignptr + (unsigned __int64) pool->alignbytes -
|
||||||
(alignptr % (unsigned long) pool->alignbytes));
|
(alignptr % (unsigned __int64) pool->alignbytes));
|
||||||
/* There are lots of unallocated items left in this block. */
|
/* There are lots of unallocated items left in this block. */
|
||||||
pool->unallocateditems = pool->itemsperblock;
|
pool->unallocateditems = pool->itemsperblock;
|
||||||
}
|
}
|
||||||
|
@ -4092,16 +4092,16 @@ struct memorypool *pool;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
|
|
||||||
/* Begin the traversal in the first block. */
|
/* Begin the traversal in the first block. */
|
||||||
pool->pathblock = pool->firstblock;
|
pool->pathblock = pool->firstblock;
|
||||||
/* Find the first item in the block. Increment by the size of (VOID *). */
|
/* Find the first item in the block. Increment by the size of (VOID *). */
|
||||||
alignptr = (unsigned long) (pool->pathblock + 1);
|
alignptr = (unsigned __int64) (pool->pathblock + 1);
|
||||||
/* Align with item on an `alignbytes'-byte boundary. */
|
/* Align with item on an `alignbytes'-byte boundary. */
|
||||||
pool->pathitem = (VOID *)
|
pool->pathitem = (VOID *)
|
||||||
(alignptr + (unsigned long) pool->alignbytes -
|
(alignptr + (unsigned __int64) pool->alignbytes -
|
||||||
(alignptr % (unsigned long) pool->alignbytes));
|
(alignptr % (unsigned __int64) pool->alignbytes));
|
||||||
/* Set the number of items left in the current block. */
|
/* Set the number of items left in the current block. */
|
||||||
pool->pathitemsleft = pool->itemsfirstblock;
|
pool->pathitemsleft = pool->itemsfirstblock;
|
||||||
}
|
}
|
||||||
|
@ -4129,7 +4129,7 @@ struct memorypool *pool;
|
||||||
|
|
||||||
{
|
{
|
||||||
VOID *newitem;
|
VOID *newitem;
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
|
|
||||||
/* Stop upon exhausting the list of items. */
|
/* Stop upon exhausting the list of items. */
|
||||||
if (pool->pathitem == pool->nextitem) {
|
if (pool->pathitem == pool->nextitem) {
|
||||||
|
@ -4141,11 +4141,11 @@ struct memorypool *pool;
|
||||||
/* Find the next block. */
|
/* Find the next block. */
|
||||||
pool->pathblock = (VOID **) *(pool->pathblock);
|
pool->pathblock = (VOID **) *(pool->pathblock);
|
||||||
/* Find the first item in the block. Increment by the size of (VOID *). */
|
/* Find the first item in the block. Increment by the size of (VOID *). */
|
||||||
alignptr = (unsigned long) (pool->pathblock + 1);
|
alignptr = (unsigned __int64) (pool->pathblock + 1);
|
||||||
/* Align with item on an `alignbytes'-byte boundary. */
|
/* Align with item on an `alignbytes'-byte boundary. */
|
||||||
pool->pathitem = (VOID *)
|
pool->pathitem = (VOID *)
|
||||||
(alignptr + (unsigned long) pool->alignbytes -
|
(alignptr + (unsigned __int64) pool->alignbytes -
|
||||||
(alignptr % (unsigned long) pool->alignbytes));
|
(alignptr % (unsigned __int64) pool->alignbytes));
|
||||||
/* Set the number of items left in the current block. */
|
/* Set the number of items left in the current block. */
|
||||||
pool->pathitemsleft = pool->itemsperblock;
|
pool->pathitemsleft = pool->itemsperblock;
|
||||||
}
|
}
|
||||||
|
@ -4197,19 +4197,19 @@ int subsegbytes;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
|
|
||||||
/* Set up `dummytri', the `triangle' that occupies "outer space." */
|
/* Set up `dummytri', the `triangle' that occupies "outer space." */
|
||||||
m->dummytribase = (triangle *) trimalloc(trianglebytes +
|
m->dummytribase = (triangle *) trimalloc(trianglebytes +
|
||||||
m->triangles.alignbytes);
|
m->triangles.alignbytes);
|
||||||
/* Align `dummytri' on a `triangles.alignbytes'-byte boundary. */
|
/* Align `dummytri' on a `triangles.alignbytes'-byte boundary. */
|
||||||
alignptr = (unsigned long) m->dummytribase;
|
alignptr = (unsigned __int64) m->dummytribase;
|
||||||
m->dummytri = (triangle *)
|
m->dummytri = (triangle *)
|
||||||
(alignptr + (unsigned long) m->triangles.alignbytes -
|
(alignptr + (unsigned __int64) m->triangles.alignbytes -
|
||||||
(alignptr % (unsigned long) m->triangles.alignbytes));
|
(alignptr % (unsigned __int64) m->triangles.alignbytes));
|
||||||
/* Initialize the three adjoining triangles to be "outer space." These */
|
/* Initialize the three adjoining triangles to be "outer space." These */
|
||||||
/* will eventually be changed by various bonding operations, but their */
|
/* will eventually be changed by various bonding operations, but their */
|
||||||
/* values don't really matter, as long as they can legally be */
|
/* values don't really matter, as __int64 as they can legally be */
|
||||||
/* dereferenced. */
|
/* dereferenced. */
|
||||||
m->dummytri[0] = (triangle) m->dummytri;
|
m->dummytri[0] = (triangle) m->dummytri;
|
||||||
m->dummytri[1] = (triangle) m->dummytri;
|
m->dummytri[1] = (triangle) m->dummytri;
|
||||||
|
@ -4226,13 +4226,13 @@ int subsegbytes;
|
||||||
m->dummysubbase = (subseg *) trimalloc(subsegbytes +
|
m->dummysubbase = (subseg *) trimalloc(subsegbytes +
|
||||||
m->subsegs.alignbytes);
|
m->subsegs.alignbytes);
|
||||||
/* Align `dummysub' on a `subsegs.alignbytes'-byte boundary. */
|
/* Align `dummysub' on a `subsegs.alignbytes'-byte boundary. */
|
||||||
alignptr = (unsigned long) m->dummysubbase;
|
alignptr = (unsigned __int64) m->dummysubbase;
|
||||||
m->dummysub = (subseg *)
|
m->dummysub = (subseg *)
|
||||||
(alignptr + (unsigned long) m->subsegs.alignbytes -
|
(alignptr + (unsigned __int64) m->subsegs.alignbytes -
|
||||||
(alignptr % (unsigned long) m->subsegs.alignbytes));
|
(alignptr % (unsigned __int64) m->subsegs.alignbytes));
|
||||||
/* Initialize the two adjoining subsegments to be the omnipresent */
|
/* Initialize the two adjoining subsegments to be the omnipresent */
|
||||||
/* subsegment. These will eventually be changed by various bonding */
|
/* subsegment. These will eventually be changed by various bonding */
|
||||||
/* operations, but their values don't really matter, as long as they */
|
/* operations, but their values don't really matter, as __int64 as they */
|
||||||
/* can legally be dereferenced. */
|
/* can legally be dereferenced. */
|
||||||
m->dummysub[0] = (subseg) m->dummysub;
|
m->dummysub[0] = (subseg) m->dummysub;
|
||||||
m->dummysub[1] = (subseg) m->dummysub;
|
m->dummysub[1] = (subseg) m->dummysub;
|
||||||
|
@ -4586,7 +4586,7 @@ int number;
|
||||||
{
|
{
|
||||||
VOID **getblock;
|
VOID **getblock;
|
||||||
char *foundvertex;
|
char *foundvertex;
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
int current;
|
int current;
|
||||||
|
|
||||||
getblock = m->vertices.firstblock;
|
getblock = m->vertices.firstblock;
|
||||||
|
@ -4603,9 +4603,9 @@ int number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now find the right vertex. */
|
/* Now find the right vertex. */
|
||||||
alignptr = (unsigned long) (getblock + 1);
|
alignptr = (unsigned __int64) (getblock + 1);
|
||||||
foundvertex = (char *) (alignptr + (unsigned long) m->vertices.alignbytes -
|
foundvertex = (char *) (alignptr + (unsigned __int64) m->vertices.alignbytes -
|
||||||
(alignptr % (unsigned long) m->vertices.alignbytes));
|
(alignptr % (unsigned __int64) m->vertices.alignbytes));
|
||||||
return (vertex) (foundvertex + m->vertices.itembytes * (number - current));
|
return (vertex) (foundvertex + m->vertices.itembytes * (number - current));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6506,8 +6506,8 @@ vertex pd;
|
||||||
/* The result is returned both in terms of x-y coordinates and xi-eta */
|
/* The result is returned both in terms of x-y coordinates and xi-eta */
|
||||||
/* (barycentric) coordinates. The xi-eta coordinate system is defined in */
|
/* (barycentric) coordinates. The xi-eta coordinate system is defined in */
|
||||||
/* terms of the triangle: the origin of the triangle is the origin of the */
|
/* terms of the triangle: the origin of the triangle is the origin of the */
|
||||||
/* coordinate system; the destination of the triangle is one unit along the */
|
/* coordinate system; the destination of the triangle is one unit a__int64 the */
|
||||||
/* xi axis; and the apex of the triangle is one unit along the eta axis. */
|
/* xi axis; and the apex of the triangle is one unit a__int64 the eta axis. */
|
||||||
/* This procedure also returns the square of the length of the triangle's */
|
/* This procedure also returns the square of the length of the triangle's */
|
||||||
/* shortest edge. */
|
/* shortest edge. */
|
||||||
/* */
|
/* */
|
||||||
|
@ -6667,9 +6667,9 @@ struct mesh *m;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
unsigned long randomnation(unsigned int choices)
|
unsigned __int64 randomnation(unsigned int choices)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
unsigned long randomnation(choices)
|
unsigned __int64 randomnation(choices)
|
||||||
unsigned int choices;
|
unsigned int choices;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
|
||||||
|
@ -7485,7 +7485,7 @@ struct behavior *b;
|
||||||
/* WARNING: This routine is designed for convex triangulations, and will */
|
/* WARNING: This routine is designed for convex triangulations, and will */
|
||||||
/* not generally work after the holes and concavities have been carved. */
|
/* not generally work after the holes and concavities have been carved. */
|
||||||
/* However, it can still be used to find the circumcenter of a triangle, as */
|
/* However, it can still be used to find the circumcenter of a triangle, as */
|
||||||
/* long as the search is begun from the triangle in question. */
|
/* __int64 as the search is begun from the triangle in question. */
|
||||||
/* */
|
/* */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
@ -7649,11 +7649,11 @@ struct otri *searchtri;
|
||||||
char *firsttri;
|
char *firsttri;
|
||||||
struct otri sampletri;
|
struct otri sampletri;
|
||||||
vertex torg, tdest;
|
vertex torg, tdest;
|
||||||
unsigned long alignptr;
|
unsigned __int64 alignptr;
|
||||||
REAL searchdist, dist;
|
REAL searchdist, dist;
|
||||||
REAL ahead;
|
REAL ahead;
|
||||||
long samplesperblock, totalsamplesleft, samplesleft;
|
__int64 samplesperblock, totalsamplesleft, samplesleft;
|
||||||
long population, totalpopulation;
|
__int64 population, totalpopulation;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
|
||||||
if (b->verbose > 2) {
|
if (b->verbose > 2) {
|
||||||
|
@ -7721,11 +7721,11 @@ struct otri *searchtri;
|
||||||
population = totalpopulation;
|
population = totalpopulation;
|
||||||
}
|
}
|
||||||
/* Find a pointer to the first triangle in the block. */
|
/* Find a pointer to the first triangle in the block. */
|
||||||
alignptr = (unsigned long) (sampleblock + 1);
|
alignptr = (unsigned __int64) (sampleblock + 1);
|
||||||
firsttri = (char *) (alignptr +
|
firsttri = (char *) (alignptr +
|
||||||
(unsigned long) m->triangles.alignbytes -
|
(unsigned __int64) m->triangles.alignbytes -
|
||||||
(alignptr %
|
(alignptr %
|
||||||
(unsigned long) m->triangles.alignbytes));
|
(unsigned __int64) m->triangles.alignbytes));
|
||||||
|
|
||||||
/* Choose `samplesleft' randomly sampled triangles in this block. */
|
/* Choose `samplesleft' randomly sampled triangles in this block. */
|
||||||
do {
|
do {
|
||||||
|
@ -8699,7 +8699,7 @@ int triflaws;
|
||||||
} else {
|
} else {
|
||||||
/* Take the average of the two triangles' area constraints. */
|
/* Take the average of the two triangles' area constraints. */
|
||||||
/* This prevents small area constraints from migrating a */
|
/* This prevents small area constraints from migrating a */
|
||||||
/* long, long way from their original location due to flips. */
|
/* __int64, __int64 way from their original location due to flips. */
|
||||||
area = 0.5 * (areabound(top) + areabound(horiz));
|
area = 0.5 * (areabound(top) + areabound(horiz));
|
||||||
}
|
}
|
||||||
setareabound(top, area);
|
setareabound(top, area);
|
||||||
|
@ -8807,7 +8807,7 @@ int triflaws;
|
||||||
/* polygon, until `lastedge', the primary edge of the last triangle. */
|
/* polygon, until `lastedge', the primary edge of the last triangle. */
|
||||||
/* `firstedge' and `lastedge' are probably connected to other triangles */
|
/* `firstedge' and `lastedge' are probably connected to other triangles */
|
||||||
/* beyond the extremes of the fan, but their identity is not important, as */
|
/* beyond the extremes of the fan, but their identity is not important, as */
|
||||||
/* long as the fan remains connected to them. */
|
/* __int64 as the fan remains connected to them. */
|
||||||
/* */
|
/* */
|
||||||
/* Imagine the polygon oriented so that its base is at the bottom. This */
|
/* Imagine the polygon oriented so that its base is at the bottom. This */
|
||||||
/* puts `firstedge' on the far right, and `lastedge' on the far left. */
|
/* puts `firstedge' on the far right, and `lastedge' on the far left. */
|
||||||
|
@ -8839,7 +8839,7 @@ int triflaws;
|
||||||
/* O(n^2) time not only in the worst case, but in many common cases. It's */
|
/* O(n^2) time not only in the worst case, but in many common cases. It's */
|
||||||
/* rarely a big deal for vertex deletion, where n is rarely larger than */
|
/* rarely a big deal for vertex deletion, where n is rarely larger than */
|
||||||
/* ten, but it could be a big deal for segment insertion, especially if */
|
/* ten, but it could be a big deal for segment insertion, especially if */
|
||||||
/* there's a lot of long segments that each cut many triangles. I ought to */
|
/* there's a lot of __int64 segments that each cut many triangles. I ought to */
|
||||||
/* code a faster algorithm some day. */
|
/* code a faster algorithm some day. */
|
||||||
/* */
|
/* */
|
||||||
/* The `edgecount' parameter is the number of sides of the polygon, */
|
/* The `edgecount' parameter is the number of sides of the polygon, */
|
||||||
|
@ -9906,9 +9906,9 @@ struct otri *farright;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long removeghosts(struct mesh *m, struct behavior *b, struct otri *startghost)
|
__int64 removeghosts(struct mesh *m, struct behavior *b, struct otri *startghost)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long removeghosts(m, b, startghost)
|
__int64 removeghosts(m, b, startghost)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
struct otri *startghost;
|
struct otri *startghost;
|
||||||
|
@ -9919,7 +9919,7 @@ struct otri *startghost;
|
||||||
struct otri dissolveedge;
|
struct otri dissolveedge;
|
||||||
struct otri deadtriangle;
|
struct otri deadtriangle;
|
||||||
vertex markorg;
|
vertex markorg;
|
||||||
long hullsize;
|
__int64 hullsize;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
|
||||||
if (b->verbose) {
|
if (b->verbose) {
|
||||||
|
@ -9969,9 +9969,9 @@ struct otri *startghost;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long divconqdelaunay(struct mesh *m, struct behavior *b)
|
__int64 divconqdelaunay(struct mesh *m, struct behavior *b)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long divconqdelaunay(m, b)
|
__int64 divconqdelaunay(m, b)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
@ -10122,9 +10122,9 @@ struct behavior *b;
|
||||||
#ifndef REDUCED
|
#ifndef REDUCED
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long removebox(struct mesh *m, struct behavior *b)
|
__int64 removebox(struct mesh *m, struct behavior *b)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long removebox(m, b)
|
__int64 removebox(m, b)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
@ -10135,7 +10135,7 @@ struct behavior *b;
|
||||||
struct otri checkedge;
|
struct otri checkedge;
|
||||||
struct otri nextedge, finaledge, dissolveedge;
|
struct otri nextedge, finaledge, dissolveedge;
|
||||||
vertex markorg;
|
vertex markorg;
|
||||||
long hullsize;
|
__int64 hullsize;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
|
||||||
if (b->verbose) {
|
if (b->verbose) {
|
||||||
|
@ -10221,9 +10221,9 @@ struct behavior *b;
|
||||||
#ifndef REDUCED
|
#ifndef REDUCED
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long incrementaldelaunay(struct mesh *m, struct behavior *b)
|
__int64 incrementaldelaunay(struct mesh *m, struct behavior *b)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long incrementaldelaunay(m, b)
|
__int64 incrementaldelaunay(m, b)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
@ -10785,9 +10785,9 @@ int *farright;
|
||||||
#ifndef REDUCED
|
#ifndef REDUCED
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long sweeplinedelaunay(struct mesh *m, struct behavior *b)
|
__int64 sweeplinedelaunay(struct mesh *m, struct behavior *b)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long sweeplinedelaunay(m, b)
|
__int64 sweeplinedelaunay(m, b)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
@ -11013,15 +11013,15 @@ struct behavior *b;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long delaunay(struct mesh *m, struct behavior *b)
|
__int64 delaunay(struct mesh *m, struct behavior *b)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long delaunay(m, b)
|
__int64 delaunay(m, b)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
#endif /* not ANSI_DECLARATORS */
|
#endif /* not ANSI_DECLARATORS */
|
||||||
|
|
||||||
{
|
{
|
||||||
long hulledges;
|
__int64 hulledges;
|
||||||
|
|
||||||
m->eextras = 0;
|
m->eextras = 0;
|
||||||
initializetrisubpools(m, b);
|
initializetrisubpools(m, b);
|
||||||
|
@ -11114,10 +11114,10 @@ int numberofsegments;
|
||||||
#else /* not TRILIBRARY */
|
#else /* not TRILIBRARY */
|
||||||
|
|
||||||
#ifdef ANSI_DECLARATORS
|
#ifdef ANSI_DECLARATORS
|
||||||
long reconstruct(struct mesh *m, struct behavior *b, char *elefilename,
|
__int64 reconstruct(struct mesh *m, struct behavior *b, char *elefilename,
|
||||||
char *areafilename, char *polyfilename, FILE *polyfile)
|
char *areafilename, char *polyfilename, FILE *polyfile)
|
||||||
#else /* not ANSI_DECLARATORS */
|
#else /* not ANSI_DECLARATORS */
|
||||||
long reconstruct(m, b, elefilename, areafilename, polyfilename, polyfile)
|
__int64 reconstruct(m, b, elefilename, areafilename, polyfilename, polyfile)
|
||||||
struct mesh *m;
|
struct mesh *m;
|
||||||
struct behavior *b;
|
struct behavior *b;
|
||||||
char *elefilename;
|
char *elefilename;
|
||||||
|
@ -11161,9 +11161,9 @@ FILE *polyfile;
|
||||||
int segmentmarkers;
|
int segmentmarkers;
|
||||||
int boundmarker;
|
int boundmarker;
|
||||||
int aroundvertex;
|
int aroundvertex;
|
||||||
long hullsize;
|
__int64 hullsize;
|
||||||
int notfound;
|
int notfound;
|
||||||
long elementnumber, segmentnumber;
|
__int64 elementnumber, segmentnumber;
|
||||||
int i, j;
|
int i, j;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
|
||||||
|
@ -12113,7 +12113,7 @@ int leftside;
|
||||||
/* encountered. This step creates a fan of edges connected to endpoint1, */
|
/* encountered. This step creates a fan of edges connected to endpoint1, */
|
||||||
/* including the desired edge to endpoint2. The second step enforces the */
|
/* including the desired edge to endpoint2. The second step enforces the */
|
||||||
/* Delaunay condition on each side of the segment in an incremental manner: */
|
/* Delaunay condition on each side of the segment in an incremental manner: */
|
||||||
/* proceeding along the polygon from endpoint1 to endpoint2 (this is done */
|
/* proceeding a__int64 the polygon from endpoint1 to endpoint2 (this is done */
|
||||||
/* independently on each side of the segment), each vertex is "enforced" */
|
/* independently on each side of the segment), each vertex is "enforced" */
|
||||||
/* as if it had just been inserted, but affecting only the previous */
|
/* as if it had just been inserted, but affecting only the previous */
|
||||||
/* vertices. The result is the same as if the vertices had been inserted */
|
/* vertices. The result is the same as if the vertices had been inserted */
|
||||||
|
@ -13060,7 +13060,7 @@ int regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, we have to find all the regions BEFORE we carve the holes, because */
|
/* Now, we have to find all the regions BEFORE we carve the holes, because */
|
||||||
/* locate() won't work when the triangulation is no longer convex. */
|
/* locate() won't work when the triangulation is no __int64er convex. */
|
||||||
/* (Incidentally, this is the reason why regional attributes and area */
|
/* (Incidentally, this is the reason why regional attributes and area */
|
||||||
/* constraints can't be used when refining a preexisting mesh, which */
|
/* constraints can't be used when refining a preexisting mesh, which */
|
||||||
/* might not be convex; they can only be used with a freshly */
|
/* might not be convex; they can only be used with a freshly */
|
||||||
|
@ -13541,7 +13541,7 @@ struct badtriang *badtri;
|
||||||
setvertexmark(newvertex, 0);
|
setvertexmark(newvertex, 0);
|
||||||
setvertextype(newvertex, FREEVERTEX);
|
setvertextype(newvertex, FREEVERTEX);
|
||||||
|
|
||||||
/* Ensure that the handle `badotri' does not represent the longest */
|
/* Ensure that the handle `badotri' does not represent the __int64est */
|
||||||
/* edge of the triangle. This ensures that the circumcenter must */
|
/* edge of the triangle. This ensures that the circumcenter must */
|
||||||
/* fall to the left of this edge, so point location will work. */
|
/* fall to the left of this edge, so point location will work. */
|
||||||
/* (If the angle org-apex-dest exceeds 90 degrees, then the */
|
/* (If the angle org-apex-dest exceeds 90 degrees, then the */
|
||||||
|
@ -14358,7 +14358,7 @@ char **argv;
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
#endif /* not TRILIBRARY */
|
#endif /* not TRILIBRARY */
|
||||||
vertex vertexloop;
|
vertex vertexloop;
|
||||||
long outvertices;
|
__int64 outvertices;
|
||||||
int vertexnumber;
|
int vertexnumber;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -14530,7 +14530,7 @@ char **argv;
|
||||||
struct otri triangleloop;
|
struct otri triangleloop;
|
||||||
vertex p1, p2, p3;
|
vertex p1, p2, p3;
|
||||||
vertex mid1, mid2, mid3;
|
vertex mid1, mid2, mid3;
|
||||||
long elementnumber;
|
__int64 elementnumber;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef TRILIBRARY
|
#ifdef TRILIBRARY
|
||||||
|
@ -14672,11 +14672,11 @@ char **argv;
|
||||||
int index;
|
int index;
|
||||||
#else /* not TRILIBRARY */
|
#else /* not TRILIBRARY */
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
long holenumber, regionnumber;
|
__int64 holenumber, regionnumber;
|
||||||
#endif /* not TRILIBRARY */
|
#endif /* not TRILIBRARY */
|
||||||
struct osub subsegloop;
|
struct osub subsegloop;
|
||||||
vertex endpoint1, endpoint2;
|
vertex endpoint1, endpoint2;
|
||||||
long subsegnumber;
|
__int64 subsegnumber;
|
||||||
|
|
||||||
#ifdef TRILIBRARY
|
#ifdef TRILIBRARY
|
||||||
if (!b->quiet) {
|
if (!b->quiet) {
|
||||||
|
@ -14816,7 +14816,7 @@ char **argv;
|
||||||
struct otri triangleloop, trisym;
|
struct otri triangleloop, trisym;
|
||||||
struct osub checkmark;
|
struct osub checkmark;
|
||||||
vertex p1, p2;
|
vertex p1, p2;
|
||||||
long edgenumber;
|
__int64 edgenumber;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
subseg sptr; /* Temporary variable used by tspivot(). */
|
subseg sptr; /* Temporary variable used by tspivot(). */
|
||||||
|
|
||||||
|
@ -14981,7 +14981,7 @@ char **argv;
|
||||||
vertex torg, tdest, tapex;
|
vertex torg, tdest, tapex;
|
||||||
REAL circumcenter[2];
|
REAL circumcenter[2];
|
||||||
REAL xi, eta;
|
REAL xi, eta;
|
||||||
long vnodenumber, vedgenumber;
|
__int64 vnodenumber, vedgenumber;
|
||||||
int p1, p2;
|
int p1, p2;
|
||||||
int i;
|
int i;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
@ -15178,7 +15178,7 @@ char **argv;
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
#endif /* not TRILIBRARY */
|
#endif /* not TRILIBRARY */
|
||||||
struct otri triangleloop, trisym;
|
struct otri triangleloop, trisym;
|
||||||
long elementnumber;
|
__int64 elementnumber;
|
||||||
int neighbor1, neighbor2, neighbor3;
|
int neighbor1, neighbor2, neighbor3;
|
||||||
triangle ptr; /* Temporary variable used by sym(). */
|
triangle ptr; /* Temporary variable used by sym(). */
|
||||||
|
|
||||||
|
@ -15277,7 +15277,7 @@ char **argv;
|
||||||
struct otri triangleloop;
|
struct otri triangleloop;
|
||||||
vertex vertexloop;
|
vertex vertexloop;
|
||||||
vertex p1, p2, p3;
|
vertex p1, p2, p3;
|
||||||
long outvertices;
|
__int64 outvertices;
|
||||||
|
|
||||||
if (!b->quiet) {
|
if (!b->quiet) {
|
||||||
printf("Writing %s.\n", offfilename);
|
printf("Writing %s.\n", offfilename);
|
||||||
|
@ -15356,8 +15356,8 @@ struct behavior *b;
|
||||||
REAL dotproduct;
|
REAL dotproduct;
|
||||||
REAL cossquare;
|
REAL cossquare;
|
||||||
REAL triarea;
|
REAL triarea;
|
||||||
REAL shortest, longest;
|
REAL shortest, __int64est;
|
||||||
REAL trilongest2;
|
REAL tri__int64est2;
|
||||||
REAL smallestarea, biggestarea;
|
REAL smallestarea, biggestarea;
|
||||||
REAL triminaltitude2;
|
REAL triminaltitude2;
|
||||||
REAL minaltitude;
|
REAL minaltitude;
|
||||||
|
@ -15399,7 +15399,7 @@ struct behavior *b;
|
||||||
minaltitude = m->xmax - m->xmin + m->ymax - m->ymin;
|
minaltitude = m->xmax - m->xmin + m->ymax - m->ymin;
|
||||||
minaltitude = minaltitude * minaltitude;
|
minaltitude = minaltitude * minaltitude;
|
||||||
shortest = minaltitude;
|
shortest = minaltitude;
|
||||||
longest = 0.0;
|
__int64est = 0.0;
|
||||||
smallestarea = minaltitude;
|
smallestarea = minaltitude;
|
||||||
biggestarea = 0.0;
|
biggestarea = 0.0;
|
||||||
worstaspect = 0.0;
|
worstaspect = 0.0;
|
||||||
|
@ -15414,7 +15414,7 @@ struct behavior *b;
|
||||||
org(triangleloop, p[0]);
|
org(triangleloop, p[0]);
|
||||||
dest(triangleloop, p[1]);
|
dest(triangleloop, p[1]);
|
||||||
apex(triangleloop, p[2]);
|
apex(triangleloop, p[2]);
|
||||||
trilongest2 = 0.0;
|
tri__int64est2 = 0.0;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
j = plus1mod3[i];
|
j = plus1mod3[i];
|
||||||
|
@ -15422,11 +15422,11 @@ struct behavior *b;
|
||||||
dx[i] = p[j][0] - p[k][0];
|
dx[i] = p[j][0] - p[k][0];
|
||||||
dy[i] = p[j][1] - p[k][1];
|
dy[i] = p[j][1] - p[k][1];
|
||||||
edgelength[i] = dx[i] * dx[i] + dy[i] * dy[i];
|
edgelength[i] = dx[i] * dx[i] + dy[i] * dy[i];
|
||||||
if (edgelength[i] > trilongest2) {
|
if (edgelength[i] > tri__int64est2) {
|
||||||
trilongest2 = edgelength[i];
|
tri__int64est2 = edgelength[i];
|
||||||
}
|
}
|
||||||
if (edgelength[i] > longest) {
|
if (edgelength[i] > __int64est) {
|
||||||
longest = edgelength[i];
|
__int64est = edgelength[i];
|
||||||
}
|
}
|
||||||
if (edgelength[i] < shortest) {
|
if (edgelength[i] < shortest) {
|
||||||
shortest = edgelength[i];
|
shortest = edgelength[i];
|
||||||
|
@ -15440,11 +15440,11 @@ struct behavior *b;
|
||||||
if (triarea > biggestarea) {
|
if (triarea > biggestarea) {
|
||||||
biggestarea = triarea;
|
biggestarea = triarea;
|
||||||
}
|
}
|
||||||
triminaltitude2 = triarea * triarea / trilongest2;
|
triminaltitude2 = triarea * triarea / tri__int64est2;
|
||||||
if (triminaltitude2 < minaltitude) {
|
if (triminaltitude2 < minaltitude) {
|
||||||
minaltitude = triminaltitude2;
|
minaltitude = triminaltitude2;
|
||||||
}
|
}
|
||||||
triaspect2 = trilongest2 / triminaltitude2;
|
triaspect2 = tri__int64est2 / triminaltitude2;
|
||||||
if (triaspect2 > worstaspect) {
|
if (triaspect2 > worstaspect) {
|
||||||
worstaspect = triaspect2;
|
worstaspect = triaspect2;
|
||||||
}
|
}
|
||||||
|
@ -15486,7 +15486,7 @@ struct behavior *b;
|
||||||
}
|
}
|
||||||
|
|
||||||
shortest = sqrt(shortest);
|
shortest = sqrt(shortest);
|
||||||
longest = sqrt(longest);
|
__int64est = sqrt(__int64est);
|
||||||
minaltitude = sqrt(minaltitude);
|
minaltitude = sqrt(minaltitude);
|
||||||
worstaspect = sqrt(worstaspect);
|
worstaspect = sqrt(worstaspect);
|
||||||
smallestarea *= 0.5;
|
smallestarea *= 0.5;
|
||||||
|
@ -15508,8 +15508,8 @@ struct behavior *b;
|
||||||
|
|
||||||
printf(" Smallest area: %16.5g | Largest area: %16.5g\n",
|
printf(" Smallest area: %16.5g | Largest area: %16.5g\n",
|
||||||
smallestarea, biggestarea);
|
smallestarea, biggestarea);
|
||||||
printf(" Shortest edge: %16.5g | Longest edge: %16.5g\n",
|
printf(" Shortest edge: %16.5g | __int64est edge: %16.5g\n",
|
||||||
shortest, longest);
|
shortest, __int64est);
|
||||||
printf(" Shortest altitude: %12.5g | Largest aspect ratio: %8.5g\n\n",
|
printf(" Shortest altitude: %12.5g | Largest aspect ratio: %8.5g\n\n",
|
||||||
minaltitude, worstaspect);
|
minaltitude, worstaspect);
|
||||||
|
|
||||||
|
@ -15525,7 +15525,7 @@ struct behavior *b;
|
||||||
printf(" %6.6g - %-6.6g : %8d | %6.6g - : %8d\n",
|
printf(" %6.6g - %-6.6g : %8d | %6.6g - : %8d\n",
|
||||||
ratiotable[6], ratiotable[7], aspecttable[7], ratiotable[14],
|
ratiotable[6], ratiotable[7], aspecttable[7], ratiotable[14],
|
||||||
aspecttable[15]);
|
aspecttable[15]);
|
||||||
printf(" (Aspect ratio is longest edge divided by shortest altitude)\n\n");
|
printf(" (Aspect ratio is __int64est edge divided by shortest altitude)\n\n");
|
||||||
|
|
||||||
printf(" Smallest angle: %15.5g | Largest angle: %15.5g\n\n",
|
printf(" Smallest angle: %15.5g | Largest angle: %15.5g\n\n",
|
||||||
smallestangle, biggestangle);
|
smallestangle, biggestangle);
|
||||||
|
|
|
@ -259,6 +259,10 @@ int main(int argc, char** argv)
|
||||||
SDL_SetRenderDrawColor(renderer, railway.r, railway.g, railway.b, 255);
|
SDL_SetRenderDrawColor(renderer, railway.r, railway.g, railway.b, 255);
|
||||||
SDL_RenderDrawLinesF(renderer, railway.points, railway.length);
|
SDL_RenderDrawLinesF(renderer, railway.points, railway.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Multipolygon& multipolygon : multipolygons) {
|
||||||
|
multipolygon.Draw(renderer, 255, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
|
@ -5,13 +5,16 @@
|
||||||
#include <triangle.h>
|
#include <triangle.h>
|
||||||
#include <osmway.hpp>
|
#include <osmway.hpp>
|
||||||
#include <osmnode.hpp>
|
#include <osmnode.hpp>
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <SDL2_gfxPrimitives.h>
|
||||||
|
|
||||||
struct TriangulationData {
|
struct TriangulationData {
|
||||||
std::vector<REAL> vertices, holes;
|
std::vector<REAL> vertices, holes;
|
||||||
|
std::vector<int> segments;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map values from one interval [A, B] to another [a, b]
|
// Map values from one interval [A, B] to another [a, b]
|
||||||
inline float Map(float A, float B, float a, float b, float x)
|
inline double Map(double A, double B, double a, double b, double x)
|
||||||
{
|
{
|
||||||
return (x - A) * (b - a) / (B - A) + a;
|
return (x - A) * (b - a) / (B - A) + a;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +25,17 @@ Multipolygon::Multipolygon(const std::shared_ptr<osmp::Relation>& relation, int
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<TriangulationData> data;
|
std::vector<TriangulationData> data;
|
||||||
|
|
||||||
|
if (relation->id == 3363659) {
|
||||||
|
__debugbreak();
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<osmp::Relation::Member>& ways = relation->GetWays();
|
const std::vector<osmp::Relation::Member>& ways = relation->GetWays();
|
||||||
std::vector<std::shared_ptr<osmp::Node>> nodes;
|
std::vector<std::shared_ptr<osmp::Node>> nodes;
|
||||||
|
std::shared_ptr<osmp::Node> lastNode = nullptr;
|
||||||
|
std::shared_ptr<osmp::Way> nextNode = nullptr;
|
||||||
|
int run = 1;
|
||||||
|
int total = 0;
|
||||||
for (osmp::Relation::Member member : ways)
|
for (osmp::Relation::Member member : ways)
|
||||||
{
|
{
|
||||||
std::shared_ptr<osmp::Way> way = std::dynamic_pointer_cast<osmp::Way>(member.member);
|
std::shared_ptr<osmp::Way> way = std::dynamic_pointer_cast<osmp::Way>(member.member);
|
||||||
|
@ -42,21 +53,41 @@ Multipolygon::Multipolygon(const std::shared_ptr<osmp::Relation>& relation, int
|
||||||
// Continue with Closed way algorithm
|
// Continue with Closed way algorithm
|
||||||
|
|
||||||
bool inner = (member.role == "inner");
|
bool inner = (member.role == "inner");
|
||||||
const std::vector<std::shared_ptr<osmp::Node>> wayNodes = way->GetNodes();
|
std::vector<std::shared_ptr<osmp::Node>> wayNodes = way->GetNodes();
|
||||||
nodes.insert(nodes.end(), wayNodes.begin(), wayNodes.end());
|
|
||||||
|
if (run == 1) {
|
||||||
|
nodes.insert(nodes.begin(), wayNodes.begin(), wayNodes.end());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (nodes.back() == wayNodes.front()) {
|
||||||
|
nodes.insert(nodes.end(), wayNodes.begin() + 1, wayNodes.end());
|
||||||
|
}
|
||||||
|
else if (nodes.back() == wayNodes.back()) {
|
||||||
|
nodes.insert(nodes.end(), wayNodes.rbegin() + 1, wayNodes.rend());
|
||||||
|
}
|
||||||
|
else if (nodes.front() == wayNodes.back()) {
|
||||||
|
nodes.insert(nodes.begin(), wayNodes.begin(), wayNodes.end() - 1);
|
||||||
|
}
|
||||||
|
else /*if (nodes.front() == wayNodes.front())*/ {
|
||||||
|
nodes.insert(nodes.begin(), wayNodes.rbegin(), wayNodes.rend() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run++;
|
||||||
|
|
||||||
if (!(way->closed)) {
|
if (!(way->closed)) {
|
||||||
if (nodes.front() == nodes.back())
|
if (nodes.size() > 1 && nodes.front() == nodes.back())
|
||||||
{
|
{
|
||||||
nodes.pop_back();
|
// nodes.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nodes.pop_back();
|
||||||
|
|
||||||
if (!inner)
|
if (!inner || data.empty())
|
||||||
{
|
{
|
||||||
data.push_back({});
|
data.push_back({});
|
||||||
}
|
}
|
||||||
|
@ -86,30 +117,73 @@ Multipolygon::Multipolygon(const std::shared_ptr<osmp::Relation>& relation, int
|
||||||
td.holes.push_back(holeY);
|
td.holes.push_back(holeY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get segments
|
||||||
|
int segNum = td.vertices.size() / 2;
|
||||||
|
for (int i = 0; i < vertices.size(); i += 2) {
|
||||||
|
td.segments.push_back(segNum);
|
||||||
|
td.segments.push_back(++segNum);
|
||||||
|
}
|
||||||
|
td.segments.back() = td.vertices.size() / 2;
|
||||||
|
|
||||||
td.vertices.insert(td.vertices.end(), vertices.begin(), vertices.end());
|
td.vertices.insert(td.vertices.end(), vertices.begin(), vertices.end());
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
|
lastNode = nullptr;
|
||||||
|
run = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* triswitches = "zp";
|
char* triswitches = "zpNBV";
|
||||||
for (TriangulationData& td : data)
|
for (TriangulationData& td : data)
|
||||||
{
|
{
|
||||||
triangulateio in;
|
triangulateio in;
|
||||||
|
|
||||||
in.numberofpoints = td.vertices.size() / 2;
|
in.numberofpoints = td.vertices.size() / 2;
|
||||||
in.pointlist = td.vertices.data();
|
in.pointlist = td.vertices.data();
|
||||||
|
in.pointmarkerlist = NULL;
|
||||||
|
|
||||||
in.numberofpointattributes = 0;
|
in.numberofpointattributes = 0;
|
||||||
in.numberofpointattributes = NULL;
|
in.numberofpointattributes = NULL;
|
||||||
|
|
||||||
in.numberofholes = td.vertices.size() / 2;
|
in.numberofholes = td.holes.size() / 2;
|
||||||
in.holelist = td.holes.data();
|
in.holelist = td.holes.data();
|
||||||
|
|
||||||
|
in.numberofsegments = td.segments.size() / 2;
|
||||||
|
in.segmentlist = td.segments.data();
|
||||||
|
in.segmentmarkerlist = NULL;
|
||||||
|
|
||||||
in.numberofregions = 0;
|
in.numberofregions = 0;
|
||||||
in.regionlist = NULL;
|
in.regionlist = NULL;
|
||||||
|
|
||||||
triangulateio out;
|
triangulateio out;
|
||||||
|
out.pointlist = NULL;
|
||||||
|
out.pointmarkerlist = NULL;
|
||||||
|
out.trianglelist = NULL;
|
||||||
|
out.segmentlist = NULL;
|
||||||
|
out.segmentmarkerlist = NULL;
|
||||||
triangulate(triswitches, &in, &out, NULL);
|
triangulate(triswitches, &in, &out, NULL);
|
||||||
|
|
||||||
volatile int lol = 3;
|
// TODO: memory leak go brrrr
|
||||||
|
polygons.push_back({});
|
||||||
|
for (int i = 0; i < in.numberofpoints * 2; i += 2) {
|
||||||
|
polygons.back().vertices.push_back({ in.pointlist[i], in.pointlist[i + 1] });
|
||||||
|
// polygons.back().vertices.push_back(in.pointlist[i + 1]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < out.numberoftriangles * 3; i++) {
|
||||||
|
polygons.back().indices.push_back(out.trianglelist[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Multipolygon::Draw(SDL_Renderer* renderer, int r, int g, int b)
|
||||||
|
{
|
||||||
|
for (const Polygon& polygon : polygons) {
|
||||||
|
for (int i = 0; i < polygon.indices.size(); i += 3) // Be a graphics card
|
||||||
|
{
|
||||||
|
filledTrigonRGBA(renderer,
|
||||||
|
polygon.vertices[polygon.indices[i + 0]].x, polygon.vertices[polygon.indices[i + 0]].y,
|
||||||
|
polygon.vertices[polygon.indices[i + 1]].x, polygon.vertices[polygon.indices[i + 1]].y,
|
||||||
|
polygon.vertices[polygon.indices[i + 2]].x, polygon.vertices[polygon.indices[i + 2]].y,
|
||||||
|
r, g, b, 255
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue