本文整理汇总了C++中GetPoints函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPoints函数的具体用法?C++ GetPoints怎么用?C++ GetPoints使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPoints函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TestSAT
// Returns true if there is no collision, and false if there is a collision.
bool TestSAT(AABB a, AABB b)
{
// Since these are AABB collisions, we can easily determine the normals. That said, this was left this way for understanding and future implementation.
// The first step is to get the normals for the two colliding objects, as these will be the axes on which we test for collisions.
std::vector<glm::vec3> aNormals = GetNormals(a);
std::vector<glm::vec3> bNormals = GetNormals(b);
// A quick method that exists for getting the points of the AABB. In a regular implementation, we might instead pass in the actual points to this algorithm, skipping
// this step.
std::vector<glm::vec3> aPoints = GetPoints(a);
std::vector<glm::vec3> bPoints = GetPoints(b);
// This boolean gets returned, and will be true if there is no collision.
bool isSeparated = false;
// For each normal
for (int i = 0; i < aNormals.size(); i++)
{
// Get the Min and Max projections for each object along the normal.
float aMin, aMax;
GetMinMax(aPoints, aNormals[i], aMin, aMax);
float bMin, bMax;
GetMinMax(bPoints, aNormals[i], bMin, bMax);
// If the maximum projection of one of the objects is less than the minimum projection of the other object, then we can determine that there is a separation
// along this axis. Thus, we set isSeparated to true and break out of the for loop.
isSeparated = aMax < bMin || bMax < aMin;
if (isSeparated) break;
}
// This only runs if we still haven't proven that there is a separation between the two objects.
// SAT is an optimistic algorithm in that it will stop the moment it determines there isn't a collision, and as such the less collisions there are the faster it will run.
if (!isSeparated)
{
// Loop through the normals for the second object.
// Note that since this is an AABB, the normals will be the same as the previous object. Again, this is left for future implementation and understanding.
// The process below is exactly the same as above, only with object b's normals instead of object a.
for (int i = 0; i < bNormals.size(); i++)
{
float aMin, aMax;
GetMinMax(aPoints, bNormals[i], aMin, aMax);
float bMin, bMax;
GetMinMax(bPoints, bNormals[i], bMin, bMax);
isSeparated = aMax < bMin || bMax < aMin;
if (isSeparated) break;
}
}
// At this point, isSeparated has been tested against each normal. If it has been set to true, then there is a separation. If it is false, that means none of the axes
// were separated, and there is a collision.
return isSeparated;
}
开发者ID:IGME-RIT,项目名称:physics-SAT2D-AABB,代码行数:56,代码来源:Main.cpp
示例2: GetPoints
bool DragRect::PtIn(const DPoint& pt) const {
// Look at the z portion of the cross product on each side. The result
// should be all negative or positive to be inside.
DPoint apt[4];
GetPoints(apt);
double d0 = (pt.x - apt[0].x) * (apt[1].y - apt[0].y) -
(pt.y - apt[0].y) * (apt[1].x - apt[0].x);
double d1 = (pt.x - apt[1].x) * (apt[2].y - apt[1].y) -
(pt.y - apt[1].y) * (apt[2].x - apt[1].x);
double d2 = (pt.x - apt[2].x) * (apt[3].y - apt[2].y) -
(pt.y - apt[2].y) * (apt[3].x - apt[2].x);
double d3 = (pt.x - apt[3].x) * (apt[0].y - apt[3].y) -
(pt.y - apt[3].y) * (apt[0].x - apt[3].x);
if (d0 < 0.0 && d1 < 0.0 && d2 < 0.0 && d3 < 0.0) {
return true;
}
if (d0 >= 0.0 && d1 >= 0.0 && d2 >= 0.0 && d3 >= 0.0) {
return true;
}
return false;
}
开发者ID:ptitSeb,项目名称:hostile-takeover,代码行数:25,代码来源:dragrect.cpp
示例3: GetPoints
void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
{
// Called after a match has ended and the stats are already modified
// Helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
// 10 played games per week is a minimum
if (Stats.WeekGames < 10)
return;
// To get points, a player has to participate in at least 30% of the matches
uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f);
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
// The player participated in enough games, update his points
uint32 pointsToAdd = 0;
if (itr->WeekGames >= requiredGames)
pointsToAdd = GetPoints(itr->PersonalRating);
std::map<uint32, uint32>::iterator player_itr = playerPoints.find(GUID_LOPART(itr->Guid));
if (player_itr != playerPoints.end())
{
// Check if there is already more points
if (player_itr->second < pointsToAdd)
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
}
else
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
}
}
开发者ID:Crash911,项目名称:RaptoredSkyFire,代码行数:29,代码来源:ArenaTeam.cpp
示例4: GetPoints
void
PolyBezierSegment::Append (moon_path *path)
{
PointCollection *col;
GPtrArray *points;
col = GetPoints ();
int points_count = col->GetCount ();
// we need at least 3 points
if (!col || (points_count % 3) != 0)
return;
points = col->Array();
for (int i = 0; i < points_count - 2; i += 3) {
moon_curve_to (path,
((Value*)g_ptr_array_index(points, i))->AsPoint()->x,
((Value*)g_ptr_array_index(points, i))->AsPoint()->y,
((Value*)g_ptr_array_index(points, i+1))->AsPoint()->x,
((Value*)g_ptr_array_index(points, i+1))->AsPoint()->y,
((Value*)g_ptr_array_index(points, i+2))->AsPoint()->x,
((Value*)g_ptr_array_index(points, i+2))->AsPoint()->y);
}
}
开发者ID:kangaroo,项目名称:moon,代码行数:27,代码来源:geometry.cpp
示例5: IsOutsidePanel
bool Tan::IsOutsidePanel(){
wxPoint* points=GetPoints();
for(int i=0;i<GetSize();i++){
if(points[i].x < 0 || points[i].x > WIDTH || points[i].y < 0 || points[i].y > HEIGHT) return true;
}
return false;
}
开发者ID:reverant,项目名称:Tangram,代码行数:7,代码来源:Tan.cpp
示例6: GetPoints
std::vector<sf::Vector2f> Polygon::GetAxes()
{
std::vector<sf::Vector2f> result;
auto points = GetPoints();
double length;
sf::Vector2f axis, edge;
for (int i = 0; i < points.size(); ++i)
{
//Calculate the edge between each point and its neighbor
edge.x = points[(i + 1) % points.size()].x - points[i].x;
edge.y = points[(i + 1) % points.size()].y - points[i].y;
//Get length of edge
length = sqrt(edge.x * edge.x + edge.y * edge.y);
//Normalize
edge.x /= length;
edge.y /= length;
//Push the pependiular vector to edge into the axes vector
result.push_back(sf::Vector2f(-edge.y, edge.x));
}
return result;
}
开发者ID:inzombiak,项目名称:SATTest,代码行数:26,代码来源:Polygon.cpp
示例7: ceil
void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
{
// called after a match has ended and the stats are already modified
// helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
// 10 played games per week is a minimum
if (m_stats.games_week < 10)
return;
// to get points, a player has to participate in at least 30% of the matches
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
// the player participated in enough games, update his points
uint32 points_to_add = 0;
if (itr->games_week >= min_plays)
points_to_add = GetPoints(itr->personal_rating);
// OBSOLETE : CharacterDatabase.PExecute("UPDATE arena_team_member SET points_to_add = '%u' WHERE arenateamid = '%u' AND guid = '%u'", points_to_add, m_TeamId, itr->guid);
std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.find(GUID_LOPART(itr->guid));
if (plr_itr != PlayerPoints.end())
{
//check if there is already more points
if (plr_itr->second < points_to_add)
PlayerPoints[GUID_LOPART(itr->guid)] = points_to_add;
}
else
PlayerPoints[GUID_LOPART(itr->guid)] = points_to_add;
}
}
开发者ID:Ballwinkle,项目名称:SkyFireEMU,代码行数:28,代码来源:ArenaTeam.cpp
示例8: GetPoints
FilterPoints2::FilterPoints2(potrace_path_t *path, float proportionXY, /*float tolerance, */float minlen)
{
Path = path;
koefProportionXY = proportionXY;
//Tolerance = tolerance;
MinLen = minlen;
GetPoints();
}
开发者ID:VLunev,项目名称:PotraceWrapper,代码行数:8,代码来源:FilterPoints2.cpp
示例9: NumberToString
/**
* Send a new point request
* @param point
*
* Info sent: AddPoints - Points...
*/
void Sender::sendPoints(Point* point)//std::vector<Point> points)
{
std::string toSend = separator;
toSend += NumberToString(ADD_POINTS);
toSend += separator;
toSend += GetPoints(point);
client->sendMessage(toSend);
}
开发者ID:petester42,项目名称:Scribble_GL,代码行数:16,代码来源:Sender.cpp
示例10: GetPoints
/**
* @brief LengthBezier return spline length using 4 spline point.
* @param p1 first spline point
* @param p2 first control point.
* @param p3 second control point.
* @param p4 last spline point.
* @return length.
*/
qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const
{
QPainterPath splinePath;
QVector<QPointF> points = GetPoints (p1, p2, p3, p4);
splinePath.moveTo(points.at(0));
for (qint32 i = 1; i < points.count(); ++i)
{
splinePath.lineTo(points.at(i));
}
return splinePath.length();
}
开发者ID:jessikbarret,项目名称:Valentina,代码行数:19,代码来源:vspline.cpp
示例11: GetPoints
void BodyInst::GetOBB(myBody *b)
{
GetPoints(b);
for(int i=0;i<8;i++)
{
float p[3] = {b->pts[i*3]-b->center[0],b->pts[i*3+1]-b->center[1], b->pts[i*3+2]-b->center[2]};
QuaternionTransform(p, b->orientation);
b->pts[i*3] = p[0]+b->center[0];
b->pts[i*3+1] = p[1]+b->center[1];
b->pts[i*3+2] = p[2]+b->center[2];
}
}
开发者ID:X3llos,项目名称:eng_new,代码行数:12,代码来源:bodyInst.cpp
示例12: GetCenter
wxPoint Tan::GetCenter(){
wxPoint* points=GetPoints();
int centerX=0;
int centerY=0;
for(int i=0;i<GetSize();i++){
centerX+=points[i].x;
centerY+=points[i].y;
}
centerX/=GetSize();
centerY/=GetSize();
return wxPoint(centerX,centerY);
}
开发者ID:reverant,项目名称:Tangram,代码行数:12,代码来源:Tan.cpp
示例13: IsCrossing
bool Tan::IsCrossing(Tan* tan) {
wxPoint* points=GetPoints();
wxPoint* pointsToCheck=tan->GetPoints();
for(int i=0;i<GetSize();i++){
for(int j=0;j<tan->GetSize();j++){
if(VectorUtils::IsCrossing(points[i],points[(i+1)%GetSize()],pointsToCheck[j],pointsToCheck[(j+1)%tan->GetSize()])) {
return true;
}
}
}
return false;
}
开发者ID:reverant,项目名称:Tangram,代码行数:12,代码来源:Tan.cpp
示例14: GetPoints
BOOL CDoc::FileOpen(LPCTSTR szFilename)
{
GetPoints().clear();
BOOL bResult = FALSE;
try
{
CArchive ar(szFilename, CArchive::load);
ar >> *this;
bResult = TRUE;
}
catch (const CFileException &e)
{
// An exception occurred. Display the relevant information.
::MessageBox(NULL, e.GetText(), _T("Failed to Load File"), MB_ICONWARNING);
GetPoints().clear();
}
return bResult;
}
开发者ID:the-reverend,项目名称:Win32xx,代码行数:22,代码来源:Doc.cpp
示例15: GetPoints
float* Box::GetOBB()
{
GetPoints();
float* center = GetCenter();
for(int i=0;i<8;i++)
{
float p[3] = {pts[i*3]-center[0],pts[i*3+1]-center[1], pts[i*3+2]-center[2]};
QuaternionTransform(p, GetOrientation());
pts[i*3] = p[0]+center[0];
pts[i*3+1] = p[1]+center[1];
pts[i*3+2] = p[2]+center[2];
}
return pts;
}
开发者ID:X3llos,项目名称:eng_new,代码行数:15,代码来源:box.cpp
示例16: GetPositionRect
int CGraphBSpline::Draw( CFmlDrawEngine& fde, const PointFde& tl, CNode* )
{
RectFde rc = GetPositionRect();
rc.translate( tl.x(), tl.y() );
QVector<qint8> tp;
QVector<PointFde> xy;
GetPoints( rc, xy, tp );
QColor color = (GetColor() == DEFAULT_GRAPH_COLOR ? ::getCurrentFormulatorStyle().getLogPen().m_color : GetColor());
fde.DrawFillPath( xy, tp, FS_LogPen( color, (Qt::PenStyle) GetStyle(), GetWidth() ), FS_LogBrush(GetColor(), Qt::SolidPattern) );
return 1;
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:15,代码来源:r_bspl.cpp
示例17: p1pX
// cppcheck-suppress unusedFunction
QVector<QPointF> VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
qreal kAsm2, qreal kCurve)
{
QLineF p1pX(p1.x(), p1.y(), p1.x() + 100, p1.y());
p1pX.setAngle( angle1 );
qreal L = 0, radius = 0, angle = 90;
radius = QLineF(QPointF(p1.x(), p4.y()), p4).length();
L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
QLineF p1p2(p1.x(), p1.y(), p1.x() + L * kAsm1, p1.y());
p1p2.setAngle(angle1);
QLineF p4p3(p4.x(), p4.y(), p4.x() + L * kAsm2, p4.y());
p4p3.setAngle(angle2);
QPointF p2 = p1p2.p2();
QPointF p3 = p4p3.p2();
return GetPoints(p1, p2, p3, p4);
}
开发者ID:jessikbarret,项目名称:Valentina,代码行数:17,代码来源:vspline.cpp
示例18: GetNumPoints
void MeshPhysicsShape::Save(Archive& archive)
{
PhysicsSystem::SERIAL_CreateMesh.Save(archive);
int count = GetNumPoints();
archive.Write(&count);
Vector3* verts = GetPoints();
for (int x = 0; x < count; ++x)
{
archive.Write(&verts[x].x);
archive.Write(&verts[x].y);
archive.Write(&verts[x].z);
}
Vector3& scale = GetScale();
archive.Write(&scale);
}
开发者ID:jmclaine,项目名称:Sentinel_GameEngine,代码行数:18,代码来源:PhysicsShape.cpp
注:本文中的GetPoints函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论