本文整理汇总了C++中PointAt函数的典型用法代码示例。如果您正苦于以下问题:C++ PointAt函数的具体用法?C++ PointAt怎么用?C++ PointAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PointAt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PointAt
Vector SSurface::PointAtMaybeSwapped(double u, double v, bool swapped) {
if(swapped) {
return PointAt(v, u);
} else {
return PointAt(u, v);
}
}
示例2: PointAt
ON_RevSurface* ON_Cylinder::RevSurfaceForm( ON_RevSurface* srf ) const
{
if ( srf )
srf->Destroy();
ON_RevSurface* pRevSurface = NULL;
if ( IsFinite() && IsValid() )
{
ON_Line line;
line.from = PointAt(0.0,height[0]);
line.to = PointAt(0.0,height[1]);
ON_Interval h(height[0],height[1]); // h = evaluation domain for line (must be increasing)
if ( h.IsDecreasing() )
h.Swap();
ON_LineCurve* line_curve = new ON_LineCurve( line, h[0], h[1] );
if ( srf )
pRevSurface = srf;
else
pRevSurface = new ON_RevSurface();
pRevSurface->m_angle.Set(0.0,2.0*ON_PI);
pRevSurface->m_t = pRevSurface->m_angle;
pRevSurface->m_curve = line_curve;
pRevSurface->m_axis.from = circle.plane.origin;
pRevSurface->m_axis.to = circle.plane.origin + circle.plane.zaxis;
pRevSurface->m_bTransposed = false;
ON_Circle c0(circle);
c0.Translate(height[0]*circle.plane.zaxis);
ON_Circle c1(circle);
c1.Translate(height[1]*circle.plane.zaxis);
pRevSurface->m_bbox = c0.BoundingBox();
pRevSurface->m_bbox.Union(c1.BoundingBox());
}
return pRevSurface;
}
示例3: PointAt
int ON_LineCurve::GetNurbForm(
ON_NurbsCurve& c,
double tolerance,
const ON_Interval* subdomain
) const
{
int rc = 0;
if ( c.Create( m_dim==2?2:3, false, 2, 2 ) )
{
rc = 1;
double t0 = m_t[0];
double t1 = m_t[1];
if (subdomain )
{
if ( t0 < t1 )
{
const ON_Interval& sd = *subdomain;
double s0 = sd[0];
double s1 = sd[1];
if (s0 < t0) s0 = t0;
if (s1 > t1) s1 = t1;
if (s0 < s1)
{
t0 = s0;
t1 = s1;
}
else
rc = 0;
}
else
{
rc = 0;
}
}
if ( t0 < t1 )
{
c.m_knot[0] = t0;
c.m_knot[1] = t1;
c.SetCV( 0, PointAt(t0));
c.SetCV( 1, PointAt(t1));
}
else if ( t0 > t1 )
{
rc = 0;
c.m_knot[0] = t1;
c.m_knot[1] = t0;
c.SetCV( 0, PointAt(t1));
c.SetCV( 1, PointAt(t0));
}
else
{
rc = 0;
c.m_knot[0] = 0.0;
c.m_knot[1] = 1.0;
c.SetCV( 0, m_line.from );
c.SetCV( 1, m_line.to );
}
}
return rc;
}
示例4: PointAt
void SBezier::MakePwlWorker(List<Vector> *l, double ta, double tb,
double chordTol)
{
Vector pa = PointAt(ta);
Vector pb = PointAt(tb);
// Can't test in the middle, or certain cubics would break.
double tm1 = (2*ta + tb) / 3;
double tm2 = (ta + 2*tb) / 3;
Vector pm1 = PointAt(tm1);
Vector pm2 = PointAt(tm2);
double d = max(pm1.DistanceToLine(pa, pb.Minus(pa)),
pm2.DistanceToLine(pa, pb.Minus(pa)));
double step = 1.0/SS.maxSegments;
if((tb - ta) < step || d < chordTol) {
// A previous call has already added the beginning of our interval.
l->Add(&pb);
} else {
double tm = (ta + tb) / 2;
MakePwlWorker(l, ta, tm, chordTol);
MakePwlWorker(l, tm, tb, chordTol);
}
}
示例5: PointAt
ON_RevSurface* ON_Cone::RevSurfaceForm( ON_RevSurface* srf ) const
{
if ( srf )
srf->Destroy();
ON_RevSurface* pRevSurface = NULL;
if ( IsValid() )
{
ON_Line line;
ON_Interval line_domain;
if ( height >= 0.0 )
line_domain.Set(0.0,height);
else
line_domain.Set(height,0.0);
line.from = PointAt(0.0,line_domain[0]);
line.to = PointAt(0.0,line_domain[1]);
ON_LineCurve* line_curve = new ON_LineCurve( line, line_domain[0], line_domain[1] );
if ( srf )
pRevSurface = srf;
else
pRevSurface = new ON_RevSurface();
pRevSurface->m_angle.Set(0.0,2.0*ON_PI);
pRevSurface->m_t = pRevSurface->m_angle;
pRevSurface->m_curve = line_curve;
pRevSurface->m_axis.from = plane.origin;
pRevSurface->m_axis.to = plane.origin + plane.zaxis;
pRevSurface->m_bTransposed = FALSE;
pRevSurface->m_bbox.m_min = plane.origin;
pRevSurface->m_bbox.m_max = plane.origin;
pRevSurface->m_bbox.Union(CircleAt(height).BoundingBox());
}
return pRevSurface;
}
示例6: PointAt
ON_RevSurface* ON_Cylinder::RevSurfaceForm( ON_RevSurface* srf ) const
{
if ( srf )
srf->Destroy();
ON_RevSurface* pRevSurface = NULL;
if ( IsFinite() && IsValid() )
{
ON_Line line;
line.from = PointAt(0.0,height[0]);
line.to = PointAt(0.0,height[1]);
ON_LineCurve* line_curve = new ON_LineCurve( line, height[0], height[1] );
if ( srf )
pRevSurface = srf;
else
pRevSurface = new ON_RevSurface();
pRevSurface->m_angle.Set(0.0,2.0*ON_PI);
pRevSurface->m_t = pRevSurface->m_angle;
pRevSurface->m_curve = line_curve;
pRevSurface->m_axis.from = circle.plane.origin;
pRevSurface->m_axis.to = circle.plane.origin + circle.plane.zaxis;
pRevSurface->m_bTransposed = FALSE;
ON_Circle c0(circle);
c0.Translate(height[0]*circle.plane.zaxis);
ON_Circle c1(circle);
c1.Translate(height[1]*circle.plane.zaxis);
pRevSurface->m_bbox = c0.BoundingBox();
pRevSurface->m_bbox.Union(c1.BoundingBox());
}
return pRevSurface;
}
示例7: IsValid
int
ON_PlaneSurface::GetNurbForm( // returns 0: unable to create NURBS representation
// with desired accuracy.
// 1: success - returned NURBS parameterization
// matches the surface's to wthe desired accuracy
// 2: success - returned NURBS point locus matches
// the surfaces's to the desired accuracy but, on
// the interior of the surface's domain, the
// surface's parameterization and the NURBS
// parameterization may not match to the
// desired accuracy.
ON_NurbsSurface& nurbs,
double tolerance
) const
{
ON_BOOL32 rc = IsValid();
if( !rc )
{
if ( m_plane.origin.x != ON_UNSET_VALUE
&& m_plane.xaxis.x != ON_UNSET_VALUE
&& m_plane.yaxis.x != ON_UNSET_VALUE
&& m_domain[0].IsIncreasing() && m_domain[1].IsIncreasing()
&& m_extents[0].Length() > 0.0 && m_extents[1].Length() > 0.0
)
{
ON_3dVector N = ON_CrossProduct(m_plane.xaxis,m_plane.yaxis);
if ( N.Length() <= 1.0e-4 )
{
ON_WARNING("ON_PlaneSurface::GetNurbForm - using invalid surface.");
rc = true;
}
}
}
if ( rc )
{
nurbs.m_dim = 3;
nurbs.m_is_rat = 0;
nurbs.m_order[0] = nurbs.m_order[1] = 2;
nurbs.m_cv_count[0] = nurbs.m_cv_count[1] = 2;
nurbs.m_cv_stride[1] = nurbs.m_dim;
nurbs.m_cv_stride[0] = nurbs.m_cv_stride[1]*nurbs.m_cv_count[1];
nurbs.ReserveCVCapacity(12);
nurbs.ReserveKnotCapacity(0,2);
nurbs.ReserveKnotCapacity(1,2);
nurbs.m_knot[0][0] = m_domain[0][0];
nurbs.m_knot[0][1] = m_domain[0][1];
nurbs.m_knot[1][0] = m_domain[1][0];
nurbs.m_knot[1][1] = m_domain[1][1];
nurbs.SetCV( 0, 0, PointAt( m_domain[0][0], m_domain[1][0] ));
nurbs.SetCV( 0, 1, PointAt( m_domain[0][0], m_domain[1][1] ));
nurbs.SetCV( 1, 0, PointAt( m_domain[0][1], m_domain[1][0] ));
nurbs.SetCV( 1, 1, PointAt( m_domain[0][1], m_domain[1][1] ));
}
return rc;
}
示例8: PointAt
// ---------------------------------------------------------------------------------- RHTML_text_view - Draw -
void RHTMLtextview::Draw(BRect inRect)
{
BTextView::Draw(inRect);
if (fTarget->fNumView->Frame().top != fScrollView->ScrollBar(B_VERTICAL)->Value())
fTarget->fNumView->MoveTo(BPoint(0, 0 - fScrollView->ScrollBar(B_VERTICAL)->Value()));
if (fTarget->IsEnabled())
fTarget->fNumView->UpdateNum();
if (PointAt(TextLength() - 1).y + 50 > fTarget->fNumView->Bounds().bottom)
fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right, PointAt(TextLength() - 1).y + 50);
}
示例9: ClosestPointTo
void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
Vector *pt,
Vector *enin, Vector *enout,
Vector *surfn,
uint32_t auxA,
SShell *shell, SShell *sha, SShell *shb)
{
// the midpoint of the edge
Point2d muv = (auv.Plus(buv)).ScaledBy(0.5);
*pt = PointAt(muv);
// If this edge just approximates a curve, then refine our midpoint so
// so that it actually lies on that curve too. Otherwise stuff like
// point-on-face tests will fail, since the point won't actually lie
// on the other face.
hSCurve hc = { auxA };
SCurve *sc = shell->curve.FindById(hc);
if(sc->isExact && sc->exact.deg != 1) {
double t;
sc->exact.ClosestPointTo(*pt, &t, false);
*pt = sc->exact.PointAt(t);
ClosestPointTo(*pt, &muv);
} else if(!sc->isExact) {
SSurface *trimmedA = sc->GetSurfaceA(sha, shb),
*trimmedB = sc->GetSurfaceB(sha, shb);
*pt = trimmedA->ClosestPointOnThisAndSurface(trimmedB, *pt);
ClosestPointTo(*pt, &muv);
}
*surfn = NormalAt(muv.x, muv.y);
// Compute the edge's inner normal in xyz space.
Vector ab = (PointAt(auv)).Minus(PointAt(buv)),
enxyz = (ab.Cross(*surfn)).WithMagnitude(SS.ChordTolMm());
// And based on that, compute the edge's inner normal in uv space. This
// vector is perpendicular to the edge in xyz, but not necessarily in uv.
Vector tu, tv;
TangentsAt(muv.x, muv.y, &tu, &tv);
Point2d enuv;
enuv.x = enxyz.Dot(tu) / tu.MagSquared();
enuv.y = enxyz.Dot(tv) / tv.MagSquared();
// Compute the inner and outer normals of this edge (within the srf),
// in xyz space. These are not necessarily antiparallel, if the
// surface is curved.
Vector pin = PointAt(muv.Minus(enuv)),
pout = PointAt(muv.Plus(enuv));
*enin = pin.Minus(*pt),
*enout = pout.Minus(*pt);
}
示例10: if
void SSurface::TrimFromEdgeList(SEdgeList *el, bool asUv) {
el->l.ClearTags();
STrimBy stb = {};
for(;;) {
// Find an edge, any edge; we'll start from there.
SEdge *se;
for(se = el->l.First(); se; se = el->l.NextAfter(se)) {
if(se->tag) continue;
break;
}
if(!se) break;
se->tag = 1;
stb.start = se->a;
stb.finish = se->b;
stb.curve.v = se->auxA;
stb.backwards = se->auxB ? true : false;
// Find adjoining edges from the same curve; those should be
// merged into a single trim.
bool merged;
do {
merged = false;
for(se = el->l.First(); se; se = el->l.NextAfter(se)) {
if(se->tag) continue;
if(se->auxA != (int)stb.curve.v) continue;
if(( se->auxB && !stb.backwards) ||
(!se->auxB && stb.backwards)) continue;
if((se->a).Equals(stb.finish)) {
stb.finish = se->b;
se->tag = 1;
merged = true;
} else if((se->b).Equals(stb.start)) {
stb.start = se->a;
se->tag = 1;
merged = true;
}
}
} while(merged);
if(asUv) {
stb.start = PointAt(stb.start.x, stb.start.y);
stb.finish = PointAt(stb.finish.x, stb.finish.y);
}
// And add the merged trim, with xyz (not uv like the polygon) pts
trim.Add(&stb);
}
}
示例11: PointAt
bool World::Clicked(sf::Vector2i mouse_pos) {
Point p = PointAt(sf::Vector2f(mouse_pos.x, mouse_pos.y));
if(mPlayerActor->IsValidAddPoint(p, false))
return mPlayerActor->Clicked(p);
else
return false;
}
示例12: ClosestPointTo
ON_3dPoint ON_Box::ClosestPointTo( ON_3dPoint point ) const
{
// Do not validate - it is too slow.
double r,s,t;
ClosestPointTo(point,&r,&s,&t);
return PointAt(r,s,t);
}
示例13: Domain
ON_BOOL32 ON_ArcCurve::SetEndPoint(ON_3dPoint end_point)
{
if (IsCircle())
return false;
ON_BOOL32 rc = false;
if ( m_dim == 3 || end_point.z == 0.0 )
{
ON_3dPoint P;
ON_3dVector T;
double t = Domain()[0];
Ev1Der( t, P, T );
ON_Arc a;
rc = a.Create( P, T, end_point );
if ( rc )
{
m_arc = a;
}
else {
ON_3dPoint start_point = PointAt(Domain()[0]);
if (end_point.DistanceTo(start_point) < ON_ZERO_TOLERANCE*m_arc.Radius()){
//make arc into circle
m_arc.plane.xaxis = start_point - m_arc.Center();
m_arc.plane.xaxis.Unitize();
m_arc.plane.yaxis = ON_CrossProduct(m_arc.Normal(), m_arc.plane.xaxis);
m_arc.plane.yaxis.Unitize();
m_arc.SetAngleRadians(2.0*ON_PI);
rc = true;
}
}
}
return rc;
}
示例14: ClosestPointTo
// returns point on circle that is arc to given point
ON_3dPoint ON_Arc::ClosestPointTo(
const ON_3dPoint& pt
) const
{
double t = m_angle[0];
ClosestPointTo( pt, &t );
return PointAt(t);
}
示例15: PointAt
ON_BOOL32 ON_LineCurve::Trim( const ON_Interval& domain )
{
ON_BOOL32 rc = false;
if ( domain.IsIncreasing() )
{
ON_3dPoint p = PointAt( domain[0] );
ON_3dPoint q = PointAt( domain[1] );
if( p.DistanceTo(q)>0){ // 2 April 2003 Greg Arden A successfull trim
// should return an IsValid ON_LineCurve .
m_line.from = p;
m_line.to = q;
m_t = domain;
rc = true;
}
}
return rc;
}