<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: AcGeNurbSurface - control points in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7945302#M6755</link>
    <description>&lt;P&gt;I use the follwing code to convert some 3rd party NURBS surface data to &lt;FONT face="courier new,courier"&gt;AcGeNurbSurface&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;bool setNurbSurface(AcGeNurbSurface &amp;amp;acSurf, const ExternalNurbSurface &amp;amp;extNurbSurf)
{
	int degreeU = extNurbSurf.DegreeU(); 
	int degreeV = extNurbSurf.DegreeV();
	//props: See AcGe::NurbSurfaceProperties 
        //enum NurbSurfaceProperties {kOpen=0x01, kClosed=0x02, kPeriodic=0x04,
        //                            kRational=0x08, kNoPoles=0x10, kPoleAtMin=0x20,
        //                            kPoleAtMax=0x40, kPoleAtBoth=0x80};

	const ExternalNurbSurfNet surfNet=extNurbSurf.SurfNet();
	bool bIsReversed = extNurbSurf.IsReversed();

	int propsInU = AcGe::kOpen; 
	int propsInV = AcGe::kOpen; 

	AcGeDoubleArray weights;
	AcGePoint3dArray controlPoints;
	AcGePoint3d acPt;
	double w, f;
	int numControlPointsInU = (int)surfNet.rows();
	int numControlPointsInV = (int)surfNet.columns();
	int u,v;

	for (u=0; u&amp;lt;numControlPointsInU; u++)
	for (v=0; v&amp;lt;numControlPointsInV; v++)
	{
		const ExternalPoint &amp;amp;extPt = surfNet[u][v];
		w = Weight(extPt.w());
		f = (fabs(w) &amp;gt; 1e-10)?  (1.0 / w) : 1.0;

		acPt.x = f*extPt.x();
		acPt.y = f*extPt.y();
		acPt.z = f*extPt.z();

		if ((u&amp;gt;0) &amp;amp;&amp;amp; (w != Weight(surfNet[u][0].w())) )
			propsInU |= AcGe::kRational; 
		if ((v&amp;gt;0) &amp;amp;&amp;amp; (w != Weight(surfNet[0][v].w())) )
			propsInV |= AcGe::kRational; 

		controlPoints.append(acPt);
		weights.append(w);
	}

	ExternalKnotVectors extKnots = extNurbSurf.GetKnotVectors();
	size_t nUknots = extKnots.UKnots();
	size_t nVknots = extKnots.VKnots();
	AcGeKnotVector uKnots, vKnots;

	for (u=0; u&amp;lt;nUknots ; u++)
		uKnots.append(extKnots.GetUKnot(u));

	for (v=0; v&amp;lt;nVknots ; v++)
		vKnots.append(extKnots.GetVKnot(v));

	acSurf.set(
		degreeU, degreeV,
		propsInU, propsInV,
		numControlPointsInU, numControlPointsInV,
		controlPoints.asArrayPtr(),
		weights.asArrayPtr(),
		uKnots, vKnots
	);

	if (bIsReversed)
		acSurf.reverseNormal();

	return true;
}&lt;/PRE&gt;
&lt;P&gt;As you can see in the two &lt;FONT face="courier new,courier"&gt;for&lt;/FONT&gt;-Loops the controlpoints are ordered like this:&lt;/P&gt;
&lt;P&gt;[u0,v0], [u0,v1], [u0,v2],&amp;nbsp;&amp;nbsp; [u1,v0], [u1,v1], [u1,v2],&amp;nbsp;&amp;nbsp; [u2,v0], [u2,v1], [u2,v2],&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;</description>
    <pubDate>Thu, 19 Apr 2018 15:43:31 GMT</pubDate>
    <dc:creator>tbrammer</dc:creator>
    <dc:date>2018-04-19T15:43:31Z</dc:date>
    <item>
      <title>AcGeNurbSurface - control points</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7943860#M6754</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get the control points from an AcGeNurbSurface entity. What I found from the documentation is that I can use the method getControlPoints. However, this method does not mention how the control points are arranged, if they vary most quickly in the u direction and then in the v direction or vice versa?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition, I was expecting to find a method to get a single control point at specific location. So, I can revert by myself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone explain me how the control points are arranged and if there is any other way to obtain more specific information for them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Respectfully,&lt;/P&gt;&lt;P&gt;Evangelos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 07:53:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7943860#M6754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-19T07:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeNurbSurface - control points</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7945302#M6755</link>
      <description>&lt;P&gt;I use the follwing code to convert some 3rd party NURBS surface data to &lt;FONT face="courier new,courier"&gt;AcGeNurbSurface&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;bool setNurbSurface(AcGeNurbSurface &amp;amp;acSurf, const ExternalNurbSurface &amp;amp;extNurbSurf)
{
	int degreeU = extNurbSurf.DegreeU(); 
	int degreeV = extNurbSurf.DegreeV();
	//props: See AcGe::NurbSurfaceProperties 
        //enum NurbSurfaceProperties {kOpen=0x01, kClosed=0x02, kPeriodic=0x04,
        //                            kRational=0x08, kNoPoles=0x10, kPoleAtMin=0x20,
        //                            kPoleAtMax=0x40, kPoleAtBoth=0x80};

	const ExternalNurbSurfNet surfNet=extNurbSurf.SurfNet();
	bool bIsReversed = extNurbSurf.IsReversed();

	int propsInU = AcGe::kOpen; 
	int propsInV = AcGe::kOpen; 

	AcGeDoubleArray weights;
	AcGePoint3dArray controlPoints;
	AcGePoint3d acPt;
	double w, f;
	int numControlPointsInU = (int)surfNet.rows();
	int numControlPointsInV = (int)surfNet.columns();
	int u,v;

	for (u=0; u&amp;lt;numControlPointsInU; u++)
	for (v=0; v&amp;lt;numControlPointsInV; v++)
	{
		const ExternalPoint &amp;amp;extPt = surfNet[u][v];
		w = Weight(extPt.w());
		f = (fabs(w) &amp;gt; 1e-10)?  (1.0 / w) : 1.0;

		acPt.x = f*extPt.x();
		acPt.y = f*extPt.y();
		acPt.z = f*extPt.z();

		if ((u&amp;gt;0) &amp;amp;&amp;amp; (w != Weight(surfNet[u][0].w())) )
			propsInU |= AcGe::kRational; 
		if ((v&amp;gt;0) &amp;amp;&amp;amp; (w != Weight(surfNet[0][v].w())) )
			propsInV |= AcGe::kRational; 

		controlPoints.append(acPt);
		weights.append(w);
	}

	ExternalKnotVectors extKnots = extNurbSurf.GetKnotVectors();
	size_t nUknots = extKnots.UKnots();
	size_t nVknots = extKnots.VKnots();
	AcGeKnotVector uKnots, vKnots;

	for (u=0; u&amp;lt;nUknots ; u++)
		uKnots.append(extKnots.GetUKnot(u));

	for (v=0; v&amp;lt;nVknots ; v++)
		vKnots.append(extKnots.GetVKnot(v));

	acSurf.set(
		degreeU, degreeV,
		propsInU, propsInV,
		numControlPointsInU, numControlPointsInV,
		controlPoints.asArrayPtr(),
		weights.asArrayPtr(),
		uKnots, vKnots
	);

	if (bIsReversed)
		acSurf.reverseNormal();

	return true;
}&lt;/PRE&gt;
&lt;P&gt;As you can see in the two &lt;FONT face="courier new,courier"&gt;for&lt;/FONT&gt;-Loops the controlpoints are ordered like this:&lt;/P&gt;
&lt;P&gt;[u0,v0], [u0,v1], [u0,v2],&amp;nbsp;&amp;nbsp; [u1,v0], [u1,v1], [u1,v2],&amp;nbsp;&amp;nbsp; [u2,v0], [u2,v1], [u2,v2],&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 15:43:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7945302#M6755</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-04-19T15:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeNurbSurface - control points</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7947174#M6756</link>
      <description>&lt;P&gt;Thank you very much for your reply tbrammer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, AutoCAD assumes by default that the control points vary most quickly with v and then with u. In my opinion, it must be mentioned in the description of the control points of the AcGeNurbSurface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Evangelos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 07:47:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgenurbsurface-control-points/m-p/7947174#M6756</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-20T07:47:18Z</dc:date>
    </item>
  </channel>
</rss>

