OpenSubdiv/regression/shapes/loop_chaikin1.h
manuelk 2dc8520938 Fix Chaikin rule
The Chaikin crease interpolation mode seems to be broken:
	   - Catmark / Loop / Bilinear are passing the wrong halfedge vertex to the
	     SubdivideCreaseWeight function which results in sub-edge crease weights
	     being swapped
	   - the loop that iterates over adjacent edges needs to check against both
	     the original edge and its opposite, otherwise it may be incorrectly
	     accumulated into summation of these adjacent edges (with a 0.25 weight)

	   The proposed fix:
	   - Swaps the Dest/Org vertex passed to the SubdivideCreaseWeight (and
	     we probably want Julian to confirm that this the correct fix)
	   - Checks against both the original edge and its opposite in the iteration
	     over adjacent edges
	   - Replaces the std::vector based query with an HbrHalfedgeOperator for
	     better performance (hopefully)

	   The similar fix to OpenSubdiv been reviewed by Tony DeRose.

    Also in the fix:
        - fix "obj" tag parsing of the smooth triangle tag that was incorrectly
          associated with the crease method (and reporting the wrong errors)
        - add regression shapes for both Loop & Catmark schemes to hbr_regression
        - add same shapes to the glViewer
        - improve hbr_regression output to be more readable
        - add command-line argument parsing to hbr_regression
        - add functionality to dump an obj file when regression fails for comparison

fixes #235
2013-11-07 17:06:55 -08:00

176 lines
5.3 KiB
C++

