本文整理汇总了C++中ON_Interval::ParameterAt方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Interval::ParameterAt方法的具体用法?C++ ON_Interval::ParameterAt怎么用?C++ ON_Interval::ParameterAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Interval
的用法示例。
在下文中一共展示了ON_Interval::ParameterAt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Domain
ON_BOOL32
ON_Surface::IsClosed(int dir) const
{
ON_Interval d = Domain(dir);
if ( d.IsIncreasing() && Dimension() <= 3 ) {
const int span_count = SpanCount(dir?0:1);
const int span_degree = Degree(dir?0:1);
if ( span_count > 0 && span_degree > 0 )
{
ON_SimpleArray<double> s(span_count+1);
s.SetCount(span_count+1);
int n = 2*span_degree+1;
double delta = 1.0/n;
ON_3dPoint P, Q;
P.Zero();
Q.Zero();
int hintP[2] = {0,0};
int hintQ[2] = {0,0};
double *u0, *u1, *v0, *v1;
double t;
ON_Interval sp;
if ( dir ) {
v0 = &d.m_t[0];
v1 = &d.m_t[1];
u0 = &t;
u1 = &t;
}
else {
u0 = &d.m_t[0];
u1 = &d.m_t[1];
v0 = &t;
v1 = &t;
}
if ( GetSpanVector( dir?0:1, s.Array() ) )
{
int span_index, i;
for ( span_index = 0; span_index < span_count; span_index++ ) {
sp.Set(s[span_index],s[span_index+1]);
for ( i = 0; i < n; i++ ) {
t = sp.ParameterAt(i*delta);
if ( !Evaluate( *u0, *v0, 1, 3, P, 0, hintP ) )
return false;
if ( !Evaluate( *u1, *v1, 2, 3, Q, 0, hintQ ) )
return false;
if ( false == ON_PointsAreCoincident( 3, 0, &P.x, &Q.x ) )
return false;
}
}
return true;
}
}
}
return false;
}
示例2: FalseColor
ON_Color CZAnalysisVAM::FalseColor(double z) const
{
// Simple example of one way to change a number
// into a color.
double s = m_z_range.NormalizedParameterAt(z);
if ( s < 0.0 ) s = 0.0; else if (s > 1.0) s = 1.0;
double hue = m_hue_range.ParameterAt(s);
ON_Color c;
c.SetHSV( hue, 1.0, 1.0 );
return c;
}
示例3: GetNormalizedArcLengthPoint
ON_BOOL32 ON_LineCurve::GetNormalizedArcLengthPoint(
double s,
double* t,
double fractional_tolerance,
const ON_Interval* sub_domain
) const
{
ON_Interval domain = (sub_domain) ? *sub_domain : Domain();
if ( t )
*t = domain.ParameterAt(s);
return true;
}
示例4: SurfaceParameter
ON_2dPoint ON_PolyEdgeCurve::SurfaceParameter(double t) const
{
ON_2dPoint srf_uv(ON_UNSET_VALUE,ON_UNSET_VALUE);
int segment_index = SegmentIndex(t);
ON_PolyEdgeSegment* seg = SegmentCurve( segment_index );
if ( seg )
{
ON_Interval pdom = SegmentDomain(segment_index);
ON_Interval sdom = seg->Domain();
if ( sdom != pdom )
{
double s = pdom.NormalizedParameterAt(t);
t = sdom.ParameterAt(s);
}
srf_uv = seg->SurfaceParameter(t);
}
return srf_uv;
}
示例5: TrimParameter
double ON_PolyEdgeCurve::TrimParameter(double t) const
{
double trim_t = ON_UNSET_VALUE;
int segment_index = SegmentIndex(t);
ON_PolyEdgeSegment* seg = SegmentCurve( segment_index );
if ( seg )
{
ON_Interval pdom = SegmentDomain(segment_index);
ON_Interval sdom = seg->Domain();
if ( sdom != pdom )
{
double s = pdom.NormalizedParameterAt(t);
t = sdom.ParameterAt(s);
}
trim_t = seg->TrimParameter(t);
}
return trim_t;
}
示例6: Trim
ON_BOOL32 ON_ArcCurve::Trim( const ON_Interval& in )
{
ON_BOOL32 rc = in.IsIncreasing();
if (rc)
{
double t0 = m_t.NormalizedParameterAt(in.m_t[0]);
double t1 = m_t.NormalizedParameterAt(in.m_t[1]);
const ON_Interval arc_angle0 = m_arc.DomainRadians();
double a0 = arc_angle0.ParameterAt(t0);
double a1 = arc_angle0.ParameterAt(t1);
// Resulting ON_Arc must pass IsValid()
if ( a1 - a0 > ON_ZERO_TOLERANCE && m_arc.SetAngleIntervalRadians(ON_Interval(a0,a1)) )
{
m_t = in;
}
else
{
rc = false;
}
}
return rc;
}
示例7: ON_BrepExtrudeHelper_MakeConeSrf
static
ON_NurbsSurface* ON_BrepExtrudeHelper_MakeConeSrf( const ON_3dPoint& apex_point,
const ON_BrepEdge& edge, ON_BOOL32 bRev )
{
// The "s" parameter runs along the edge.
// The "t" parameter is the ruling parameter;
// t=0 is at the base_edge and t=max is at the apex.
// surface side location
// south base_edge
// east line from bRev?START:END of edge to apex
// north singular side at apex
// west line from bRev?END:START of edge to apex.
ON_NurbsSurface* cone_srf = new ON_NurbsSurface();
if ( cone_srf->CreateConeSurface( apex_point, edge ) )
{
if ( bRev )
cone_srf->Reverse(0);
// get a decent interval for the ruling parameter
double d = 0.0;
ON_Interval edom = edge.Domain();
ON_3dPoint pt;
int i, hint=0;
for ( i = 0; i <= 16; i++ )
{
if ( !edge.EvPoint( edom.ParameterAt(i/16.0), pt, 0, &hint ) )
continue;
if ( pt.DistanceTo(apex_point) > d )
d = pt.DistanceTo(apex_point);
}
if ( d > ON_SQRT_EPSILON )
cone_srf->SetDomain(1,0.0,d);
}
else
{
delete cone_srf;
cone_srf = 0;
}
return cone_srf;
}
示例8: EvSrfDerivatives
bool ON_PolyEdgeCurve::EvSrfDerivatives(
double t,
ON_3dPoint& srfpoint,
ON_3dVector& du,
ON_3dVector& dv,
ON_3dVector& duu,
ON_3dVector& duv,
ON_3dVector& dvv
) const
{
bool rc = false;
int segment_index = SegmentIndex(t);
ON_PolyEdgeSegment* seg = SegmentCurve( segment_index );
if ( seg )
{
ON_Interval pdom = SegmentDomain(segment_index);
ON_Interval sdom = seg->Domain();
double s = t;
if ( sdom != pdom )
{
double x = pdom.NormalizedParameterAt(t);
s = sdom.ParameterAt(x);
}
// s is the segment parameter at the polyedge parameter t
// Get the corresponding surfaces parameters
ON_2dPoint srf_uv = seg->SurfaceParameter(s);
if ( ON_IsValid(srf_uv.x) )
{
if ( srf_uv.x == seg->m_evsrf_uv[0] && srf_uv.y == seg->m_evsrf_uv[1] )
{
rc = true;
srfpoint = seg->m_evsrf_pt;
du = seg->m_evsrf_du;
dv = seg->m_evsrf_dv;
duu = seg->m_evsrf_duu;
duv = seg->m_evsrf_duv;
dvv = seg->m_evsrf_dvv;
}
else if ( seg->m_surface )
{
rc = seg->m_surface->Ev2Der(
srf_uv.x, srf_uv.y,
srfpoint,
du, dv,
duu, duv, dvv,
0, seg->m_evsrf_hint
) ? true : false;
if ( rc )
{
CookDerivativesHelper( du, dv, duu, duv, dvv);
seg->m_evsrf_uv[0] = srf_uv.x;
seg->m_evsrf_uv[1] = srf_uv.y;
seg->m_evsrf_pt = srfpoint;
seg->m_evsrf_du = du;
seg->m_evsrf_dv = dv;
seg->m_evsrf_duu = duu;
seg->m_evsrf_duv = duv;
seg->m_evsrf_dvv = dvv;
}
}
}
}
return rc;
}
示例9: VMOVE
/**
* R T _ B R E P _ P L O T
*/
int
rt_brep_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
{
TRACE1("rt_brep_plot");
struct rt_brep_internal* bi;
RT_CK_DB_INTERNAL(ip);
bi = (struct rt_brep_internal*)ip->idb_ptr;
RT_BREP_CK_MAGIC(bi);
// XXX below does NOT work for non-trivial faces, in addition to
// the fact that openNURBS does NOT support meshes!
//
// XXX currently not handling the tolerance
// ON_MeshParameters mp;
// mp.JaggedAndFasterMeshParameters();
// ON_SimpleArray<ON_Mesh*> mesh_list;
// bi->brep->CreateMesh(mp, mesh_list);
// point_t pt1, pt2;
// ON_SimpleArray<ON_2dex> edges;
// for (int i = 0; i < mesh_list.Count(); i++) {
// const ON_Mesh* mesh = mesh_list[i];
// mesh->GetMeshEdges(edges);
// for (int j = 0; j < edges.Count(); j++) {
// ON_MeshVertexRef v1 = mesh->VertexRef(edges[j].i);
// ON_MeshVertexRef v2 = mesh->VertexRef(edges[j].j);
// VSET(pt1, v1.Point().x, v1.Point().y, v1.Point().z);
// VSET(pt2, v2.Point().x, v2.Point().y, v2.Point().z);
// RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
// RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
// }
// edges.Empty();
// }
// So we'll do it by hand by grabbing each topological edge from
// the brep and rendering it that way...
ON_Brep* brep = bi->brep;
point_t pt1, pt2;
// for (int i = 0; i < brep->m_F.Count(); i++) {
// ON_BrepFace& f = brep->m_F[i];
// SurfaceTree st(&f);
// plot_bbnode(st.getRootNode(), vhead);
// }
for (int i = 0; i < bi->brep->m_E.Count(); i++) {
ON_BrepEdge& e = brep->m_E[i];
const ON_Curve* crv = e.EdgeCurveOf();
if (crv->IsLinear()) {
ON_BrepVertex& v1 = brep->m_V[e.m_vi[0]];
ON_BrepVertex& v2 = brep->m_V[e.m_vi[1]];
VMOVE(pt1, v1.Point());
VMOVE(pt2, v2.Point());
RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
RT_ADD_VLIST(vhead, pt2, BN_VLIST_LINE_DRAW);
} else {
ON_Interval dom = crv->Domain();
// XXX todo: dynamically sample the curve
for (int i = 0; i <= 10; i++) {
ON_3dPoint p = crv->PointAt(dom.ParameterAt((double)i/10.0));
VMOVE(pt1, p);
if (i == 0) {
RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_MOVE);
}
else {
RT_ADD_VLIST(vhead, pt1, BN_VLIST_LINE_DRAW);
}
}
}
}
return 0;
}