//
// Copyright 2013 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string loop_chaikin1 =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v -0.500000 -1.500000 0.500000\n"
"v 0.500000 -1.500000 0.500000\n"
"v -0.500000 -0.900000 0.500000\n"
"v 0.500000 -0.900000 0.500000\n"
"v -0.500000 -0.300000 0.500000\n"
"v 0.500000 -0.300000 0.500000\n"
"v -0.500000 0.300000 0.500000\n"
"v 0.500000 0.300000 0.500000\n"
"v -0.500000 0.900000 0.500000\n"
"v 0.500000 0.900000 0.500000\n"
"v -0.500000 1.500000 0.500000\n"
"v 0.500000 1.500000 0.500000\n"
"v -0.500000 1.500000 -0.500000\n"
"v 0.500000 1.500000 -0.500000\n"
"v -0.500000 0.900000 -0.500000\n"
"v 0.500000 0.900000 -0.500000\n"
"v -0.500000 0.300000 -0.500000\n"
"v 0.500000 0.300000 -0.500000\n"
"v -0.500000 -0.300000 -0.500000\n"
"v 0.500000 -0.300000 -0.500000\n"
"v -0.500000 -0.900000 -0.500000\n"
"v 0.500000 -0.900000 -0.500000\n"
"v -0.500000 -1.500000 -0.500000\n"
"v 0.500000 -1.500000 -0.500000\n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vt 0 0 \n"
"vn -0.577350 -0.577350 0.577350\n"
"vn 0.577350 -0.577350 0.577350\n"
"vn -0.707107 0.000000 0.707107\n"
"vn 0.707107 0.000000 0.707107\n"
"vn -0.707107 0.000000 0.707107\n"
"vn 0.707107 0.000000 0.707107\n"
"vn -0.707107 0.000000 0.707107\n"
"vn 0.707107 0.000000 0.707107\n"
"vn -0.707107 0.000000 0.707107\n"
"vn 0.707107 0.000000 0.707107\n"
"vn -0.577350 0.577350 0.577350\n"
"vn 0.577350 0.577350 0.577350\n"
"vn -0.577350 0.577350 -0.577350\n"
"vn 0.577350 0.577350 -0.577350\n"
"vn -0.707107 0.000000 -0.707107\n"
"vn 0.707107 0.000000 -0.707107\n"
"vn -0.707107 0.000000 -0.707107\n"
"vn 0.707107 0.000000 -0.707107\n"
"vn -0.707107 0.000000 -0.707107\n"
"vn 0.707107 0.000000 -0.707107\n"
"vn -0.707107 0.000000 -0.707107\n"
"vn 0.707107 0.000000 -0.707107\n"
"vn -0.577350 -0.577350 -0.577350\n"
"vn 0.577350 -0.577350 -0.577350\n"
"s off\n"
"f 1/1/1 2/2/2 3/3/3\n"
"f 3/3/3 2/2/2 4/4/4\n"
"f 3/3/3 4/4/4 5/5/5\n"
"f 5/5/5 4/4/4 6/6/6\n"
"f 5/5/5 6/6/6 7/7/7\n"
"f 7/7/7 6/6/6 8/8/8\n"
"f 7/7/7 8/8/8 9/9/9\n"
"f 9/9/9 8/8/8 10/10/10\n"
"f 9/9/9 10/10/10 11/11/11\n"
"f 11/11/11 10/10/10 12/12/12\n"
"f 11/11/11 12/12/12 13/13/13\n"
"f 13/13/13 12/12/12 14/14/14\n"
"f 13/13/13 14/14/14 15/15/15\n"
"f 15/15/15 14/14/14 16/16/16\n"
"f 15/15/15 16/16/16 17/17/17\n"
"f 17/17/17 16/16/16 18/18/18\n"
"f 17/17/17 18/18/18 19/19/19\n"
"f 19/19/19 18/18/18 20/20/20\n"
"f 19/19/19 20/20/20 21/21/21\n"
"f 21/21/21 20/20/20 22/22/22\n"
"f 21/21/21 22/22/22 23/23/23\n"
"f 23/23/23 22/22/22 24/24/24\n"
"f 23/23/23 24/24/24 1/1/1\n"
"f 1/1/1 24/24/24 2/2/2\n"
"f 2/2/2 24/24/24 4/4/4\n"
"f 4/4/4 24/24/24 22/22/22\n"
"f 4/4/4 22/22/22 6/6/6\n"
"f 6/6/6 22/22/22 20/20/20\n"
"f 6/6/6 20/20/20 8/8/8\n"
"f 8/8/8 20/20/20 18/18/18\n"
"f 8/8/8 18/18/18 10/10/10\n"
"f 10/10/10 18/18/18 16/16/16\n"
"f 10/10/10 16/16/16 12/12/12\n"
"f 12/12/12 16/16/16 14/14/14\n"
"f 23/23/23 1/1/1 21/21/21\n"
"f 21/21/21 1/1/1 3/3/3\n"
"f 21/21/21 3/3/3 19/19/19\n"
"f 19/19/19 3/3/3 5/5/5\n"
"f 19/19/19 5/5/5 17/17/17\n"
"f 17/17/17 5/5/5 7/7/7\n"
"f 17/17/17 7/7/7 15/15/15\n"
"f 15/15/15 7/7/7 9/9/9\n"
"f 15/15/15 9/9/9 13/13/13\n"
"f 13/13/13 9/9/9 11/11/11\n"
"t crease 2/1/0 0 1 5.000000\n"
"t crease 2/1/0 1 3 1.000000\n"
"t crease 2/1/0 2 0 1.000000\n"
"t crease 2/1/0 3 5 2.000000\n"
"t crease 2/1/0 4 2 2.000000\n"
"t crease 2/1/0 5 7 3.000000\n"
"t crease 2/1/0 6 4 3.000000\n"
"t crease 2/1/0 7 9 4.000000\n"
"t crease 2/1/0 8 6 4.000000\n"
"t crease 2/1/0 9 11 5.000000\n"
"t crease 2/1/0 11 10 5.000000\n"
"t crease 2/1/0 10 8 5.000000\n"
"t crease 2/1/0 11 13 5.000000\n"
"t crease 2/1/0 13 12 5.000000\n"
"t crease 2/1/0 12 10 5.000000\n"
"t crease 2/1/0 13 15 5.000000\n"
"t crease 2/1/0 14 12 5.000000\n"
"t crease 2/1/0 15 17 4.000000\n"
"t crease 2/1/0 16 14 4.000000\n"
"t crease 2/1/0 17 19 3.000000\n"
"t crease 2/1/0 18 16 3.000000\n"
"t crease 2/1/0 19 21 2.000000\n"
"t crease 2/1/0 20 18 2.000000\n"
"t crease 2/1/0 21 23 1.000000\n"
"t crease 2/1/0 23 22 5.000000\n"
"t crease 2/1/0 22 20 1.000000\n"
"t crease 2/1/0 23 1 5.000000\n"
"t crease 2/1/0 0 22 5.000000\n"
"t creasemethod 0/0/1 chaikin\n"
"\n"
;