diff --git a/makefile b/makefile index 0fc4f6f5..f0431df6 100644 --- a/makefile +++ b/makefile @@ -2,12 +2,28 @@ # # Gnu tools makefile # -# gnumake, gcc, g++ +# gnumake, gcc, g++, clang, clang++ # -# (Tested with gcc 4.2.1 on OSX 10.8.1) +# Warning: +# The officially supported way to build opennurbs on Linux is CMake. +# This makefile is kept here for users who prefer +# a makefile and are prepared to modify it to suit their needs. +# It might or might not be kept up-to-date - but we try. +# Use "at your own pleasure" only! +# +# Any new combination of operating system, compiler, +# and build configuration might require some modification to this file. +# +# Tested on Linux Debian 12 with g++ 12.2.0 +# TODO: test on Mac +# +# Usage: In the simplest case, the command +# +# make all +# +# will build a debug build of the static archive libopennurbs_public.a and all examples. +# Thus, this makefile is only for use within the public opennurbs repository, even though it also exists in the upstream repository. # -# If you want to use other versions of make or other compilers, -# then you will have to modify this file. # RM = /bin/rm @@ -15,7 +31,7 @@ RM = /bin/rm # asks too many questions, then uncomment the next line. # RM = /bin/rm -f -AR = ar qvl +AR = ar rcsv # If your system doesn't use ranlib, uncomment the "echo" define. RANLIB = ranlib @@ -36,7 +52,6 @@ ON_GNU_WARNING_FLAGS = -Wall \ -Wno-switch \ -Wno-unknown-pragmas \ -Wno-unused-private-field - # -Wno-inconsistent-missing-override \ @@ -65,6 +80,9 @@ LINKFLAGS = ############################################################### +.c.o : + $(CC) $(CFLAGS) -c $*.c -o $*.o + .cpp.o : $(CCC) $(CCFLAGS) -c $*.cpp -o $*.o @@ -429,196 +447,7 @@ ON_SRC = opennurbs_3dm_attributes.cpp \ opennurbs_zlib.cpp \ opennurbs_zlib_memory.cpp -ON_OBJ = opennurbs_3dm_attributes.o \ - opennurbs_3dm_properties.o \ - opennurbs_3dm_settings.o \ - opennurbs_annotationbase.o \ - opennurbs_arc.o \ - opennurbs_arccurve.o \ - opennurbs_archivable_dictionary.o \ - opennurbs_archive.o \ - opennurbs_archive_manifest.o \ - opennurbs_array.o \ - opennurbs_base32.o \ - opennurbs_base64.o \ - opennurbs_beam.o \ - opennurbs_bezier.o \ - opennurbs_beziervolume.o \ - opennurbs_bitmap.o \ - opennurbs_bounding_box.o \ - opennurbs_box.o \ - opennurbs_brep.o \ - opennurbs_brep_extrude.o \ - opennurbs_brep_io.o \ - opennurbs_brep_isvalid.o \ - opennurbs_brep_region.o \ - opennurbs_brep_tools.o \ - opennurbs_brep_v2valid.o \ - opennurbs_calculator.o \ - opennurbs_circle.o \ - opennurbs_color.o \ - opennurbs_compress.o \ - opennurbs_compstat.o \ - opennurbs_cone.o \ - opennurbs_crc.o \ - opennurbs_curve.o \ - opennurbs_curveonsurface.o \ - opennurbs_curveproxy.o \ - opennurbs_cylinder.o \ - opennurbs_date.o \ - opennurbs_decals.o \ - opennurbs_defines.o \ - opennurbs_detail.o \ - opennurbs_dimension.o \ - opennurbs_dimensionformat.o \ - opennurbs_dimensionstyle.o \ - opennurbs_dithering.o \ - opennurbs_ellipse.o \ - opennurbs_embedded_file.o \ - opennurbs_error.o \ - opennurbs_error_message.o \ - opennurbs_evaluate_nurbs.o \ - opennurbs_extensions.o \ - opennurbs_file_utilities.o \ - opennurbs_font.o \ - opennurbs_freetype.o \ - opennurbs_fsp.o \ - opennurbs_function_list.o \ - opennurbs_geometry.o \ - opennurbs_glyph_outline.o \ - opennurbs_ground_plane.o \ - opennurbs_group.o \ - opennurbs_hash_table.o \ - opennurbs_hatch.o \ - opennurbs_instance.o \ - opennurbs_internal_V2_annotation.o \ - opennurbs_internal_V5_annotation.o \ - opennurbs_internal_V5_dimstyle.o \ - opennurbs_internal_Vx_annotation.o \ - opennurbs_intersect.o \ - opennurbs_ipoint.o \ - opennurbs_knot.o \ - opennurbs_layer.o \ - opennurbs_leader.o \ - opennurbs_light.o \ - opennurbs_line.o \ - opennurbs_linear_workflow.o \ - opennurbs_linecurve.o \ - opennurbs_linetype.o \ - opennurbs_locale.o \ - opennurbs_lock.o \ - opennurbs_lookup.o \ - opennurbs_material.o \ - opennurbs_math.o \ - opennurbs_matrix.o \ - opennurbs_md5.o \ - opennurbs_memory_util.o \ - opennurbs_mesh_modifiers.o \ - opennurbs_mesh.o \ - opennurbs_mesh_ngon.o \ - opennurbs_mesh_tools.o \ - opennurbs_mesh_topology.o \ - opennurbs_model_component.o \ - opennurbs_model_geometry.o \ - opennurbs_morph.o \ - opennurbs_nurbscurve.o \ - opennurbs_nurbssurface.o \ - opennurbs_nurbsvolume.o \ - opennurbs_object.o \ - opennurbs_object_history.o \ - opennurbs_objref.o \ - opennurbs_offsetsurface.o \ - opennurbs_optimize.o \ - opennurbs_parse_angle.o \ - opennurbs_parse_length.o \ - opennurbs_parse_number.o \ - opennurbs_parse_point.o \ - opennurbs_parse_settings.o \ - opennurbs_photogrammetry.o \ - opennurbs_plane.o \ - opennurbs_planesurface.o \ - opennurbs_pluginlist.o \ - opennurbs_point.o \ - opennurbs_pointcloud.o \ - opennurbs_pointgeometry.o \ - opennurbs_pointgrid.o \ - opennurbs_polycurve.o \ - opennurbs_polyedgecurve.o \ - opennurbs_polyline.o \ - opennurbs_polylinecurve.o \ - opennurbs_post_effects.o \ - opennurbs_precompiledheader.o \ - opennurbs_progress_reporter.o \ - opennurbs_public_memory.o \ - opennurbs_quaternion.o \ - opennurbs_rand.o \ - opennurbs_render_channels.o \ - opennurbs_render_content.o \ - opennurbs_revsurface.o \ - opennurbs_rtree.o \ - opennurbs_safe_frame.o \ - opennurbs_sectionstyle.o \ - opennurbs_sha1.o \ - opennurbs_skylight.o \ - opennurbs_sleeplock.o \ - opennurbs_sort.o \ - opennurbs_sphere.o \ - opennurbs_statics.o \ - opennurbs_std_string_format.o \ - opennurbs_std_string_utf.o \ - opennurbs_string.o \ - opennurbs_string_compare.o \ - opennurbs_string_format.o \ - opennurbs_string_scan.o \ - opennurbs_string_values.o \ - opennurbs_subd.o \ - opennurbs_subd_archive.o \ - opennurbs_subd_copy.o \ - opennurbs_subd_data.o \ - opennurbs_subd_eval.o \ - opennurbs_subd_fragment.o \ - opennurbs_subd_frommesh.o \ - opennurbs_subd_heap.o \ - opennurbs_subd_iter.o \ - opennurbs_subd_limit.o \ - opennurbs_subd_matrix.o \ - opennurbs_subd_mesh.o \ - opennurbs_subd_ref.o \ - opennurbs_subd_ring.o \ - opennurbs_subd_sector.o \ - opennurbs_subd_texture.o \ - opennurbs_sum.o \ - opennurbs_sumsurface.o \ - opennurbs_sun.o \ - opennurbs_surface.o \ - opennurbs_surfaceproxy.o \ - opennurbs_symmetry.o \ - opennurbs_terminator.o \ - opennurbs_text.o \ - opennurbs_text_style.o \ - opennurbs_textcontext.o \ - opennurbs_textglyph.o \ - opennurbs_textiterator.o \ - opennurbs_textlog.o \ - opennurbs_textobject.o \ - opennurbs_textrun.o \ - opennurbs_topology.o \ - opennurbs_torus.o \ - opennurbs_unicode.o \ - opennurbs_unicode_cpsb.o \ - opennurbs_units.o \ - opennurbs_userdata.o \ - opennurbs_userdata_obsolete.o \ - opennurbs_uuid.o \ - opennurbs_version.o \ - opennurbs_version_number.o \ - opennurbs_viewport.o \ - opennurbs_workspace.o \ - opennurbs_wstring.o \ - opennurbs_xform.o \ - opennurbs_xml.o \ - opennurbs_zlib.o \ - opennurbs_zlib_memory.o +ON_OBJ = $(ON_SRC:.cpp=.o) ZLIB_INC = zlib/crc32.h \ zlib/deflate.h \ @@ -643,17 +472,34 @@ ZLIB_SRC = zlib/adler32.c \ zlib/uncompr.c \ zlib/zutil.c -ZLIB_OBJ = zlib/adler32.o \ - zlib/compress.o \ - zlib/crc32.o \ - zlib/deflate.o \ - zlib/infback.o \ - zlib/inffast.o \ - zlib/inflate.o \ - zlib/inftrees.o \ - zlib/trees.o \ - zlib/uncompr.o \ - zlib/zutil.o +ZLIB_OBJ = $(ZLIB_SRC:.c=.o) + +UUID_INC = android_uuid/isnull.h \ + android_uuid/pack.h \ + android_uuid/parse.h \ + android_uuid/unpack.h \ + android_uuid/unparse.h \ + android_uuid/uuid_time.h \ + android_uuid/clear.h \ + android_uuid/compare.h \ + android_uuid/copy.h \ + android_uuid/gen_uuid.h + + +UUID_SRC = android_uuid/isnull.c \ + android_uuid/pack.c \ + android_uuid/parse.c \ + android_uuid/unpack.c \ + android_uuid/unparse.c \ + android_uuid/uuid_time.c \ + android_uuid/clear.c \ + android_uuid/compare.c \ + android_uuid/copy.c \ + android_uuid/gen_uuid.c + +UUID_OBJ = $(UUID_SRC:.c=.o) + + FREETYPE_INC= freetype263/include/ft2build.h \ freetype263/include/freetype/config/ftconfig.h \ @@ -784,44 +630,7 @@ FREETYPE_SRC = freetype263/src/autofit/autofit.c \ freetype263/src/winfonts/winfnt.c \ freetype263/src/cache/ftcache.c -FREETYPE_OBJ = freetype263/src/autofit/autofit.o \ - freetype263/src/bdf/bdf.o \ - freetype263/src/cff/cff.o \ - freetype263/src/base/ftbase.o \ - freetype263/src/base/ftbitmap.o \ - freetype263/src/base/ftfstype.o \ - freetype263/src/base/ftgasp.o \ - freetype263/src/base/ftglyph.o \ - freetype263/src/gzip/ftgzip.o \ - freetype263/src/base/ftinit.o \ - freetype263/src/lzw/ftlzw.o \ - freetype263/src/base/ftstroke.o \ - freetype263/src/base/ftsystem.o \ - freetype263/src/smooth/smooth.o \ - freetype263/src/base/ftbbox.o \ - freetype263/src/base/ftfntfmt.o \ - freetype263/src/base/ftgxval.o \ - freetype263/src/base/ftlcdfil.o \ - freetype263/src/base/ftmm.o \ - freetype263/src/base/ftotval.o \ - freetype263/src/base/ftpatent.o \ - freetype263/src/base/ftpfr.o \ - freetype263/src/base/ftsynth.o \ - freetype263/src/base/fttype1.o \ - freetype263/src/base/ftwinfnt.o \ - freetype263/src/pcf/pcf.o \ - freetype263/src/pfr/pfr.o \ - freetype263/src/psaux/psaux.o \ - freetype263/src/pshinter/pshinter.o \ - freetype263/src/psnames/psmodule.o \ - freetype263/src/raster/raster.o \ - freetype263/src/sfnt/sfnt.o \ - freetype263/src/truetype/truetype.o \ - freetype263/src/type1/type1.o \ - freetype263/src/cid/type1cid.o \ - freetype263/src/type42/type42.o \ - freetype263/src/winfonts/winfnt.o \ - freetype263/src/cache/ftcache.o +FREETYPE_OBJ = $(FREETYPE_SRC:.c=.o) EXAMPLE_INC = examples.h \ example_userdata/example_ud.h @@ -855,22 +664,28 @@ $(ZLIB_OBJ) : $(ZLIB_INC) ## ## opennurbs without freetype ## -ON_OBJ_EXTRA_FLAGS = -DON_COMPILING_OPENNURBS +ON_OBJ_EXTRA_FLAGS = -DON_COMPILING_OPENNURBS -DOPENNURBS_PUBLIC $(ON_OBJ) : CFLAGS+=$(ON_OBJ_EXTRA_FLAGS) $(ON_OBJ) : CCFLAGS+=$(ON_OBJ_EXTRA_FLAGS) $(ON_OBJ) : $(ON_INC) -$(OPENNURBS_LIB_FILE) : $(ON_OBJ) $(ZLIB_OBJ) +opennurbs_objects : $(ON_OBJ) +uuid_objects : $(UUID_OBJ) +zlib_objects : $(ZLIB_OBJ) + + +$(OPENNURBS_LIB_FILE) : opennurbs_objects zlib_objects uuid_objects -$(RM) $@ - $(AR) $@ $(ON_OBJ) $(ZLIB_OBJ) + $(AR) $@ $(ON_OBJ) $(ZLIB_OBJ) $(UUID_OBJ) $(RANLIB) $@ ######################################################## ## ## opennurbs with freetype ## +## freetype_objects : $(FREETYPE_OBJ) ### opennurbs_freetype.h requires -I./freetype263/include -##ON_OBJ_EXTRA_FLAGS = -DON_COMPILING_OPENNURBS -I./freetype263/include +##ON_OBJ_EXTRA_FLAGS = -DON_COMPILING_OPENNURBS -DOPENNURBS_PUBLIC -I./freetype263/include ##$(ON_OBJ) : CFLAGS+=$(ON_OBJ_EXTRA_FLAGS) ##$(ON_OBJ) : CCFLAGS+=$(ON_OBJ_EXTRA_FLAGS) ##$(ON_OBJ) : $(ON_INC) @@ -879,9 +694,9 @@ $(OPENNURBS_LIB_FILE) : $(ON_OBJ) $(ZLIB_OBJ) ##$(FREETYPE_OBJ) : CFLAGS+=$(FREETYPE_OBJ_EXTRA_FLAGS) ##$(FREETYPE_OBJ) : $(FREETYPE_INC) ## -##$(OPENNURBS_LIB_FILE) : $(ON_OBJ) $(ZLIB_OBJ) $(FREETYPE_OBJ) +##$(OPENNURBS_LIB_FILE) : opennurbs_objects zlib_objects uuid_objects freetype_objects ## -$(RM) $@ -## $(AR) $@ $(ON_OBJ) $(ZLIB_OBJ) $(FREETYPE_OBJ) +## $(AR) $@ $(ON_OBJ) $(ZLIB_OBJ) $(UUID_OBJ) $(FREETYPE_OBJ) ## $(RANLIB) $@ example_read/example_read : example_read/example_read.o example_userdata/example_ud.o $(OPENNURBS_LIB_FILE) @@ -905,6 +720,7 @@ example_userdata/example_userdata : example_userdata/example_userdata.o $(OPENNU clean : -$(RM) $(OPENNURBS_LIB_FILE) -$(RM) $(ON_OBJ) + -$(RM) $(UUID_OBJ) -$(RM) $(ZLIB_OBJ) -$(RM) $(FREETYPE_OBJ) -$(RM) $(EXAMPLE_OBJ) diff --git a/opennurbs_3dm_attributes.cpp b/opennurbs_3dm_attributes.cpp index 629d864e..71cdd60b 100644 --- a/opennurbs_3dm_attributes.cpp +++ b/opennurbs_3dm_attributes.cpp @@ -422,7 +422,7 @@ enum ON_3dmObjectAttributesTypeCodes : unsigned char // file version 2.10: custom linetype CustomLinetype = 38, // 18 Apr 2023 S. Baer - // file version 2.11: custome section style + // file version 2.11: custom section style CustomSectionStyle = 39, // 10 May 2023 S. Baer // file version 2.12: ClippingPlaneLabelStyle @@ -1576,7 +1576,7 @@ bool ON_3dmObjectAttributes::Write( ON_BinaryArchive& file ) const } if (rc) { - // 22 Sep 2006 - the way ON_3dmObjectAttiributes indicates + // 22 Sep 2006 - the way ON_3dmObjectAttributes indicates // that an object is put on a particular page view changed // from being saved in the m_dmref[] list to using the // m_space and m_viewport_id settings. But the file format @@ -1720,7 +1720,7 @@ void ON_3dmObjectAttributes::Dump( ON_TextLog& dump ) const // When mat_source is not (ON::object_material_source::material_from_object. This causes the // 3dm content to vary in a way that content hashing must ignore. The sample file // C:\dev\github\mcneel\rhino\src4\opennurbs\example_files\V5\v5_teacup.3dm is an example. - // It's old enough that it contians material index values >= 0 that are not saved + // It's old enough that it contains material index values >= 0 that are not saved // by SaveAs V5 writing code since circa 2010 or earlier. dump.Print("object material index = %d\n", m_material_index); } @@ -1810,7 +1810,7 @@ bool ON_3dmObjectAttributes::SetName( // that are not valid names. Some of these strings begin with a bracket that // is permitted to appear later in the name. Prepending a carrot makes the names // unique while not turning them into something that the Rhino or python parsers - // keey off of in some other way. + // key off of in some other way. // way to make these names ON_wString prefixed_name = '^'; prefixed_name += name; diff --git a/opennurbs_3dm_settings.cpp b/opennurbs_3dm_settings.cpp index d16b089c..c348e2b0 100644 --- a/opennurbs_3dm_settings.cpp +++ b/opennurbs_3dm_settings.cpp @@ -274,12 +274,12 @@ double ON_UnitSystem::MetersPerUnit() const // For standard units, this function returns the WRONG value (inverse of the correct value). // The reason is the Rhino 6 VRay plug-in assumes the incorrect value is returned // and V6 VRay does not work correctly in Rhino 7 if the correct value is returned. - // After some discussion (see the bug above), we will leave the invers bug in + // After some discussion (see the bug above), we will leave the inverse bug in // ON_UnitSystem::MetersPerUnit(), deprecate ON_UnitSystem::MetersPerUnit(), // and add a new function that returns the correct answer. if (ON::LengthUnitSystem::CustomUnits == m_unit_system) { - // correct answer for custome units - V6 behavior. + // correct answer for custom units - V6 behavior. return m_meters_per_custom_unit; // } @@ -616,6 +616,22 @@ void ON_UnitSystem::Dump( ON_TextLog& dump ) const dump.Print("Unit system: %ls\n",static_cast(sUnitSystem)); } +bool ON_3dmUnitsAndTolerances::operator==(const ON_3dmUnitsAndTolerances& other) const +{ + bool equal = m_unit_system == other.m_unit_system + && m_absolute_tolerance == other.m_absolute_tolerance + && m_angle_tolerance == other.m_angle_tolerance + && m_relative_tolerance == other.m_relative_tolerance + && m_distance_display_mode == other.m_distance_display_mode + && m_distance_display_precision == other.m_distance_display_precision; + return equal; +} + +bool ON_3dmUnitsAndTolerances::operator!=(const ON_3dmUnitsAndTolerances& other) const +{ + return !(*this == other); +} + bool ON_3dmUnitsAndTolerances::Write( ON_BinaryArchive& file ) const { const int version = 102; @@ -3352,7 +3368,7 @@ void ON_3dmView::SetSectionBehavior(ON::ViewSectionBehavior behavior) ON_3dPoint ON_3dmView::TargetPoint() const { - // This function must return the valud saved on m_vp.m_target_point. + // This function must return the valid saved on m_vp.m_target_point. // Do not modify that value here. return m_vp.TargetPoint(); } @@ -3919,7 +3935,7 @@ bool ON_3dmView::Read( ON_BinaryArchive& file ) } } - // Add new inforamation here - ask Dale Lear for help. + // Add new information here - ask Dale Lear for help. break; } diff --git a/opennurbs_3dm_settings.h b/opennurbs_3dm_settings.h index c50300f7..9faf6ea5 100644 --- a/opennurbs_3dm_settings.h +++ b/opennurbs_3dm_settings.h @@ -29,6 +29,9 @@ public: ON_3dmUnitsAndTolerances(const ON_3dmUnitsAndTolerances&) = default; ON_3dmUnitsAndTolerances& operator=(const ON_3dmUnitsAndTolerances&) = default; + bool operator==(const ON_3dmUnitsAndTolerances& other) const; + bool operator!=(const ON_3dmUnitsAndTolerances& other) const; + bool Read( ON_BinaryArchive& ); bool Write( ON_BinaryArchive& ) const; @@ -926,7 +929,7 @@ public: ON_wString m_background_bitmap_filename; // If m_background_bitmap_filename is not empty, the file cannot be found, - // and m_embedded_file_id identifes an embedded image file in the model, + // and m_embedded_file_id identifies an embedded image file in the model, // then that file will be used as the background bitmap. ON_UUID m_embedded_image_file_id = ON_nil_uuid; @@ -1078,7 +1081,7 @@ public: /* Parameters: unset_location - [in] - Location to return if EarlocationIsSet() is false. + Location to return if EarthlocationIsSet() is false. Returns: A 3d point with coordinates (latitude, longitude, elevation). */ @@ -1129,7 +1132,7 @@ public: ); /* - System used to define latiude, longitude and elevation. + System used to define latitude, longitude and elevation. */ ON::EarthCoordinateSystem EarthCoordinateSystem() const; diff --git a/opennurbs_annotationbase.cpp b/opennurbs_annotationbase.cpp index cfcfbd27..15f03f4d 100644 --- a/opennurbs_annotationbase.cpp +++ b/opennurbs_annotationbase.cpp @@ -161,7 +161,7 @@ static bool Internal_UpdateOverrideCandidateParentId( && 0 == archive.InstanceDefinitionModelSerialNumber() ) { - return false; // common situation - no change reqired + return false; // common situation - no change required } @@ -171,7 +171,7 @@ static bool Internal_UpdateOverrideCandidateParentId( if (ON_nil_uuid == archive_parent_id) break; - // We are reading a worksession reference model or reference style linked instance defintion. + // We are reading a worksession reference model or reference style linked instance definition. // The ids in the reference file may have had a collision with ids in the active model // and been changed. const ON_ManifestMapItem parent_id_map_item = archive.ManifestMap().MapItemFromSourceId(archive_parent_id); @@ -191,7 +191,7 @@ static bool Internal_UpdateOverrideCandidateParentId( if (model_parent_id == archive_parent_id) return false; // common situation - no change reqired - // We are reading a worksession reference model or reference style linked instance defintion. + // We are reading a worksession reference model or reference style linked instance definition. // The ids in the reference file may have had a collision with ids in the active model // and been changed. override_candidate->SetParentId(model_parent_id); @@ -465,7 +465,7 @@ bool ON_Annotation::Internal_ReadAnnotation( // Dale Lear 2016 Dec 12 https://mcneel.myjetbrains.com/youtrack/issue/RH-37176 // content_version incremented to 2. - // optional override dimension style move from dimstyle table to annotaton object + // optional override dimension style move from dimstyle table to annotation object const bool bFromDimStyleTable = content_version <= 1; if (!archive.Internal_Read3dmDimStyleOverrides(*this, bFromDimStyleTable)) break; @@ -1033,7 +1033,7 @@ bool ON_Annotation::SetOverrideDimensionStyle(ON_DimStyle*& override_style) cons if (ON_nil_uuid == m_dimstyle_id) { - // ON_ERROR automaically fills in function name and new lines when needed. + // ON_ERROR automatically fills in function name and new lines when needed. //ON_ERROR("SetOverrideDimensionStyle(): this->m_dimstyle_id must be non-nil to override a dimstyle.\n"); ON_ERROR("this->m_dimstyle_id must be non-nil to override a dimstyle."); return false; @@ -3025,13 +3025,13 @@ const class ON_Font& ON_Annotation::Font(const ON_DimStyle* parent_style) const const class ON_Font& ON_Annotation::FontCharacteristics(const ON_DimStyle* parent_style) const { - // FontCharacteristics() queries inforation that is set by calling ON_DimStyle.SetFont() + // FontCharacteristics() queries information that is set by calling ON_DimStyle.SetFont() return Internal_StyleForFieldQuery(parent_style,ON_DimStyle::field::Font).FontCharacteristics(); } const bool ON_Annotation::FontSubstituted(const ON_DimStyle* parent_style) const { - // FontSubstituted() queries inforation that is set by calling ON_DimStyle.SetFont() + // FontSubstituted() queries information that is set by calling ON_DimStyle.SetFont() return Internal_StyleForFieldQuery(parent_style,ON_DimStyle::field::Font).FontSubstituted(); } diff --git a/opennurbs_annotationbase.h b/opennurbs_annotationbase.h index ac362bd7..09a47ef2 100644 --- a/opennurbs_annotationbase.h +++ b/opennurbs_annotationbase.h @@ -197,7 +197,7 @@ public: /* Returns: - Text information with rich text formatting insturctions removed. + Text information with rich text formatting instructions removed. Fields are not evaluated. */ const ON_wString PlainText() const; @@ -241,7 +241,7 @@ public: in cases where id collisions occur and ids need to be changed. Parameters: bKeepOverrides - [in] - If you are not an expert oding something low level and complicated, then + If you are not an expert coding something low level and complicated, then call SetDimensionStyleId(dimstyle_id) or pass bKeepOverrides = false. If bKeepOverrides is true and dimstyle_id is not nil and this object has @@ -332,7 +332,7 @@ public: style candidate to evaluate. bRequireSetOverrides - [in] If bRequireSetOverrides is true, then override_style_candidate->HasOverrides() must be true for a valid candidate. - If bRequireSetOverrides is flase, then override_style_candidate->HasOverrides() can have any value. + If bRequireSetOverrides is false, then override_style_candidate->HasOverrides() can have any value. Returns: True if override_style could be successfully used as the parameter to SetOverrideDimensionStyle. @@ -448,7 +448,7 @@ public: ptr - [in] pointer to test Returns: - True if ptr is not nullptr and points to the override style mangaged by this + True if ptr is not nullptr and points to the override style managed by this instance. */ bool IsOverrideStylePointer( @@ -502,7 +502,7 @@ private: Gets the appropriate ON_DimStyle to query for a property value. Parameters: parent_style - [in] - parent style pased to the ON_Annotation query function + parent style passed to the ON_Annotation query function field_id - [in] field being queried - this is used to select between using the override style or the parent style. */ @@ -1067,7 +1067,7 @@ public: void SetTextString(const wchar_t* string); /* Returns: - Dot's secondary text displayed when a user interface event like cliking or hovering occurs. + Dot's secondary text displayed when a user interface event like clicking or hovering occurs. Typically longer and more detailed than the primary text. Default = empty string. Remarks: diff --git a/opennurbs_apple_nsfont.cpp b/opennurbs_apple_nsfont.cpp index 8601c112..e17388a5 100644 --- a/opennurbs_apple_nsfont.cpp +++ b/opennurbs_apple_nsfont.cpp @@ -56,6 +56,7 @@ void ON_ManagedFonts::Internal_GetAppleInstalledCTFonts( if (nullptr == availableFontCollection ) return; CFArrayRef availableFontArray = CTFontCollectionCreateMatchingFontDescriptors(availableFontCollection); + CFRelease(availableFontCollection); if (nullptr == availableFontArray) return; const CFIndex count = CFArrayGetCount(availableFontArray); @@ -95,6 +96,7 @@ void ON_ManagedFonts::Internal_GetAppleInstalledCTFonts( platform_font->SetPointSize(0); platform_font_list.Append(platform_font); } + CFRelease(availableFontArray); } const ON_Font* ON_Font::GetManagedFontFromAppleCTFont( diff --git a/opennurbs_arc.h b/opennurbs_arc.h index 111ced15..998390c0 100644 --- a/opennurbs_arc.h +++ b/opennurbs_arc.h @@ -25,7 +25,7 @@ Details: The parameterization of the ON_Arc is inherited from the ON_Circle it is derived from. In particular t -> center + cos(t)*radius*xaxis + sin(t)*radius*yaxis - where xaxis and yaxis, (part of ON_Circle::m_plane) form an othonormal frame of the plane + where xaxis and yaxis, (part of ON_Circle::m_plane) form an orthonormal frame of the plane containing the circle. */ class ON_CLASS ON_Arc : public ON_Circle @@ -514,7 +514,7 @@ public: // Description: // Get a rational degree 2 NURBS curve representation // of the arc. Note that the parameterization of NURBS curve - // does not match arc's transcendental paramaterization. + // does not match arc's transcendental parameterization. // Use GetRadianFromNurbFormParameter() and // GetParameterFromRadian() to convert between the NURBS curve // parameter and the transcendental parameter diff --git a/opennurbs_arccurve.cpp b/opennurbs_arccurve.cpp index 8a1ae9f5..cfdd0e89 100644 --- a/opennurbs_arccurve.cpp +++ b/opennurbs_arccurve.cpp @@ -553,9 +553,9 @@ bool ON_ArcCurve::Evaluate( // returns false if unable to evaluate // This test turned out to be too crude. The bug RH-26341 // is one example. The issue is that the trig function with the - // largest derivative has more pecise sensitivity to changes in - // angle and in orger to get as precise an evaluation as possible, - // it is inportant to allow non-zero values of one trig function + // largest derivative has more precise sensitivity to changes in + // angle and in order to get as precise an evaluation as possible, + // it is important to allow non-zero values of one trig function // even when the other is being rounded to +1 or -1. // ////if ( fabs(c) < ON_EPSILON || fabs(s) > 1.0-ON_EPSILON ) @@ -913,7 +913,7 @@ bool ON_Arc::GetRadianFromNurbFormParameter(double NurbParameter, double* Radian { // TRR#53994. // 16-Sept-09 Replaced this code so we dont use LocalClosestPoint. - // In addition to being slower than neccessary the old method suffered from getting the + // In addition to being slower than necessary the old method suffered from getting the // wrong answer at the seam of a full circle, This probably only happened with large // coordinates where many digits of precision get lost. diff --git a/opennurbs_archivable_dictionary.cpp b/opennurbs_archivable_dictionary.cpp index c151a2d5..a6a319fc 100644 --- a/opennurbs_archivable_dictionary.cpp +++ b/opennurbs_archivable_dictionary.cpp @@ -167,7 +167,7 @@ public: unsigned int m_version = 0; ON_wString m_name = ON_wString::EmptyString; - // std::less is important to enable ON_wString-wchar_t* comparsion without an implicit copy. + // std::less is important to enable ON_wString-wchar_t* comparison without an implicit copy. std::map, std::less> m_map; template diff --git a/opennurbs_archive.cpp b/opennurbs_archive.cpp index 48e64023..c338b1c4 100644 --- a/opennurbs_archive.cpp +++ b/opennurbs_archive.cpp @@ -4266,9 +4266,13 @@ bool ON_BinaryArchive::ShouldSerializeUserDataItem( if (application_id == ON_nil_uuid) return false; - unsigned int i = m_user_data_filter.UnsignedCount(); - if (i <= 0) - return true; + if (m_user_data_filter.Count() <= 0) //ALB - Retaining the less-than from previous code although it seems spurious. + return true; //Empty filter, always serialize. See docs for m_user_data_filter + + //Validate the assumptions on the docs for m_user_data_filter. + ON_ASSERT(m_user_data_filter[0].m_application_id == ON_nil_uuid); + ON_ASSERT(m_user_data_filter[0].m_item_id == ON_nil_uuid); + ON_ASSERT(m_user_data_filter[0].m_precedence == 0); // {31F55AA3-71FB-49f5-A975-757584D937FF} static const ON_UUID ON_V4V5_MeshNgonUserData_ID = @@ -4284,7 +4288,6 @@ bool ON_BinaryArchive::ShouldSerializeUserDataItem( // only way to add information to core opennurbs data structure // and not break the public C++ SDK. - unsigned int opennurbs_userdata_application_version = ON_IsOpennurbsApplicationId(application_id); if (opennurbs_userdata_application_version >= 4) { @@ -4317,48 +4320,37 @@ bool ON_BinaryArchive::ShouldSerializeUserDataItem( } } - const ON_UserDataItemFilter *f = m_user_data_filter.Array(); + //See the previous version of this code. + const bool bReturnNilItemIdImmediately = (m_3dm_version > 0); - if (m_3dm_version > 0) + bool bSerialize = m_user_data_filter[0].m_bSerialize; + bool bFoundNilItemId = false; + + const int last = m_user_data_filter.Count() - 1; + + for (int i = last; i > 0; i--) //ALB: Backwards. The first element of the table is special and should not be considered. { - // After SortUserDataFilter(), m_user_data_filter items go from - // lowest precedence to highest precedence. - for (i--; i > 0; i--) + const ON_UserDataItemFilter& filter_item = m_user_data_filter[i]; + + if (application_id == filter_item.m_application_id) { - if (application_id == f[i].m_application_id) + const bool bNilId = item_id == ON_nil_uuid; + + if (item_id == filter_item.m_item_id || (bNilId && bReturnNilItemIdImmediately)) { - for (;;) - { - if (ON_nil_uuid == f[i].m_item_id || item_id == f[i].m_item_id) - return f[i].m_bSerialize; - if (0 == --i) - break; - if (!(application_id == f[i].m_application_id)) - break; - } + bSerialize = filter_item.m_bSerialize; + break; } - } - return f[0].m_bSerialize; - } - - // called before reading/writing has started and items are not sorted. - bool rc = f[0].m_bSerialize; - bool bFoundNilItemId = false; - for (i--; i > 0; i--) - { - if (application_id == f[i].m_application_id) - { - if (item_id == f[i].m_item_id) - return f[i].m_bSerialize; - if (false == bFoundNilItemId && ON_nil_uuid == f[i].m_item_id) + + if (bNilId && !bFoundNilItemId) { bFoundNilItemId = true; - rc = f[i].m_bSerialize; + bSerialize = filter_item.m_bSerialize; } } } - return rc; - + + return bSerialize; } bool ON_BinaryArchive::ShouldSerializeUserDataDefault() const diff --git a/opennurbs_array.h b/opennurbs_array.h index f62a3637..37725090 100644 --- a/opennurbs_array.h +++ b/opennurbs_array.h @@ -380,14 +380,6 @@ public: */ void SetArray(T*, int, int); - /* Support range based for loops */ - T* begin(); - T* end(); - T const* cbegin(); - T* cend(); - T const* begin() const; - T const* end() const; - protected: // implementation ////////////////////////////////////////////////////// void Move( int /* dest index*/, int /* src index */, int /* element count*/ ); @@ -741,14 +733,6 @@ public: */ void SetArray(T*, int, int); - /* Support range based for loops */ - T* begin(); - T* end(); - T const* cbegin(); - T* cend(); - T const* begin() const; - T const* end() const; - protected: // implementation ////////////////////////////////////////////////////// void Move( int /* dest index*/, int /* src index */, int /* element count*/ ); diff --git a/opennurbs_array_defs.h b/opennurbs_array_defs.h index 347985f0..96d8de92 100644 --- a/opennurbs_array_defs.h +++ b/opennurbs_array_defs.h @@ -442,44 +442,6 @@ const T* ON_SimpleArray::Last() const return (m_count > 0) ? m_a+(m_count-1) : 0; } -// range-based iteration support - -template -T* ON_SimpleArray::begin() -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T* ON_SimpleArray::end() -{ - return m_a ? m_a + m_count : nullptr; -} - -template -T const* ON_SimpleArray::cbegin() -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T* ON_SimpleArray::cend() -{ - return m_a ? m_a + m_count : nullptr; -} - -template -T const* ON_SimpleArray::begin() const -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T const* ON_SimpleArray::end() const -{ - return m_a ? m_a + m_count : nullptr; -} - // array operations //////////////////////////////////////////////////// template @@ -1681,45 +1643,6 @@ const T* ON_ClassArray::Last() const return (m_count > 0) ? m_a+(m_count-1) : 0; } -// range-based iteration support - -template -T* ON_ClassArray::begin() -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T* ON_ClassArray::end() -{ - return m_a ? m_a + m_count : nullptr; -} - -template -T const* ON_ClassArray::cbegin() -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T* ON_ClassArray::cend() -{ - return m_a ? m_a + m_count : nullptr; -} - -template -T const* ON_ClassArray::begin() const -{ - return m_a ? &m_a[0] : nullptr; -} - -template -T const* ON_ClassArray::end() const -{ - return m_a ? m_a + m_count : nullptr; -} - - // array operations //////////////////////////////////////////////////// template diff --git a/opennurbs_beam.cpp b/opennurbs_beam.cpp index d3dbb56b..723630ce 100644 --- a/opennurbs_beam.cpp +++ b/opennurbs_beam.cpp @@ -4763,90 +4763,6 @@ ON_Extrusion* ON_Extrusion::CreateFrom3dCurve( } -class ON_DisplayMesh -{ -private: - ON_DisplayMesh(); - ~ON_DisplayMesh(); - ON_DisplayMesh(const ON_DisplayMesh&); - ON_DisplayMesh& operator=(const ON_DisplayMesh&); - - /* - Description: - Use SetMesh(mesh) to set the fields in this class. - Parameters: - mesh - [in] - If mesh is null, the current settings are deleted. - Otherwise, mesh must be on the heap and this class - will manage it and delete it when appropriate. - Remarks: - The CRhExtrusionDisplayMesh class will delete the mesh - when it is no longer needed. - */ - void SetMesh( - ON_Mesh* mesh, - bool bManageMesh, - bool bEnableSinglePrecision - ); - - // You must use SetMesh() to set the value of m_mesh. - // Do not change the value of m_mesh directly. - // Do not save the value of m_mesh in an ordinary pointer - // The mesh is points to may be deleted. - const ON_Mesh* m_mesh; - - /* - Returns: - The serial number for this display mesh information - This number is unique for each display mesh setting - and is intended to be used to determine when cached - values, like those in a vertex object buffer (VBO), - need to be updated. - */ - unsigned int DisplayMeshSerialNumber() const; - - /* - Parameters: - model_view_xform - [in/out] - If model_view_xform is not null, its input value should be the - current "MODELVIEW" transform and its output value will be - the transformation to use with the returned vertices. - - mesh_V - [out] - If mesh_V is not null, then *mesh_V is set to an array of - m_mesh.m_V.Count() vertices to use for drawing the mesh. - - Returns: - 0: - no mesh exists - 1: - (*mesh_V) set to m_mesh.m_V[] - Tf model_view_xform is not null, it is not modified. - If mesh_V is not null, it is set to m_mesh->m_V.Array(). - 2: - (*mesh_V) set to m_display_F[]. - Tf model_view_xform is not null, it is multipied on the left - by m_display_F_xform. - If mesh_V is not null, it is set to m_display_F.Array(). - */ - int GetMeshDisplayVertices( ON_Xform* model_view_xform, ON_3fPoint const** mesh_V ) const; - -private: - // If m_bUse_display_F is true, then single - // precision display display code, like current - // OpenGL and Direct3D implementations, should - // display the mesh triangles by - // 1.) Changing the "MODELVIEW" transform to - // m_display_F_xform*current_model_xform; - // 2.) Draw the triangles using m_display_F in place of m_mesh->m_V[] - // 3.) Restore the "MODELVIEW" transform. - bool m_bUse_display_F; - ON_Xform m_display_F_xform; - ON_SimpleArray< ON_3fPoint > m_display_F; - unsigned int m_display_mesh_sn; -}; - - // OBSOLETE - USED TO READ/WRITE V5 files diff --git a/opennurbs_beam.h b/opennurbs_beam.h index c7a79226..299b6d8d 100644 --- a/opennurbs_beam.h +++ b/opennurbs_beam.h @@ -365,7 +365,7 @@ public: If mt is ON::default_mesh or ON::any_mesh, then the first non null mesh is returned. Returns: - A pointer to a mesh on the ON_Extusion object. + A pointer to a mesh on the ON_Extrusion object. This mesh will be deleted by ~ON_Extrusion(). If a mesh of the requested type is not available, then null is returned. @@ -491,7 +491,7 @@ public: /* Returns: 0: no caps - 1: exrusion has either a top cap or a bottom cap + 1: extrusion has either a top cap or a bottom cap 2: both ends are capped. See Also: ON_Extrusion::ProfileCount() @@ -613,7 +613,7 @@ public: If the extrusion already has a profile, the set will fail. Remarks: - If needed, innter_profile will be converted to a 2d + If needed, inner_profile will be converted to a 2d curve. If inner_profile is not correctly oriented, it will be reversed so it has a clockwise orientation. */ @@ -675,7 +675,7 @@ public: 0 <= profile_index < ProfileCount(). The outer profile has index 0. s - [in] ( 0.0 <= s <= 1.0 ) - A relative parameter controlling which priofile + A relative parameter controlling which profile is returned. s = 0.0 returns the bottom profile and s = 1.0 returns the top profile. Returns: @@ -874,7 +874,7 @@ public: /* Description: - Get an ON_Exrusion form of a cylinder. + Get an ON_Extrusion form of a cylinder. Parameters: cylinder - [in] cylinder.IsFinite() must be true bCapBottom - [in] if true, the end at cylinder.m_height[0] will be capped @@ -885,7 +885,7 @@ public: If the input pointer is not null, this extrusion will be used and the same pointer will be returned, provided the input is valid. Returns: - If the input is valid, a pointer to an ON_Exrusion form of the cylinder. + If the input is valid, a pointer to an ON_Extrusion form of the cylinder. If the input is not valid, then null, even when the input extrusion object is not null. Example: @@ -914,7 +914,7 @@ public: /* Description: - Get an ON_Exrusion form of a pipe. + Get an ON_Extrusion form of a pipe. Parameters: cylinder - [in] cylinder.IsFinite() must be true The cylinder can be either the inner or outer wall of the pipe. @@ -930,7 +930,7 @@ public: If the input pointer is not null, this extrusion will be used and the same pointer will be returned, provided the input is valid. Returns: - If the input is valid, a pointer to an ON_Exrusion form of the pipe. + If the input is valid, a pointer to an ON_Extrusion form of the pipe. If the input is not valid, then null, even when the input extrusion object is not null. Example: @@ -961,7 +961,7 @@ public: /* Description: - Create an ON_Exrusion from a 3d curve, a plane and a height. + Create an ON_Extrusion from a 3d curve, a plane and a height. Parameters: curve - [in] A continuous 3d curve. @@ -983,7 +983,7 @@ public: If the input pointer is not null, this extrusion will be used and the same pointer will be returned, provided the input is valid. Returns: - If the input is valid, a pointer to an ON_Exrusion form of the pipe. + If the input is valid, a pointer to an ON_Extrusion form of the pipe. If the input is not valid, then null, even when the input extrusion object is not null. */ diff --git a/opennurbs_bezier.cpp b/opennurbs_bezier.cpp index fedbcac3..26b21944 100644 --- a/opennurbs_bezier.cpp +++ b/opennurbs_bezier.cpp @@ -38,7 +38,7 @@ bool ON_BezierCurve::GetTightBoundingBox( { // The result from ON_GetPointListBoundingBox() is good enough - // for file IO needs in the public souce code version. + // for file IO needs in the public source code version. return ON_GetPointListBoundingBox( m_dim, m_is_rat, @@ -3487,7 +3487,7 @@ bool ON_BezierCurve::EvTangent( { if ( Ev2Der( t, point, D1, D2 ) ) { - // Use l'Hopital's rule to show that if the unit tanget + // Use l'Hopital's rule to show that if the unit tangent // exists, the 1rst derivative is zero, and the 2nd // derivative is nonzero, then the unit tangent is equal // to +/-the unitized 2nd derivative. The sign is equal diff --git a/opennurbs_bezier.h b/opennurbs_bezier.h index cc001db1..b21336c3 100644 --- a/opennurbs_bezier.h +++ b/opennurbs_bezier.h @@ -210,7 +210,7 @@ public: // true if successful // Remarks: // The result has order = points.Count() and the loft uses the - // uniform parameterizaton curve( i/(points.Count()-1) ) = points[i]. + // uniform parameterization curve( i/(points.Count()-1) ) = points[i]. bool Loft( const ON_3dPointArray& points ); @@ -228,7 +228,7 @@ public: // true if successful // Remarks: // The result has order = points.Count() and the loft uses the - // parameterizaton curve( t[i] ) = points[i]. + // parameterization curve( t[i] ) = points[i]. bool Loft( int pt_dim, int pt_count, @@ -581,7 +581,7 @@ public: Pointer to control vertex. Remarks: If the Bezier curve is rational, the format of the - returned array is a homogeneos rational point with + returned array is a homogeneous rational point with length m_dim+1. If the Bezier curve is not rational, the format of the returned array is a nonrational euclidean point with length m_dim. @@ -697,7 +697,7 @@ public: // cv_index - [in] control vertex index (0 <= cv_index < m_order) // point - [in] control vertex value. If the bezier // is not rational, the euclidean location of - // homogenoeous point will be used. + // homogeneous point will be used. // Returns: // true if successful. // See Also: diff --git a/opennurbs_bitmap.cpp b/opennurbs_bitmap.cpp index 7ddce145..33c91191 100644 --- a/opennurbs_bitmap.cpp +++ b/opennurbs_bitmap.cpp @@ -762,7 +762,7 @@ bool ON_WindowsBitmapEx::Internal_ReadV5( ON_BinaryArchive& file ) { // Calling ON_WindowsBitmap::ReadCompressed() destroys // m_bitmap_filename, so we have to read it into a local - // string and make the assigment after calling + // string and make the assignment after calling // ON_WindowsBitmap::ReadCompressed(). ON_wString bitmap_filename; if (rc) diff --git a/opennurbs_bitmap.h b/opennurbs_bitmap.h index d22765ec..40bcbacd 100644 --- a/opennurbs_bitmap.h +++ b/opennurbs_bitmap.h @@ -116,7 +116,7 @@ ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray; // Windows sizeof(ON_WindowsRGBQUAD) = 4. struct ON_WindowsRGBQUAD { // Mimics Windows RGBQUAD structure. - // For details searh for "RGBQUAD" at http://msdn.microsoft.com/default.asp + // For details search for "RGBQUAD" at http://msdn.microsoft.com/default.asp unsigned char rgbBlue; // BYTE unsigned char rgbGreen; // BYTE unsigned char rgbRed; // BYTE @@ -135,7 +135,7 @@ struct ON_WindowsBITMAPFILEHEADER { #pragma pack(pop) // Mimics Windows BITMAPINFOHEADER structure. -// For details searh for "BITMAPINFOHEADER" at http://msdn.microsoft.com/default.asp +// For details search for "BITMAPINFOHEADER" at http://msdn.microsoft.com/default.asp // Windows sizeof(BITMAPINFOHEADER) = 80. struct ON_WindowsBITMAPINFOHEADER { @@ -172,7 +172,7 @@ struct ON_WindowsBITMAPINFOHEADER // biColors[0] = red mask (0x00FF0000), // biColors[1] = green mask (0x0000FF00), and // biColors[2] = blue mask (0x000000FF), - // then tese masks are used with each 4-byte + // then these masks are used with each 4-byte // DWORD in the bitmap array to determine // the pixel's relative intensities. // // For other possibilities, see @@ -203,7 +203,7 @@ struct ON_WindowsBITMAPINFOHEADER struct ON_WindowsBITMAPINFO { // Mimics Windows BITMAPINFO structure. - // For details searh for "BITMAPINFO" at http://msdn.microsoft.com/default.asp + // For details search for "BITMAPINFO" at http://msdn.microsoft.com/default.asp ON_WindowsBITMAPINFOHEADER bmiHeader; ON_WindowsRGBQUAD bmiColors[1]; // The "[1]" is for the compiler. In // practice this array commonly has diff --git a/opennurbs_bounding_box.cpp b/opennurbs_bounding_box.cpp index 07738289..3364bab2 100644 --- a/opennurbs_bounding_box.cpp +++ b/opennurbs_bounding_box.cpp @@ -1566,7 +1566,7 @@ const double* p; all_out &= out; if ( some_out && !all_out ) { - // box intersects visble region but is not completely inside it. + // box intersects visible region but is not completely inside it. return 1; } bz = m_max.z; @@ -1652,14 +1652,14 @@ int ON_BoundingBox::GetClosestPoint( - // Step 1. Check for an intersection of the infinte line with the box + // Step 1. Check for an intersection of the infinite line with the box ON_Interval overlap(-ON_DBL_MAX, ON_DBL_MAX); bool nonempty=true; int i; for( i=0;i<3 && nonempty;i++) nonempty = overlap.Intersection(over[i]); - if(nonempty){ // infinte line intersects box + if(nonempty){ // infinite line intersects box if( overlap.Intersection( ON_Interval(0,1) ) ){ // Box & Line segment intersect if(t0) *t0 = overlap[0]; @@ -1889,14 +1889,14 @@ bool ON_BoundingBox::GetFarPoint( ON_DECL bool operator==(const ON_BoundingBox& lhs, const ON_BoundingBox& rhs) { - // returns false if any coordiate is a nan. + // returns false if any coordinate is a nan. return (lhs.m_min == rhs.m_min && lhs.m_max == rhs.m_max); } ON_DECL bool operator!=( const ON_BoundingBox& lhs, const ON_BoundingBox& rhs ) { - // returns false if any coordiate is a nan. + // returns false if any coordinate is a nan. if (lhs.m_min != rhs.m_min || lhs.m_max != rhs.m_max) { return (false == lhs.IsNan() && false == rhs.IsNan()); @@ -3106,7 +3106,7 @@ int ON_BoundingBox::IsDegenerate( double tolerance ) const ON_3dVector diag = Diagonal(); if ( tolerance < 0.0 ) { - // compute scale invarient tolerance + // compute scale invariant tolerance tolerance = diag.MaximumCoordinate()*ON_SQRT_EPSILON; } int rc = 0; diff --git a/opennurbs_bounding_box.h b/opennurbs_bounding_box.h index 09f83c4e..fcafa888 100644 --- a/opennurbs_bounding_box.h +++ b/opennurbs_bounding_box.h @@ -311,7 +311,7 @@ public: The minimum distance between a point on the plane and a point on the bounding box. See Also: - ON_PlaneEquation::MimimumValueAt + ON_PlaneEquation::MinimumValueAt ON_PlaneEquation::MaximumValueAt */ double MinimumDistanceTo( const ON_Plane& plane ) const; @@ -484,7 +484,7 @@ public: Parameters: other_bbox - [in] Returns: - True if this-intesect-other_bbox is a non-empty valid bounding box + True if this-intersect-other_bbox is a non-empty valid bounding box and this is set. False if the intersection is empty, in which case "this" is set to an invalid bounding box. Remarks: @@ -628,7 +628,7 @@ public: public: // This hash depends on the context and is a hash - // of the information used to calculte the bounding box. + // of the information used to calculate the bounding box. // It is not the hash of the box values void Set( diff --git a/opennurbs_box.cpp b/opennurbs_box.cpp index c7ea04da..b4643ab4 100644 --- a/opennurbs_box.cpp +++ b/opennurbs_box.cpp @@ -62,7 +62,7 @@ int ON_Box::IsDegenerate( double tolerance ) const const ON_3dVector diag(dx.Length(),dy.Length(),dz.Length()); if ( !ON_IsValid(tolerance) || tolerance < 0.0 ) { - // compute scale invarient tolerance + // compute scale invariant tolerance tolerance = diag.MaximumCoordinate()*ON_SQRT_EPSILON; } if ( diag.x <= tolerance ) diff --git a/opennurbs_brep.cpp b/opennurbs_brep.cpp index 5d6b6010..9b97c1c6 100644 --- a/opennurbs_brep.cpp +++ b/opennurbs_brep.cpp @@ -11961,47 +11961,127 @@ static bool AdjustCurve(ON_Curve& crv, } static void AdjustEdgeEnds(ON_BrepEdge& edge) - { ON_Brep* pB = edge.Brep(); if (!pB) + { return; + } + ON_Curve* c3 = const_cast(edge.EdgeCurveOf()); - if( c3 ) + if(c3) { ON_3dPoint A0 = c3->PointAtStart(); ON_3dPoint P0 = A0; - if (edge.m_vi[0] >= 0){ + + if (edge.m_vi[0] >= 0) + { ON_BrepVertex& V = pB->m_V[edge.m_vi[0]]; if (V.IsValid()) + { P0 = V.Point(); + } } ON_3dPoint A1 = c3->PointAtEnd(); ON_3dPoint P1 = A1; - if (edge.m_vi[1] >= 0){ + + if (edge.m_vi[1] >= 0) + { ON_BrepVertex& V = pB->m_V[edge.m_vi[1]]; if (V.IsValid()) + { P1 = V.Point(); + } } bool bQuit = true; - if (P0 != A0 && edge.m_vi[0] >= 0){ + if (P0 != A0 && edge.m_vi[0] >= 0) + { ON_BrepVertex& V = pB->m_V[edge.m_vi[0]]; V.m_tolerance = ON_UNSET_VALUE; bQuit = false; } - if (P1 != A1 && edge.m_vi[1] >= 0){ + + if (P1 != A1 && edge.m_vi[1] >= 0) + { ON_BrepVertex& V = pB->m_V[edge.m_vi[1]]; V.m_tolerance = ON_UNSET_VALUE; bQuit = false; } + if (bQuit) + { return; + } + + std::shared_ptr pDup; + if (const ON_ArcCurve* pArcCurve = ON_ArcCurve::Cast(c3)) + { + pDup = std::make_shared(*pArcCurve); + } if (AdjustCurve(*c3, P0, P1)) + { edge.m_tolerance = ON_UNSET_VALUE; + + //https://mcneel.myjetbrains.com/youtrack/issue/RH-81878 + //Moving the start/ends of arcs can create some funky edges. + if (pDup) + { + ON_Interval domain = pDup->Domain(); + + //So check the center third of the arc since that shouldn't really change + //to see if we still have a decent match to the old edge curve + ON_Interval checkDomain; + checkDomain[0] = domain.ParameterAt(1.0 / 3.0); + checkDomain[1] = domain.ParameterAt(2.0 / 3.0); + + const int iChecks = 9; + + bool bGoodAdjust = true; + for (int i = 0; i < iChecks; i++) + { + double dNormalizedT = (double)i / (double)iChecks; + double dT = checkDomain.ParameterAt(dNormalizedT); + + const ON_3dPoint ptOriginal = pDup->PointAt(dT); + const ON_3dPoint ptNew = c3->PointAt(dT); + + const double dDistance = ptOriginal.DistanceTo(ptNew); + + //This is still a pretty tight tolerance + //But this function is tolerance free and we don't have access to edge tolerance calculations in OpenNurbs + if (dDistance > ON_SQRT_EPSILON) + { + bGoodAdjust = false; + break; + } + } + + //If the adjustment was bad + //Replace the edge with the NURBS form of the arc if it can be adjusted correctly + if (!bGoodAdjust) + { + ON_NurbsCurve* pNC = pDup->NurbsCurve(); + if (pNC) + { + if (AdjustCurve(*pNC, P0, P1)) + { + int c3Idx = pB->AddEdgeCurve(pNC); + + edge.m_c3i = c3Idx; + edge.SetProxyCurve(pNC); + } + else + { + delete pNC; + pNC = nullptr; + } + } + } + } + } } - return; } bool ON_Brep::StandardizeEdgeCurve( int edge_index, bool bAdjustEnds ) diff --git a/opennurbs_circle.h b/opennurbs_circle.h index bfd59236..23c1589e 100644 --- a/opennurbs_circle.h +++ b/opennurbs_circle.h @@ -244,7 +244,7 @@ public: // 2 for success, 0 for failure // Remarks: // Note that the parameterization of NURBS curve - // does not match circle's transcendental paramaterization. + // does not match circle's transcendental parameterization. // Use ON_Circle::GetRadianFromNurbFormParameter() and // ON_Circle::GetParameterFromRadian() to convert between // the NURBS curve parameter and the transcendental parameter. diff --git a/opennurbs_color.cpp b/opennurbs_color.cpp index 3b5107a0..eb9630b4 100644 --- a/opennurbs_color.cpp +++ b/opennurbs_color.cpp @@ -62,7 +62,7 @@ const ON_Color ON_Color::RandomColor( ) { ON_RandomNumberGenerator rg; - rg.Seed(seed + 1U); // the +1 is so the colors for seeds (0,1,2,3,4,5 are more vistually distinct) + rg.Seed(seed + 1U); // the +1 is so the colors for seeds (0,1,2,3,4,5 are more visually distinct) const double h = hue_range.IsSingleton() ? hue_range.m_t[0] : rg.RandomDouble(hue_range); double s = saturation_range.IsSingleton() ? saturation_range.m_t[0] : rg.RandomDouble(saturation_range); if (s > ON_UNSET_VALUE && s < ON_UNSET_POSITIVE_VALUE) @@ -306,7 +306,7 @@ double ON_Color::Value() const void ON_Color::SetHSV( double hue, // hue in radians - double saturation, // satuation 0.0 = gray, 1.0 = saturated + double saturation, // saturation 0.0 = gray, 1.0 = saturated double value // value ) { diff --git a/opennurbs_color.h b/opennurbs_color.h index 13a4de9b..3b24f1a9 100644 --- a/opennurbs_color.h +++ b/opennurbs_color.h @@ -28,14 +28,14 @@ public: static const ON_Color UnsetColor; // 0xFFFFFFFFu static const ON_Color Black; // 0x00000000u - static const ON_Color White; // 0x00FFFFFFu on little endan, 0xFFFFFF00u on big endian - static const ON_Color SaturatedRed; // 0x000000FFu on little endan, 0xFF000000u on big endian - static const ON_Color SaturatedGreen; // 0x0000FF00u on little endan, 0x00FF0000u on big endian - static const ON_Color SaturatedBlue; // 0x00FF0000u on little endan, 0x0000FF00u on big endian - static const ON_Color SaturatedYellow; // 0x0000FFFFu on little endan, 0xFFFF0000u on big endian - static const ON_Color SaturatedCyan; // 0x00FFFF00u on little endan, 0x00FFFF00u on big endian - static const ON_Color SaturatedMagenta; // 0x00FF00FFu on little endan, 0xFF00FF00u on big endian - static const ON_Color SaturatedGold; // 0x0000BFFFu on little endan, 0xFFBF0000u on big endian + static const ON_Color White; // 0x00FFFFFFu on little endian, 0xFFFFFF00u on big endian + static const ON_Color SaturatedRed; // 0x000000FFu on little endian, 0xFF000000u on big endian + static const ON_Color SaturatedGreen; // 0x0000FF00u on little endian, 0x00FF0000u on big endian + static const ON_Color SaturatedBlue; // 0x00FF0000u on little endian, 0x0000FF00u on big endian + static const ON_Color SaturatedYellow; // 0x0000FFFFu on little endian, 0xFFFF0000u on big endian + static const ON_Color SaturatedCyan; // 0x00FFFF00u on little endian, 0x00FFFF00u on big endian + static const ON_Color SaturatedMagenta; // 0x00FF00FFu on little endian, 0xFF00FF00u on big endian + static const ON_Color SaturatedGold; // 0x0000BFFFu on little endian, 0xFFBF0000u on big endian static const ON_Color Gray105; // R = G = B = 105 (medium dark) static const ON_Color Gray126; // R = G = B = 128 (medium) static const ON_Color Gray160; // R = G = B = 160 (medium light) @@ -138,7 +138,7 @@ public: ); // If you need to use shifting to convert RGBA components to and from - // an unsigned int ON_COlor value and you want your code to work + // an unsigned int ON_Color value and you want your code to work // on both little and big endian computers, use the RGBA_shift enum. // // unsigned int u = 0; @@ -367,7 +367,7 @@ public: Parameters: format - [in] separator - [in] - Separarates the values. + Separates the values. 0 to use UNICODE comma. (Ignored when the format is HashRGB*.) character to separate numbers (unicode code point - UTF-16 surrogate pairs not supported) @@ -420,14 +420,14 @@ private: // On little endian computers, m_color = 0xaabbggrr as an unsigned int value. // On big endian computers, m_color = 0xrrggbbaa as an unsigned int value // rr = red component 0-255 - // gg = grean component 0-255 + // gg = green component 0-255 // bb = blue component 0-255 // aa = alpha 0-255. 0 means opaque, 255 means transparent. unsigned int m_color = 0; // m_colorComponent is a 4 unsigned byte array in RGBA order // red component = m_RGBA[ON_Color::RGBA_byte::kRed] - // grean component = m_RGBA[ON_Color::RGBA_byte::kGreen] + // green component = m_RGBA[ON_Color::RGBA_byte::kGreen] // blue component = m_RGBA[ON_Color::RGBA_byte::kBlue] // alpha component = m_RGBA[ON_Color::RGBA_byte::kAlpha] unsigned char m_RGBA[4]; diff --git a/opennurbs_convex_poly.cpp b/opennurbs_convex_poly.cpp index 27868088..6ceae7e5 100644 --- a/opennurbs_convex_poly.cpp +++ b/opennurbs_convex_poly.cpp @@ -1035,7 +1035,7 @@ bool ON_ConvexPoly::GetClosestPointSeeded(const ON_ConvexPoly& B, if (!bFirstPass) GJK.AddVertex(W, wA, wB); - // The key to the implemetation of this algorithm is contained in Simplex::GetClosestPointToOrigin() + // The key to the implementation of this algorithm is contained in Simplex::GetClosestPointToOrigin() if (GJK.Simp.GetClosestPointToOrigin(GJK.Bary)) { bFirstPass = false; @@ -1052,7 +1052,7 @@ bool ON_ConvexPoly::GetClosestPointSeeded(const ON_ConvexPoly& B, } else { - /* this is error recovery code. it is currenly DISABLED + /* this is error recovery code. it is currently DISABLED // The last step resulted in crap lets undo it and set done int n = GJK.Simp.Count() - 1; GJK.RemoveVertex(n); @@ -1065,7 +1065,7 @@ bool ON_ConvexPoly::GetClosestPointSeeded(const ON_ConvexPoly& B, } else { - // In this case I am going to terminte the iteration. If this was a FirstPass with user supplied initial guess + // In this case I am going to terminate the iteration. If this was a FirstPass with user supplied initial guess // then we restart the algorithm without the initial guess. break; } diff --git a/opennurbs_convex_poly.h b/opennurbs_convex_poly.h index a26d1e21..b361d195 100644 --- a/opennurbs_convex_poly.h +++ b/opennurbs_convex_poly.h @@ -225,7 +225,7 @@ public: /* Description: - Points in a Convex Polytope are parameterized , not necessaily uniquely, + Points in a Convex Polytope are parameterized , not necessarily uniquely, by an ON_4dex of vertex indices and a 4d barycentric point B Evaluate(Ind, B ) = Sum_{i=0,..,3} Vertex(Ind[i])*B[i], where the sum is taken over i such that Ind[i]>=0 If B is a barycentric coordinate @@ -252,7 +252,7 @@ Description: Parameters: P0 - [in] Base Point for closest point dex -[out] - bary - [out] Evaluate(dex,bary) is the closest point on this polyhedran + bary - [out] Evaluate(dex,bary) is the closest point on this polyhedron maximum_distance - [in ] optional upper bound on distance Returns: @@ -311,7 +311,7 @@ Details: A point represented by a ON_4dex D and a barycentric coordinate B can be put in a standard form so that non-negative elements of D are unique and corresponding coordinates are positive. Furthermore, the non-negative - indices are all listed before the unset ( neagative ) values + indices are all listed before the unset ( negative ) values */ static bool Standardize(ON_4dex& D, ON_4dPoint& B); diff --git a/opennurbs_crc.cpp b/opennurbs_crc.cpp index 95410ee4..d185d3dd 100644 --- a/opennurbs_crc.cpp +++ b/opennurbs_crc.cpp @@ -74,7 +74,7 @@ ON__UINT16 ON_CRC16( ON__UINT16 current_remainder, size_t count, const void* p ) // update crc remainder // Dale Lear September 2020 - // I was comparing 16-bit crc, 32-bit crc, MAD5 and SHA-1 hash calcualation speeds. + // I was comparing 16-bit crc, 32-bit crc, MAD5 and SHA-1 hash calculation speeds. // It turns out, that compilers and optimizers have improved a fair bit since 1994 when this code was written. // Manual loop unrolling doesn't help (this used to make a measurable difference in 1994 when we used Watcom C on Win 3.1.) // The TestHashSpeed command tests hashing speeds. Short story - use either ON_CRC32 or ON_SHA1. @@ -273,7 +273,7 @@ ON__UINT32 ON_CRC32( ON__UINT32 current_remainder, size_t count, const void* p ) /* Description: - Test speeds of various hash algoritmhs. + Test speeds of various hash algorithms. Parameters: byte_count - [in] Number of bytes to hash. This number is rounded up to the nearest multiple of 1024. diff --git a/opennurbs_curve.cpp b/opennurbs_curve.cpp index e8f3a136..bdfd14df 100644 --- a/opennurbs_curve.cpp +++ b/opennurbs_curve.cpp @@ -593,7 +593,7 @@ bool ON_Curve::IsClosed() const // as the one used in ON_PolyCurve::HasGap(). // June 2019 - sometime in the past decade ON_PolyCurve::HasGap() // changed and the test there is different from this test. - // The initial "Note" no longer applies becaue it's no longer + // The initial "Note" no longer applies because it's no longer // clear why the current ON_PolyCurve::HasGap() was changed. if ( ON_PointsAreCoincident( dim, false, a, p ) ) { @@ -684,7 +684,7 @@ bool ON_Curve::GetNextDiscontinuity( { // 20 March 2003 Dale Lear: // Have to look for locus discontinuities at ends. - // Must test both ends becuase t0 > t1 is valid input. + // Must test both ends because t0 > t1 is valid input. // In particular, for ON_CurveProxy::GetNextDiscontinuity() // to work correctly on reversed "real" curves, the // t0 > t1 must work right. @@ -1024,7 +1024,7 @@ bool ON_Curve::EvTangent( { if ( Ev2Der( t, point, D1, D2, side, hint ) ) { - // Use l'Hopital's rule to show that if the unit tanget + // Use l'Hopital's rule to show that if the unit tangent // exists, the 1rst derivative is zero, and the 2nd // derivative is nonzero, then the unit tangent is equal // to +/-the unitized 2nd derivative. The sign is equal @@ -1525,7 +1525,7 @@ bool ON_MatchCurveEnds( ON_Curve* curve0, fixPoint[0] = ON_3dPoint::UnsetPoint; fixPoint[1] = ON_3dPoint::UnsetPoint; - // hurestic for deciding which point gets moved + // heuristic for deciding which point gets moved int i; for ( i = 0; i <= 1; i++ ) { @@ -1918,7 +1918,7 @@ bool ON_NurbsCurve::RepairBadKnots( double knot_tolerance, bool bRepair ) { // 15-June-2020 // Remove degenerate and small spans at the end, with out changing the domain - // and trying to maintain parametric curve ( i.e, C: Domain->R^d is invarient). + // and trying to maintain parametric curve ( i.e, C: Domain->R^d is invariant). DestroyRuntimeCache(); if (knot_tolerance > 0) @@ -1953,7 +1953,7 @@ bool ON_NurbsCurve::RepairBadKnots( double knot_tolerance, bool bRepair ) { // 15-June-2020 // Remove degenerate and small spans at the end, with out changing the domain - // and trying to maintain parametric curve ( i.e, C: Domain->R^d is invarient). + // and trying to maintain parametric curve ( i.e, C: Domain->R^d is invariant). DestroyRuntimeCache(); if (knot_tolerance > 0) { @@ -1992,7 +1992,7 @@ bool ON_NurbsCurve::RepairBadKnots( double knot_tolerance, bool bRepair ) if ( m_knot[m_order-1]-m_knot[m_order-2] > knot_tolerance && m_knot[m_cv_count-1]-m_knot[m_cv_count-2] > knot_tolerance ) { - // Remove interior knots with mulitiplicity >= m_order + // Remove interior knots with multiplicity >= m_order for ( i = m_cv_count-m_order-1; i >= m_order; i-- ) { if ( m_knot[i+m_order-1] - m_knot[i] <= knot_tolerance ) @@ -2639,7 +2639,7 @@ static int CompareJoinEnds(void* ctext, const void* aA, const void* bB) //This next bunch of code is to allow V5 style curve joining. // The special case line/polyline code has been removed, // as has the code to pick the most tangent result when -// multiple possibilites are present +// multiple possibilities are present /////////////////////////////////////////////// struct OldCurveJoinSeg { @@ -2763,7 +2763,7 @@ ON_JoinCurvesOld(const ON_SimpleArray& InCurves, } } - //sort possiblities by distance + //sort possibilities by distance EData.QuickSort(OldCompareEndData); int* endspace = (int*)onmalloc(2*sizeof(int)*IC.Count()); @@ -3425,7 +3425,7 @@ static void SortCurveEndData(int count, ON_SimpleArray& EData, ON_SimpleArray& Singles) { - //sort possiblities by distance + //sort possibilities by distance JoinEndCompareContext context; context.bUseTan = bUseTanAngle; context.dot_tol = dot_tol; diff --git a/opennurbs_curve.h b/opennurbs_curve.h index 7f75c253..0eb06f17 100644 --- a/opennurbs_curve.h +++ b/opennurbs_curve.h @@ -461,7 +461,7 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: c - [in] type of continity to test for. @@ -950,7 +950,7 @@ public: tolerance -[in] distance tolerance to use when checking linearity. Returns - true if the span is a non-degenrate line. This means: + true if the span is a non-degenerate line. This means: - dimension = 2 or 3 - The length of the the line segment from the span's initial point to the span's control point is >= min_length. @@ -1064,7 +1064,7 @@ public: the NURBS curve parameterization may not match to the desired accuracy. This situation happens when getting NURBS representations of - curves that have a transendental parameterization + curves that have a transcendental parameterization like circles Remarks: This is a low-level virtual function. If you do not need @@ -1095,7 +1095,7 @@ public: the NURBS curve parameterization may not match. This situation happens when getting NURBS representations of - curves that have a transendental parameterization + curves that have a transcendental parameterization like circles Remarks: This is a low-level virtual function. @@ -1289,7 +1289,7 @@ Parameters: [out] with one endpoint possibly changed. end1 - [in] if 0, change start of Crv1. Otherwise change end. Returns: - true if the endpoints match. Falsse otherwise, + true if the endpoints match. False otherwise, */ ON_DECL bool ON_ForceMatchCurveEnds( @@ -1370,7 +1370,7 @@ int ON_JoinCurves(const ON_SimpleArray& InCurves, /* Description: Join all contiguous curves of an array of ON_Curves using an older sort algorithm. -Unless this loder version is necessary, use ON_JoinCurves instead. +Unless this older version is necessary, use ON_JoinCurves instead. Parameters: InCurves - [in] Array of curves to be joined (not modified) OutCurves - [out] Resulting joined curves and copies of curves that were not joined to anything diff --git a/opennurbs_curveonsurface.h b/opennurbs_curveonsurface.h index 7e868f83..f9d17128 100644 --- a/opennurbs_curveonsurface.h +++ b/opennurbs_curveonsurface.h @@ -152,7 +152,7 @@ public: void ) const override; - bool Reverse() override; // reverse parameterizatrion + bool Reverse() override; // reverse parameterization // Domain changes from [a,b] to [-b,-a] bool Evaluate( // returns false if unable to evaluate @@ -171,7 +171,7 @@ public: int GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the curve's to wthe desired accuracy + // matches the curve's to the desired accuracy // 2: success - returned NURBS point locus matches // the curve's to the desired accuracy but, on // the interior of the curve's domain, the diff --git a/opennurbs_curveproxy.h b/opennurbs_curveproxy.h index 0034f6fc..7f96c2c5 100644 --- a/opennurbs_curveproxy.h +++ b/opennurbs_curveproxy.h @@ -302,9 +302,9 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature discontinuity. + Search for a derivative, tangent, or curvature discontinuity. Parameters: - c - [in] type of continity to test for. If ON::continuity::C1_continuous + c - [in] type of continuity to test for. If ON::continuity::C1_continuous t0 - [in] search begins at t0 t1 - [in] (t0 < t1) search ends at t1 t - [out] if a discontinuity is found, the *t reports the @@ -391,7 +391,7 @@ public: double curvature_tolerance=ON_SQRT_EPSILON ) const override; - bool Reverse() override; // reverse parameterizatrion + bool Reverse() override; // reverse parameterization // Domain changes from [a,b] to [-b,-a] bool Evaluate( // returns false if unable to evaluate diff --git a/opennurbs_cylinder.h b/opennurbs_cylinder.h index 670d1bd7..db63d00e 100644 --- a/opennurbs_cylinder.h +++ b/opennurbs_cylinder.h @@ -115,7 +115,7 @@ public: const ON_3dVector& ); - // parameterization of NURBS surface does not match cylinder's transcendental paramaterization + // parameterization of NURBS surface does not match cylinder's transcendental parameterization int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success /* diff --git a/opennurbs_date.cpp b/opennurbs_date.cpp index 766ec4bd..44a76730 100644 --- a/opennurbs_date.cpp +++ b/opennurbs_date.cpp @@ -32,12 +32,12 @@ bool ON_IsGregorianLeapYear( // the Gregorian calendar was introduced 24, February 1582, in // the Papal States, Spain, Portugal, the Polish-Lithuanian // Commonwealth, and most of Italy. However the Julian leap - // day was omitted for the first 10 occurances to correct + // day was omitted for the first 10 occurrences to correct // for the "vernal equinox drift" the Julian calendar had // introduced from AD 325 to 1582. The goal was to have // March 21 be the date of the vernal equinox. - // As a result, the first Gregorian calendary leap day - // leap day in the Gregorian calendar occured on Feb 29, 1624. + // As a result, the first Gregorian calendar leap day + // leap day in the Gregorian calendar occurred on Feb 29, 1624. return ( year >= 1624 && 0 == (year %4) && (0 == (year%400) || 0 != (year%100)) ); } diff --git a/opennurbs_decals.cpp b/opennurbs_decals.cpp index 327e2783..4ad1dbd2 100644 --- a/opennurbs_decals.cpp +++ b/opennurbs_decals.cpp @@ -810,7 +810,7 @@ bool ON_Decal::GetTextureMapping(ON_TextureMapping& mappingOut) const This object encapsulates the reading of all decal properties from XML nodes. It is used by the decal CRC calculation in ComputeDecalCRC(). - TODO: It could also be used by the ON_Decal XML node acccess. + TODO: It could also be used by the ON_Decal XML node access. */ class ON_DecalNodeReader diff --git a/opennurbs_dimension.cpp b/opennurbs_dimension.cpp index 83dc1173..fea4d83a 100644 --- a/opennurbs_dimension.cpp +++ b/opennurbs_dimension.cpp @@ -994,22 +994,6 @@ bool ON_DimLinear::GetBBox(double* bmin, double* bmax, bool grow) const } -class StylePointer -{ -public: - ~StylePointer() - { - if (m_delete_style && nullptr != m_style) - { - delete m_style; - m_style = nullptr; - m_delete_style = false; - } - } - const ON_DimStyle* m_style = nullptr; - bool m_delete_style = false; -}; - bool ON_DimLinear::GetAnnotationBoundingBox( const ON_Viewport* vp, const ON_DimStyle* dimstyle, diff --git a/opennurbs_dimensionstyle.cpp b/opennurbs_dimensionstyle.cpp index 3bae7ad9..f1e25d35 100644 --- a/opennurbs_dimensionstyle.cpp +++ b/opennurbs_dimensionstyle.cpp @@ -3806,7 +3806,7 @@ double ON_DimStyle::TextAdvanceOfCodePoint(unsigned unicode_code_point) const double ON_DimStyle::TextWidthOfEmSpace() const { - // This is the fundemental WidthOfXSpace() function. + // This is the fundamental WidthOfXSpace() function. // Other WidthOfXSpace() functions call TextWidthOfEmSpace() when TextAdvanceOfCodePoint(obvious code point) fails. // This function may only call TextAdvanceOfCodePoint() and TextHeight(). double w = TextAdvanceOfCodePoint(ON_UnicodeCodePoint::ON_EmSpace); @@ -4688,9 +4688,9 @@ ON::LengthUnitSystem ON_DimStyle::UnitSystem() const /// text created in page space will be 3.5 millimeters high. /// /// Ideally, ON_DimStyle::UnitSystem() would specify the text height units - /// and ON_DimStyle::DimScale() cound be adjusted as model space extents require. + /// and ON_DimStyle::DimScale() could be adjusted as model space extents require. /// Text in instance definitions would have a well defined height and references - /// to those instance defintions would display predictably in both model space and page space. + /// to those instance definitions would display predictably in both model space and page space. // It is critical that this function never return Unset or CustomUnits. // returning None insures unknown scal values are 1 instead of ON_DBL_QNAN @@ -4712,14 +4712,14 @@ void ON_DimStyle::SetUnitSystem(ON::LengthUnitSystem us) /// /// From a user's perspective, in Rhino 6 and Rhino 7 ON_DimStyle lengths like TextHeight(), ArrowSize(), ... /// are with respect to the context the annotation resides in. For example, if TextHeight() = 3.5, - /// model units = meters, page units = millimters, and DimScale() = 1, then + /// model units = meters, page units = millimeters, and DimScale() = 1, then /// text created in model space will be 3.5 meters high and /// text created in page space will be 3.5 millimeters high. /// /// Ideally, ON_DimStyle::UnitSystem() would specify the text height units - /// and ON_DimStyle::DimScale() cound be adjusted as model space extents require. + /// and ON_DimStyle::DimScale() could be adjusted as model space extents require. /// Text in instance definitions would have a well defined height and references - /// to those instance defintions would display predictably in both model space and page space. + /// to those instance definitions would display predictably in both model space and page space. if (ON::LengthUnitSystem::CustomUnits == us || ON::LengthUnitSystem::Unset == us) { ON_ERROR("Annotation styles cannot have unset or custom length units."); @@ -4751,14 +4751,14 @@ void ON_DimStyle::SetUnitSystemFromContext( /// /// From a user's perspective, in Rhino 6 and Rhino 7 ON_DimStyle lengths like TextHeight(), ArrowSize(), ... /// are with respect to the context the annotation resides in. For example, if TextHeight() = 3.5, - /// model units = meters, page units = millimters, and DimScale() = 1, then + /// model units = meters, page units = millimeters, and DimScale() = 1, then /// text created in model space will be 3.5 meters high and /// text created in page space will be 3.5 millimeters high. /// /// Ideally, ON_DimStyle::UnitSystem() would specify the text height units - /// and ON_DimStyle::DimScale() cound be adjusted as model space extents require. + /// and ON_DimStyle::DimScale() could be adjusted as model space extents require. /// Text in instance definitions would have a well defined height and references - /// to those instance defintions would display predictably in both model space and page space. + /// to those instance definitions would display predictably in both model space and page space. ON::LengthUnitSystem dim_style_units = ON::LengthUnitSystemFromUnsigned(static_cast(UnitSystem())); @@ -5204,7 +5204,7 @@ ON__UINT32* ON_DimStyle::Internal_GetOverrideParentBit(ON_DimStyle::field field_ // because these cannot be inherited from parent. // false is returned instead of the more accurate true // because that's the way this code has worked for years - // and being accuruate would cause bugs at this point. + // and being accurate would cause bugs at this point. return nullptr; } @@ -5734,7 +5734,7 @@ void ON_DimStyle::OverrideFields(const ON_DimStyle& source, const ON_DimStyle& p break; case ON_DimStyle::field::TextMask: // SPECIAL CASE - // The TextMask values are all modifed individually by the cases for + // The TextMask values are all modified individually by the cases for // ON_DimStyle::field::DrawMask: // ON_DimStyle::field::MaskColorSource: // ON_DimStyle::field::MaskColor: diff --git a/opennurbs_dimensionstyle.h b/opennurbs_dimensionstyle.h index 6fa7f53e..01eb69f5 100644 --- a/opennurbs_dimensionstyle.h +++ b/opennurbs_dimensionstyle.h @@ -136,7 +136,7 @@ public: public: /* - The default constructor content is idenical to ON_TextMask::None. + The default constructor content is identical to ON_TextMask::None. */ ON_TextMask() = default; ~ON_TextMask() = default; @@ -874,12 +874,12 @@ public: //OBSOLETE_AlternateDimensionUnitSystem_ = 108, /// - /// Dimension length display. See ON_DimStyle::DimensionLengthDisplay() for a descpription of this parameter. + /// Dimension length display. See ON_DimStyle::DimensionLengthDisplay() for a description of this parameter. /// DimensionLengthDisplay = 109, /// - /// Alternate dimension length display. See ON_DimStyle::AlternateDimensionLengthDisplay() for a descpription of this parameter. + /// Alternate dimension length display. See ON_DimStyle::AlternateDimensionLengthDisplay() for a description of this parameter. /// AlternateDimensionLengthDisplay = 110, @@ -1437,7 +1437,7 @@ public: Parameters: unicode_code_point - [in] Returns: - The advande for a single code point glyph in the same units as TextHeight() using the current settings + The advance for a single code point glyph in the same units as TextHeight() using the current settings for TextHeight() and Font(). Remarks: When sequences of code points are rendered, using the per glyph advance does not @@ -2044,7 +2044,7 @@ public: /// text created in page space will be 3.5 millimeters high. /// /// Ideally, ON_DimStyle::UnitSystem() would specify the text height units - /// and ON_DimStyle::DimScale() cound be adjusted as model space extents require. + /// and ON_DimStyle::DimScale() could be adjusted as model space extents require. /// Text in instance definitions would have a well defined height and references /// to those instance definitions would display predictably in both model space and page space. /// @@ -2221,15 +2221,15 @@ private: /// For example, if m_lengthresolution is 2, then dimension length display will be n.ff /// If m_lengthresolution=7, then dimension length display will be n.fffffff. /// - /// FRACTONAL LENGTH DISPLAY: + /// FRACTIONAL LENGTH DISPLAY: /// If m_dimension_length_display is ON_DimStyle::LengthDisplay::InchesFractional or /// ON_DimStyle::LengthDisplay::FeetAndInches, then fractional length display is used. - /// In this case any fractional part will be rouded to the closest multiple + /// In this case any fractional part will be rounded to the closest multiple /// of 1/(2^m_alternate_lengthresolution). /// Examples: If fractional length display is used and m_lengthresolution=2, // then the possible fractions are 1/4, 1/2(=2/4), 3/4. /// If fractional length display is used and m_lengthresolution=7, - // then any fractional part is rounded to the closest multipl of 1/128 (128=2^7). + // then any fractional part is rounded to the closest multiple of 1/128 (128=2^7). /// int m_lengthresolution = 2; diff --git a/opennurbs_ellipse.cpp b/opennurbs_ellipse.cpp index 1dc18e76..497eed17 100644 --- a/opennurbs_ellipse.cpp +++ b/opennurbs_ellipse.cpp @@ -323,7 +323,7 @@ bool ON_Ellipse::ClosestPointTo( const ON_3dPoint& point, double* t ) const if ( V.Unitize() ) { // Could not find a seed value for dbrent, - // but V and T are orthoganal, so t0 is + // but V and T are orthogonal, so t0 is // pretty close. if ( fabs(V*T) <= 0.087155742747658173558064270837474 ) return true; diff --git a/opennurbs_ellipse.h b/opennurbs_ellipse.h index 194646d5..538bfcc6 100644 --- a/opennurbs_ellipse.h +++ b/opennurbs_ellipse.h @@ -64,7 +64,7 @@ public: bool GetFoci( ON_3dPoint& F1, ON_3dPoint& F2 ) const; - // Evaluation uses the trigonometrix parameterization + // Evaluation uses the trigonometric parameterization // t -> plane.origin + cos(t)*radius[0]*plane.xaxis + sin(t)*radius[1]*plane.yaxis // evaluate parameters and return point ON_3dPoint PointAt( double ) const; @@ -118,7 +118,7 @@ public: const ON_3dVector& ); - // parameterization of NURBS curve does not match ellipse's transcendental paramaterization + // parameterization of NURBS curve does not match ellipse's transcendental parameterization int GetNurbForm( ON_NurbsCurve& ) const; // returns 0=failure, 2=success public: // members left public diff --git a/opennurbs_embedded_file.cpp b/opennurbs_embedded_file.cpp index da1cef95..04f9b264 100644 --- a/opennurbs_embedded_file.cpp +++ b/opennurbs_embedded_file.cpp @@ -374,7 +374,7 @@ struct ON_BUFFER_SEGMENT { struct ON_BUFFER_SEGMENT* m_prev_segment; struct ON_BUFFER_SEGMENT* m_next_segment; - ON__UINT64 m_segment_position0; // postion of first byte in this segment + ON__UINT64 m_segment_position0; // position of first byte in this segment ON__UINT64 m_segment_position1; // position of the first byte in the next segment // When a segment is the last one in an ON_Buffer, // is is common for m_segment_position1 > m_buffer_size. @@ -859,14 +859,14 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const for ( seg = m_first_segment; 0 != seg; seg = seg->m_next_segment ) { // prev_seg is set this way so that the error handling - // code can use continue statments for non-fatal errors. + // code can use continue statements for non-fatal errors. prev_seg = seg0; seg0 = seg; if ( seg->m_segment_position0 > seg->m_segment_position1 ) { // This is really bad! If you can determine how the corruption occurs, - // plase make a bug report and tell Dale Lear as soon as possible. + // please make a bug report and tell Dale Lear as soon as possible. ON_ERROR("corrupt buffer - segment's position values are invalid."); continue; } @@ -878,7 +878,7 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const // The first segment should have seg->m_segment_position0 = 0. // We'll keep going after the call to ON_ERROR. // - // If you can determine how the corruption occured, please + // If you can determine how the corruption occurred, please // make a bug report and assign it to Dale Lear. ON_ERROR("corrupt buffer - first segment has non-zero value for position0."); } @@ -889,7 +889,7 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const // seg->m_segment_position0 = previous_segment->m_segment_position1. // We'll keep going after the call to ON_ERROR. // - // If you can determine how the corruption occured, please + // If you can determine how the corruption occurred, please // make a bug report and assign it to Dale Lear. ON_ERROR("corrupt buffer - previous segment's position1 !- segment's position0."); } @@ -898,7 +898,7 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const if ( 0 == seg_size ) { - // If you can determine how the corruption occured, please + // If you can determine how the corruption occurred, please // make a bug report and assign it to Dale Lear. ON_ERROR("corrupt buffer - empty segment buffer."); continue; @@ -908,7 +908,7 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const { if ( seg != m_last_segment || seg->m_next_segment ) { - // If you can determine how the corruption occured, please + // If you can determine how the corruption occurred, please // make a bug report and assign it to Dale Lear. ON_ERROR("corrupt buffer - segments contain more bytes than m_buffer_size."); } @@ -921,7 +921,7 @@ ON__UINT32 ON_Buffer::CRC32( ON__UINT32 current_remainder ) const { if ( seg != m_last_segment || 0 != seg->m_next_segment || size > m_buffer_size ) { - // If you can determine how the corruption occured, please + // If you can determine how the corruption occurred, please // make a bug report and assign it to Dale Lear. ON_ERROR("corrupt buffer - list of segments is too long."); } @@ -949,7 +949,7 @@ bool ON_Buffer::SetCurrentSegment( bool bWritePending ) // In this case, true is returned when m_current_position < m_buffer_size // and false is returned in all other cases. // - // If seeks have occured since the last read or write, m_current_segment + // If seeks have occurred since the last read or write, m_current_segment // and m_current_segment_offset may need to be updated. // @@ -1179,9 +1179,9 @@ ON__UINT64 ON_Buffer::Read( ON__UINT64 size, void* buffer ) { if ( m_current_position == m_buffer_size && m_current_segment == m_last_segment ) { - // This is a common situation that occures when the read request is for a + // This is a common situation that occurs when the read request is for a // size larger than the remaining number of bytes in the buffer. For example, - // when repeatedly reading into a fixed size buffer until reasing the end + // when repeatedly reading into a fixed size buffer until reaching the end // of the file. This is not an error condition. break; } diff --git a/opennurbs_evaluate_nurbs.cpp b/opennurbs_evaluate_nurbs.cpp index 5c4fdb90..19595cbb 100644 --- a/opennurbs_evaluate_nurbs.cpp +++ b/opennurbs_evaluate_nurbs.cpp @@ -496,7 +496,7 @@ OUTPUT: (n) bez (t) = answer[n] COMMENTS: - Use de Casteljau's algorithm. Rational fuctions with removable singularities + Use de Casteljau's algorithm. Rational functions with removable singularities (like x^2/x) are efficiently and correctly handled. EXAMPLE: // ... @@ -1333,7 +1333,7 @@ bool ON_EvaluateNurbsDeBoor( * It is used to convert portions of NURB curves to Beziers and to create * fully multiple end knots. The functions that perform the above tasks * simply call this function with appropriate values and take linear - * combonations of the returned cv's to compute the desired result. + * combinations of the returned cv's to compute the desired result. * * Rational cases are handled adding one to the dimension and applying the * quotient rule as needed. @@ -1585,7 +1585,7 @@ void ON_ConvertNurbSpanToBezier(int cvdim, int order, * span's control vertices * knot * array of (2*order - 2) doubles the define the Nurb - * span's knot vector. The array should satisfiy + * span's knot vector. The array should satisfy * knot[0] <= ... <= knot[order-2] < knot[order-1] * <= ... <= knot[2*order-3] * t0, t1 diff --git a/opennurbs_evaluate_nurbs.h b/opennurbs_evaluate_nurbs.h index b81d9f11..7451355e 100644 --- a/opennurbs_evaluate_nurbs.h +++ b/opennurbs_evaluate_nurbs.h @@ -169,7 +169,7 @@ INPUT: der_count - [in] 1 <= der_count < order Number of derivatives. - Note all B-spline basis derivatives with der_coutn >= order are identically zero. + Note all B-spline basis derivatives with der_count >= order are identically zero. N - [in] The input value of N[] should be the results of the call diff --git a/opennurbs_extensions.cpp b/opennurbs_extensions.cpp index 999e0c66..0c92f842 100644 --- a/opennurbs_extensions.cpp +++ b/opennurbs_extensions.cpp @@ -2066,11 +2066,6 @@ ON_Color ONX_Model::WireframeColorFromAttributes( return color; } -void ONX_DumpView( ON_TextLog& dump, const ON_3dmView& view ) -{ - view.Dump(dump); -} - void ONX_Model::DumpSummary( ON_TextLog& dump ) const { dump.Print("File version: %u\n",m_3dm_file_version); @@ -2731,19 +2726,19 @@ bool ONX_Model::IncrementalReadModelGeometry( if (static_cast(previous_table) >= static_cast(ON_3dmArchiveTableType::object_table)) { // Yokel either read or skipped reading the geometry table. - ON_ERROR("Too late to read the geoemtry table."); + ON_ERROR("Too late to read the geometry table."); return false; } if (false == archive.BeginRead3dmObjectTable()) { - ON_ERROR("Geoemtry table cannot be read from archive."); + ON_ERROR("Geometry table cannot be read from archive."); return false; } active_table = archive.Active3dmTable(); if (active_table != ON_3dmArchiveTableType::object_table) { - ON_ERROR("Catestrophic geoemtry table reading error."); + ON_ERROR("Catastrophic geometry table reading error."); return false; } } @@ -2757,7 +2752,7 @@ bool ONX_Model::IncrementalReadModelGeometry( ON_3dmArchiveTableStatus object_table_status = archive.Archive3dmTableStatus(ON_3dmArchiveTableType::object_table); if (ON_3dmArchiveTableType::object_table != object_table_status.m_table_type) { - ON_ERROR("Catestrophic geoemtry table reading error."); + ON_ERROR("Catastrophic geometry table reading error."); return false; } @@ -3803,7 +3798,7 @@ ON_ModelComponentWeakReference ONX_ModelComponentIterator::LastComponentWeakRefe ON_ModelComponentWeakReference ONX_ModelComponentIterator::CurrentComponentWeakReference() const { - // unchanged ModelContentVersionNumber() means that m_link is safe to dreference. + // unchanged ModelContentVersionNumber() means that m_link is safe to dereference. // Otherwise use sn for safe reset. if (m_model_content_version != m_model->ModelContentVersionNumber() ) Internal_SetLink(m_model->Internal_ModelComponentLinkFromSerialNumber(m_current_component_sn)); @@ -3820,7 +3815,7 @@ ON_ModelComponentWeakReference ONX_ModelComponentIterator::NextComponentWeakRefe if (m_model_content_version == m_model->ModelContentVersionNumber() && nullptr != m_link ) { - // unchanged ModelContentVersionNumber() means that m_link is safe to dreference. + // unchanged ModelContentVersionNumber() means that m_link is safe to dereference. m_link = m_link->m_next; if (nullptr == m_link) { diff --git a/opennurbs_extensions.h b/opennurbs_extensions.h index 112866e7..e6d2c23c 100644 --- a/opennurbs_extensions.h +++ b/opennurbs_extensions.h @@ -188,7 +188,7 @@ ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray; /* Description: - Pedegodgical example of all the things in an OpenNURBS 3dm archive. + Pedagogical example of all the things in an OpenNURBS 3dm archive. The openNURBS examples use ONX_Model to store the information read from 3dm archives. Please study example_read.cpp for details. diff --git a/opennurbs_file_utilities.cpp b/opennurbs_file_utilities.cpp index e7959646..d11ba5ec 100644 --- a/opennurbs_file_utilities.cpp +++ b/opennurbs_file_utilities.cpp @@ -824,7 +824,7 @@ const ON_wString ON_FileSystemPath::CleanPath( wchar_t* clean_start = clean_head; if (bIsUNCHostName) { - clean_start += 3; // skip \\ and first charater of host name + clean_start += 3; // skip \\ and first character of host name // skip rest of host name while ( IsPermittedInHostName(*clean_start) ) @@ -1391,7 +1391,7 @@ const ON_wString ON_FileSystemPath::RelativePath( if (false == IsDirSep(*full_tail) || false == IsDirSep(*base_tail)) { // A double directory separator after the initial CleanAndRemoveFileName() - // calls indicates invalid file path informtion. + // calls indicates invalid file path information. return best_answer; } @@ -1405,7 +1405,7 @@ const ON_wString ON_FileSystemPath::RelativePath( if (IsDirSep(*full_tail) || IsDirSep(*base_tail)) { // A double directory separator after the initial ON_FileSystemPath::CleanPath() - // calls indicates invalid file path informtion. + // calls indicates invalid file path information. return best_answer; } diff --git a/opennurbs_file_utilities.h b/opennurbs_file_utilities.h index a28f630f..285cd1a0 100644 --- a/opennurbs_file_utilities.h +++ b/opennurbs_file_utilities.h @@ -1048,7 +1048,7 @@ public: bSkipTimeCheck - [in] if true, the time of last modification is not checked. Returns: - True if the file existes, can be read, and has a matching byte_count + True if the file exists, can be read, and has a matching byte_count and SHA-1 hash. */ bool IsSameFileContent( @@ -1097,7 +1097,7 @@ public: /// /// File exists and its size or content differs from the information - /// used to set the content hash. The file's laste modified time + /// used to set the content hash. The file's last modified time /// is older than ContentLastModifiedTime(). /// DifferentContentFileIsOlder = 3, @@ -1633,7 +1633,7 @@ public: ////////////////////////////////////////////////////////////////////////////////// // - // Iteratation initialization tools + // Iteration initialization tools // /* Description: @@ -1676,7 +1676,7 @@ public: ////////////////////////////////////////////////////////////////////////////////// // - // Iteratation iteration tools + // Iteration tools // /* @@ -1790,7 +1790,7 @@ public: ON__UINT64 CurrentItemCount() const; private: - ON__UINT32 m_state = 0; // 0 unset, 1=initialized, 2 = itereation in progress. 3 = iteration finished. + ON__UINT32 m_state = 0; // 0 unset, 1=initialized, 2 = iteration in progress. 3 = iteration finished. ON__UINT32 m_reserved = 0; ON_wString m_directory; // directory passed to Initialize() or FirstItem diff --git a/opennurbs_font.cpp b/opennurbs_font.cpp index 08b1df2c..c5175449 100644 --- a/opennurbs_font.cpp +++ b/opennurbs_font.cpp @@ -559,7 +559,7 @@ void ON_FontMetrics::SetAscentOfCapital( ) { int iascent_of_capital = Internal_FontMetricCeil(ascent_of_capital); - //// Dale Lear Feb 2021 - Huh? The contition is never true unless m_ascent - 1 overflows to a positive number. + //// Dale Lear Feb 2021 - Huh? The condition is never true unless m_ascent - 1 overflows to a positive number. ////if (m_ascent < 0 && iascent_of_capital > m_ascent && iascent_of_capital <= m_ascent - 1) //// iascent_of_capital = m_ascent; SetAscentOfCapital(iascent_of_capital); @@ -570,7 +570,7 @@ void ON_FontMetrics::SetAscentOfx( ) { int iascent_of_x = Internal_FontMetricCeil(ascent_of_x); - //// Dale Lear Feb 2021 - Huh? The contition is never true unless m_ascent - 1 overflows to a positive number. + //// Dale Lear Feb 2021 - Huh? The condition is never true unless m_ascent - 1 overflows to a positive number. ////if (m_ascent < 0 && iascent_of_x > m_ascent && iascent_of_x <= m_ascent - 1) //// iascent_of_x = m_ascent; SetAscentOfx(iascent_of_x); @@ -688,7 +688,7 @@ ON_ManagedFonts::~ON_ManagedFonts() { // ON_Font::Default.m_runtime_serial_number = 1 and it is the only instance of a font // with m_runtime_serial_number = 1. - // However, the managed_font pointer points to ON_Font::Default, which was destroyed a few miliseconds ago. + // However, the managed_font pointer points to ON_Font::Default, which was destroyed a few milliseconds ago. // See opennurbs_statics.cpp and observe that construction order is // ..., ON_ManagedFonts::List, ON_Font::Unset, ON_Font::Default, ... // and destruction order is @@ -730,7 +730,7 @@ public: double m_font_unit_to_normalized_scale = 1.0; double m_normalized_to_font_unit_scale = 1.0; - // Font metrics in the units from the system font defintion. + // Font metrics in the units from the system font definition. // UPM = font design cell height (often 1000 for PostScript, 2014 for TrueType, ...) ON_FontMetrics m_font_unit_metrics; @@ -913,7 +913,7 @@ const ON_Font* ON_ManagedFonts::GetFromFontCharacteristics( for (;;) { - // quick test for default font that occurs often enough to warrent the special checking + // quick test for default font that occurs often enough to warrant the special checking if (bIsUnderlined) break; if (bIsStrikethrough) @@ -1127,17 +1127,17 @@ const ON_Font* ON_ManagedFonts::Internal_AddManagedFont( { // Feb 22, 2021 RH-62974 // This managed font is not installed on this device. - // After prototyping several approaches permitting variaous types + // After prototyping several approaches permitting various types // of user configured font substitution, Lowell and Dale Lear // concluded that using the default font was the best option. // If this is a problem for lots of users, then we need a way - // for users to configure the choice of devault font. + // for users to configure the choice of default font. // Current settings: // Windows: Arial // Apple: Helvetic Neue // managed_font is a missing font. - // We have to substitue the correct quartet member (regular/bold/italic/bold-italic). + // We have to substitute the correct quartet member (regular/bold/italic/bold-italic). // Since managed_font references a font that is not installed on this device, // IsItalicInQuartet() and IsBoldInQuartet() will probably fall through to // the fallback best guess sections of those functions. @@ -2597,7 +2597,7 @@ bool ON_Font::ModificationPermitted( ON_ErrorEx(file_name, line_number, function_name, "Managed fonts cannot be modified."); else { - // Modificaton of this font means the managed information it references + // Modification of this font means the managed information it references // will not be valid. A reference to the correct cached information // will be generated when it is actually needed. m_font_glyph_cache.reset(); @@ -2795,7 +2795,7 @@ static bool Internal_EqualFamilyName( class Internal_FontDelta { // Internal_FontDelta is a simple minded attempt at measuring the difference between a target font and a candidate font. - // It is probably a poor substitued for something fancier like PANOSE information. + // It is probably a poor substitute for something fancier like PANOSE information. // Unfortunately, we generally do not have PANOSE information about the target font. public: @@ -2821,7 +2821,7 @@ public: return; } - // When we have identical PostSript names, we assume they + // When we have identical PostScript names, we assume they // are correct and assume font family, weight, stretch, and style // are exact matches. const ON_wString target_postscript_name = target_font.PostScriptName(); @@ -2987,7 +2987,7 @@ public: return 0; } - // Points to a cadidate for matching the original font + // Points to a candidate for matching the original font const ON_Font* m_candidate_font = nullptr; // 0: exact match @@ -2995,7 +2995,7 @@ public: // 2: same LOGFONT.lfName - different weight,stretch,style // 3: same family name - different LOGFONT.lfFaceName, weight,stretch,style // 4: some overlap in family name - // 5: least favoriable match + // 5: least favorable match int m_hash_delta = 0; // m_family_name_delta @@ -3427,7 +3427,7 @@ const ON_Font* ON_Font::Internal_DecoratedFont( const ON_Font* decorated_font = decorated.ManagedFont(); if (nullptr != decorated_font && ON_FontFaceQuartet::Member::Unset == decorated_font->m_quartet_member) { - // Decorated faces are not explicity in quartets, + // Decorated faces are not explicitly in quartets, // but when dealing with rich text, we need to know what quartet member they are decorating. decorated_font->m_quartet_member = this->m_quartet_member; } @@ -5479,7 +5479,7 @@ const ON_ClassArray< ON_FontFaceQuartet >& ON_FontList::QuartetList() const if (nullptr == quartet_faces[0][0] && nullptr == quartet_faces[1][0]) { - // This might happen if buggy code encouters a heavy font like Arial Black + // This might happen if buggy code encounters a heavy font like Arial Black // and incorrectly specifies the heavy regular/italic faces as bold. // A quartet name + regular/bold/italic/italic-bold user interface should offer // a regular and italic member in this situation. @@ -6052,7 +6052,7 @@ const ON_Font* ON_Font::GetManagedFontFromPostScriptName( // This font is not installed. ON_Font font(ON_Font::Unset); - // prefered weight/stretch/style since this font is not installed + // preferred weight/stretch/style since this font is not installed font.SetFontWeight(ON_Font::Weight::Normal); font.SetFontStretch(ON_Font::Stretch::Medium); font.SetFontStyle(ON_Font::Style::Upright); @@ -7017,7 +7017,7 @@ unsigned int ON_Font::CRC32( ? windows_logfont_name.MapStringOrdinal(ON_StringMapOrdinalType::MinimumOrdinal) : windows_logfont_name; - // SHould probably include PostScript name as well. + // Should probably include PostScript name as well. ON__UINT32 hash = ON_CRC32(0, sizeof(u), &u ); hash = ON_CRC32(hash,windows_logfont_name_crc.Length()*sizeof(wchar_t),static_cast(windows_logfont_name_crc)); @@ -7155,8 +7155,8 @@ bool ON_Font::SetFontCharacteristics( || ON_wString::EqualOrdinal(L"CountryBlueprint", -1, gdi_logfont_name, -1, true) ) { - // These two fonts were didstrubuted with ACAD for decades. - // Thy have several errors in their defintion including being + // These two fonts were distributed with ACAD for decades. + // Thy have several errors in their definition including being // marked as SYMBOL_CHARSET rather than ANSI_CHARSET. logfont_charset = ON_Font::WindowsConstants::logfont_symbol_charset; } @@ -7521,7 +7521,7 @@ public: if (s2.IsEmpty()) return ON_SHA1_Hash::EmptyContentHash; - // add a hypen between family and postscript name + // add a hyphen between family and postscript name // to insure hash for Family = A and postscript = BC // is different from hash for Family = AB and postscript = C s1 += ON_wString::HyphenMinus; @@ -7604,8 +7604,8 @@ const ON_wString ON_Font::FakeWindowsLogfontNameFromFamilyAndPostScriptNames( // // Internal_FakeWindowsLogfontName(family_name,postscript_name,fake_logfont_name,member); - // Cominations that are not explicitly specified are correctly handled by using the family name as the fake logfont name. - // The explicity fake logfont name should always be different from the family name. + // Combinations that are not explicitly specified are correctly handled by using the family name as the fake logfont name. + // The explicitly fake logfont name should always be different from the family name. Internal_FakeWindowsLogfontName(L"American Typewriter", L"AmericanTypewriter-Light", L"American Typewriter Light", ON_FontFaceQuartet::Member::Regular), Internal_FakeWindowsLogfontName(L"American Typewriter", L"AmericanTypewriter-Semibold", L"American Typewriter Semibold", ON_FontFaceQuartet::Member::Regular), Internal_FakeWindowsLogfontName(L"American Typewriter", L"AmericanTypewriter-CondensedLight", L"American Typewriter Condensed Light", ON_FontFaceQuartet::Member::Regular), diff --git a/opennurbs_font.h b/opennurbs_font.h index 8cee156e..b230dac9 100644 --- a/opennurbs_font.h +++ b/opennurbs_font.h @@ -346,7 +346,7 @@ public: Beginning in 2018 this value is taken from the system font metrics so that fonts designed to render Asian language text, symbols, and emojis will display as expected and lines of text containing - mulitiple fonts will render more clearly. + multiple fonts will render more clearly. The value (user specified text height)/AscentOfCapital() is used as the scale factor to render glyphs when user interface has provided @@ -617,7 +617,7 @@ public: public: // The use context determines the length units. Common units include font glyph design units, - // normalizied font design units, various display units. Typically x increases to the right, + // normalized font design units, various display units. Typically x increases to the right, // y increases upwards. For glyph and text run boxes, (0,0) is the horizontal base // ON_2dex m_bbmin = ON_2dex::Unset; @@ -798,13 +798,13 @@ public: /* Returns: True if the point is on at the start or end of a line or bezier segment. - False otherwise (the point is in iterior control point in bezier segment or unset). + False otherwise (the point is in interior control point in bezier segment or unset). */ bool IsOnFigure() const; /* Returns: - True if the point is in iterior control point in bezier segment. + True if the point is in interior control point in bezier segment. False otherwise (the point is on at the start or end of a line or bezier segment or unset). */ bool IsOffFigure() const; @@ -943,7 +943,7 @@ public: Description: Opennurbs searches the description saved in field 10 of the name table for the strings "Engraving - single stroke" / "Engraving - double stroke" / "Engraving" - to identify fonts that are desgned for engraving (and which tend to render poorly when + to identify fonts that are designed for engraving (and which tend to render poorly when used to display text devices like screens, monitors, and printers). The SLF (single line fonts) are examples of fonts that have Engraving in field 10. Parameters: @@ -991,7 +991,7 @@ public: outer_figure - [in] When bPerformExtraChecking is false, outer_figure->FigureOrientation() should be set to what you plan on using when rendering the glyph. - The orientation of outer_figur can be either clockwise or counterclockwise + The orientation of outer_figure can be either clockwise or counterclockwise and, in the context of the entire glyph, outer_figure can be an inner or outer boundary. For example, the registered trademark glyph (UNICODE U+00AE) is an example where four nested figures with alternating orientations are common. @@ -1900,7 +1900,7 @@ public: When this->CodePointIsSet() is true, and bUseReplacementCharacter is true, and no reasonable glyph definition exists, - and no substitued is available, + and no substituted is available, then the replacement character glyph for UNICODE code point ON_UnicodeCodePoint::ON_ReplacementCharacter (U+FFFD) will be returned. @@ -1951,7 +1951,7 @@ public: ) const; #if defined(OPENNURBS_FREETYPE_SUPPORT) -// Look in opennurbs_system_rumtime.h for the correct place to define OPENNURBS_FREETYPE_SUPPORT. +// Look in opennurbs_system_runtime.h for the correct place to define OPENNURBS_FREETYPE_SUPPORT. // Do NOT define OPENNURBS_FREETYPE_SUPPORT here or in your project setting ("makefile"). @@ -2078,7 +2078,7 @@ private: // NOTE WELL: // The offset of m_codepoint in ON_FontGlyph must be >= 8 bytes. // so the ON_FixeSizePool that manages memory for the glyph cache - // can efficiently iteratate all active managed glyphs. + // can efficiently iterate all active managed glyphs. // ON_TextBox m_font_unit_glyph_bbox; // values in the native font definition units (freetype FT_LOAD_NO_SCALE units) ON_TextBox m_normalized_glyph_bbox; // bounding box in opennurbs normalized font coordinates @@ -2452,7 +2452,7 @@ public: /// /// Set from an Apple CTFont. The PostScriptName() and FamilyName() match a /// font installed on device running MacOS or iOS. The FaceName() matches - /// the "typeface" name shonw in the MacOS FontBook app. + /// the "typeface" name shown in the MacOS FontBook app. /// AppleFont = 3 }; diff --git a/opennurbs_fpoint.h b/opennurbs_fpoint.h index 9125770e..2fdd7fc0 100644 --- a/opennurbs_fpoint.h +++ b/opennurbs_fpoint.h @@ -192,12 +192,12 @@ public: const ON_Xform& ); - void Rotate( // rotatation in XY plane + void Rotate( // rotation in XY plane double, // angle in radians const ON_2fPoint& // center of rotation ); - void Rotate( // rotatation in XY plane + void Rotate( // rotation in XY plane double, // sin(angle) double, // cos(angle) const ON_2fPoint& // center of rotation diff --git a/opennurbs_fsp.cpp b/opennurbs_fsp.cpp index 8296b9ee..12877241 100644 --- a/opennurbs_fsp.cpp +++ b/opennurbs_fsp.cpp @@ -11,7 +11,7 @@ ON_FixedSizePool::ON_FixedSizePool() { ////const size_t sz = sizeof(*this); - ////ON_TextLog::Null.Print("L%d", sz); // supress compile errors. + ////ON_TextLog::Null.Print("L%d", sz); // suppress compile errors. // sz = 72 bytes before step 2 fixes for https://mcneel.myjetbrains.com/youtrack/issue/RH-49375 // // private data members will be rearranged but the size cannot change so that the diff --git a/opennurbs_fsp.h b/opennurbs_fsp.h index 88028a46..194abf2f 100644 --- a/opennurbs_fsp.h +++ b/opennurbs_fsp.h @@ -85,7 +85,7 @@ public: then pass the number of elements per block here. When block_element_capacity > 0 and element_count_estimate > 0, the first block will have a capacity of at least element_count_estimate; in this - case do not ask for extraordinarly large amounts of contiguous heap. + case do not ask for extraordinarily large amounts of contiguous heap. Remarks: You must call Create() on an unused ON_FixedSizePool or call Destroy() @@ -470,7 +470,7 @@ public: element_index parameter, then the iteration begins at that element. Example: - The loop will iteratate through all the elements returned from + The loop will iterate through all the elements returned from AllocateElement(), including any that have be returned to the pool using ReturnElement(). @@ -497,7 +497,7 @@ public: identified and skipped. Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ void* FirstElement(); void* FirstElement( size_t element_index ); @@ -518,7 +518,7 @@ public: identified and skipped. Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ void* NextElement(); @@ -528,7 +528,7 @@ public: or NextElement(). Remarks: Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ void* CurrentElement() const; @@ -554,7 +554,7 @@ public: Note that if you have used ReturnElement(), some of these elements may have been returned. Example: - The loop will iteratate through all the blocks. + The loop will iterate through all the blocks. // iterate through all blocks in the pool size_t block_element_count = 0; @@ -581,7 +581,7 @@ public: to iterate through the list of blocks. Do not make any calls to FirstElement() or NextElement() when using - FirstBlock() and NextBlock() to iteratate through blocks. + FirstBlock() and NextBlock() to iterate through blocks. */ void* FirstBlock( size_t* block_element_count ); @@ -600,7 +600,7 @@ public: The next block when iterating through the blocks. Remarks: Do not make any calls to FirstElement() or NextElement() when using - FirstBlock() and NextBlock() to iteratate through blocks. + FirstBlock() and NextBlock() to iterate through blocks. */ void* NextBlock( size_t* block_element_count ); @@ -634,7 +634,7 @@ public: of elements per block here. When block_element_count > 0 and element_count_estimate > 0, the first block will be large enough element_count_estimate*sizeof(T) bytes; in this case do not - ask for extraordinarly large amounts of contiguous heap. + ask for extraordinarily large amounts of contiguous heap. Remarks: You must call Create() on an unused ON_FixedSizePool or call Destroy() before calling create. @@ -770,7 +770,7 @@ public: element_index parameter, then the iteration begins at that element. Example: - The loop will iteratate through all the elements returned from + The loop will iterate through all the elements returned from AllocateElement(), including any that have be returned to the pool using ReturnElement(). @@ -797,7 +797,7 @@ public: identified and skipped. Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ T* FirstElement(); T* FirstElement( size_t element_index ); @@ -818,7 +818,7 @@ public: identified and skipped. Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ T* NextElement(); @@ -828,7 +828,7 @@ public: or NextElement(). Remarks: Do not make any calls to FirstBlock() or NextBlock() when using - FirstElement() and NextElement() to iteratate through elements. + FirstElement() and NextElement() to iterate through elements. */ T* CurrentElement(); @@ -854,7 +854,7 @@ public: Note that if you have used ReturnElement(), some of these elements may have been returned. Example: - The loop will iteratate through all the blocks. + The loop will iterate through all the blocks. // iterate through all blocks in the pool size_t block_element_count = 0; @@ -881,7 +881,7 @@ public: to iterate through the list of blocks. Do not make any calls to FirstElement() or NextElement() when using - FirstBlock() and NextBlock() to iteratate through blocks. + FirstBlock() and NextBlock() to iterate through blocks. */ T* FirstBlock( size_t* block_element_count ); @@ -900,7 +900,7 @@ public: The next block when iterating through the blocks. Remarks: Do not make any calls to FirstElement() or NextElement() when using - FirstBlock() and NextBlock() to iteratate through blocks. + FirstBlock() and NextBlock() to iterate through blocks. */ T* NextBlock( size_t* block_element_count ); diff --git a/opennurbs_geometry.cpp b/opennurbs_geometry.cpp index 6382ed6a..919c7c85 100644 --- a/opennurbs_geometry.cpp +++ b/opennurbs_geometry.cpp @@ -121,7 +121,7 @@ bool ON_Geometry::GetTightBoundingBox( const ON_Xform* xform ) const { - // This implementation should be overridden by classes devived + // This implementation should be overridden by classes derived // from ON_Geometry bool bGrowBox = (0!= bGrowBoxAsInt); if ( bGrowBox && !tight_bbox.IsValid() ) @@ -262,13 +262,13 @@ bool ON_Geometry::Transform( const ON_Xform& xform ) bool ON_Geometry::HasBrepForm() const { - // override if specific geoemtry has brep form + // override if specific geometry has brep form return false; } ON_Brep* ON_Geometry::BrepForm(ON_Brep* brep) const { - // override if specific geoemtry has brep formw + // override if specific geometry has brep form return nullptr; } diff --git a/opennurbs_geometry.h b/opennurbs_geometry.h index a38ec356..ecfdeeb3 100644 --- a/opennurbs_geometry.h +++ b/opennurbs_geometry.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////// // -// virtual base class for all geomtric objects +// virtual base class for all geometric objects // //////////////////////////////////////////////////////////////// @@ -158,7 +158,7 @@ public: ); // Description: - // Scales the object by the specified facotor. The scale is + // Scales the object by the specified factor. The scale is // centered at the origin. // Parameters: // scale_factor - [in] scale factor diff --git a/opennurbs_glyph_outline.cpp b/opennurbs_glyph_outline.cpp index af3aa402..75ca1f62 100644 --- a/opennurbs_glyph_outline.cpp +++ b/opennurbs_glyph_outline.cpp @@ -117,24 +117,6 @@ void ON_Outline::Reverse() } } -const bool Internal_FigureBoxesAreDisjoint( - const ON_BoundingBox& a, - const ON_BoundingBox& b -) -{ - // figure boxes are 2d - ignore z. - // figures are closed loops, so we can use <= and >= instead of < and > - if (a.m_min[0] >= b.m_max[0]) - return true; - if (a.m_max[0] <= b.m_min[0]) - return true; - if (a.m_min[1] >= b.m_max[1]) - return true; - if (a.m_max[1] <= b.m_min[1]) - return true; - return false; -} - static int Internal_CompareAreaEstimate(ON_OutlineFigure* const* lhs, ON_OutlineFigure* const* rhs) { // Used to sort the figures_sorted_by_size[] array which is constructed in a way @@ -905,9 +887,9 @@ static bool Internal_ExtraInsideOfPolylineText( alpha[0] * B[1].x + alpha[1] * B[1].y + alpha[2] }; if (h[0] < 0.0 && h[1] < 0.0) - continue; // B[0] and B[1] on same side of infinte line through A[0],A[1] + continue; // B[0] and B[1] on same side of infinite line through A[0],A[1] if (h[0] > 0.0 && h[1] > 0.0) - continue; // B[0] and B[1] on same side of infinte line through A[0],A[1] + continue; // B[0] and B[1] on same side of infinite line through A[0],A[1] const double beta[3] = { @@ -919,9 +901,9 @@ static bool Internal_ExtraInsideOfPolylineText( h[0] = beta[0] * B[0].x + beta[1] * B[0].y + beta[2]; h[1] = beta[0] * B[1].x + beta[1] * B[1].y + beta[2]; if (h[0] < 0.0 && h[1] < 0.0) - continue; // A[0] and A[1] on same side of infinte line through B[0],B[1] + continue; // A[0] and A[1] on same side of infinite line through B[0],B[1] if (h[0] > 0.0 && h[1] > 0.0) - continue; // A[0] and A[1] on same side of infinte line through B[0],B[1] + continue; // A[0] and A[1] on same side of infinite line through B[0],B[1] // The line segment A[0],A[1] and line segment B[0],B[1] intersect someplace. // The location of the intersection doesn't matter, even if it's one of the end points. @@ -992,7 +974,7 @@ bool ON_OutlineFigure::IsInsideOf( // The context that calls this function is sorting nested loops. // The orientation of outer_figure has been decided and set at this point. // When this orientation of this is not different, we need more checking - // to verify that the orientaion from the font definition file was really "wrong". + // to verify that the orientation from the font definition file was really "wrong". // The "A crossbar" in Bahnschrift U+00C5 is one of many cases that // require this additional checking. More generally, glyphs with // orientations set correctly and which use overlapping outer @@ -1207,7 +1189,7 @@ bool ON_OutlineFigure::ReverseFigure() { if ( false == a[i].IsInteriorFigurePoint() ) { - // a[] containts errors, unsets, or embedded figures + // a[] contains errors, unsets, or embedded figures return error_rc; } } @@ -1942,7 +1924,7 @@ class ON_NurbsCurve* ON_OutlineFigure::Internal_GetFigureCurve( class Internal_OutlineFigureToPolyline { public: - double m_2x_tolerance = 0.0; // 2*tolerance (2* saves mulitplications) + double m_2x_tolerance = 0.0; // 2*tolerance (2* saves multiplications) void(*m_PointCallbackFunc)(float x, float y, void*); void* m_context = nullptr; ON_2fPoint m_prev_point = ON_2fPoint::NanPoint; @@ -2035,7 +2017,7 @@ void Internal_OutlineFigureToPolyline::Internal_AddBezier( { if ( level > 1 ) { - // x coordintat of bezier evaluated at t 0.5 is + // x coordinate of bezier evaluated at t 0.5 is // a = 1/8*bez_cv[0].x + 3/8*bez_cv[1].x + 3/8*bez_cv[2].x + 1/8*bez_cv[3].x // // x coordinate of midpoint of chord is @@ -2754,7 +2736,7 @@ bool ON_OutlineFigure::IsValidFigure( const ON_OutlineFigurePoint figure_end = a[figure_end_dex]; if (figure_id != figure_end.m_figure_index) { - if ( bLogErrors ) ON_ERROR("BeginFigure and EndFigure points have diffent m_contour_index values."); + if ( bLogErrors ) ON_ERROR("BeginFigure and EndFigure points have different m_contour_index values."); return false; } @@ -3189,7 +3171,7 @@ bool ON_FontGlyph::GetOutline( outline ); #elif defined(OPENNURBS_FREETYPE_SUPPORT) - // Look in opennurbs_system_rumtime.h for the correct place to define OPENNURBS_FREETYPE_SUPPORT. + // Look in opennurbs_system_runtime.h for the correct place to define OPENNURBS_FREETYPE_SUPPORT. // Do NOT define OPENNURBS_FREETYPE_SUPPORT here or in your project setting ("makefile"). // Use freetype based tools (least reliable results). // Freetype is basically a file reading utility that can parse outline @@ -3235,7 +3217,7 @@ bool ON_FontGlyph::GetGlyphContours( || ON_UNSET_POSITIVE_FLOAT == height_of_capital ) { - // returne results in font design units + // return results in font design units scale = 1.0; } else diff --git a/opennurbs_ground_plane.h b/opennurbs_ground_plane.h index e883a908..ef2b439b 100644 --- a/opennurbs_ground_plane.h +++ b/opennurbs_ground_plane.h @@ -95,7 +95,7 @@ public: virtual void SetTextureRotation(double angle); // This method populates an ON_Material with default settings and returns true. This is designed - // to be overriden by a subclass that can return a more interesting material. + // to be overridden by a subclass that can return a more interesting material. virtual bool PopulateMaterial(ON_Material& mat) const; // Emergency virtual function for future expansion. diff --git a/opennurbs_hash_table.h b/opennurbs_hash_table.h index eaae2897..b632a962 100644 --- a/opennurbs_hash_table.h +++ b/opennurbs_hash_table.h @@ -115,7 +115,7 @@ public: hash32 - [in] Remarks: This function is used to find the first element in the hash table with the - specified hash32 falue. Use ON_Hash32TableItem.NextItemWithSameHash() to get + specified hash32 failure. Use ON_Hash32TableItem.NextItemWithSameHash() to get the next item in the has table with the same hash value. */ class ON_Hash32TableItem* FirstItemWithHash( @@ -130,7 +130,7 @@ public: Returns: The first item in the hash table. Remarks: - This function is used for iterating throught every element in the hash table. + This function is used for iterating throughout every element in the hash table. */ class ON_Hash32TableItem* FirstTableItem( ) const; @@ -139,7 +139,7 @@ public: Returns: The next item in the hash table. Remarks: - This function is used for iterating throught every element in the hash table. + This function is used for iterating throughout every element in the hash table. */ class ON_Hash32TableItem* NextTableItem( const ON_Hash32TableItem* item diff --git a/opennurbs_hatch.cpp b/opennurbs_hatch.cpp index 4fcbdd1a..a3972584 100644 --- a/opennurbs_hatch.cpp +++ b/opennurbs_hatch.cpp @@ -351,7 +351,7 @@ static bool Internal_UseHatchReadV5( ) { // new hatch IO code pushed to master branch on Feb 26, 2016. - // THis clunky test has to be used on files writting with the Feb 26, 2016 version of opennurbs source code. + // THis clunky test has to be used on files written with the Feb 26, 2016 version of opennurbs source code. ON__UINT32 tcode = 0; ON__INT64 big_value = 0; archive.PeekAt3dmBigChunkType(&tcode, &big_value); @@ -690,7 +690,7 @@ bool ON_HatchPattern::IsValid( ON_TextLog* text_log) const if( count < 1) { if( text_log) - text_log->Print( "Line type patetern with no lines.\n"); + text_log->Print( "Line type pattern with no lines.\n"); return false; } for( int i = 0; i < count; i++) @@ -913,7 +913,7 @@ bool ON_HatchPattern::ReadV5( ON_BinaryArchive& ar) } } if (rc && IdIsNil()) - SetId(); // modern hatch patterns require a uniquie id. + SetId(); // modern hatch patterns require a unique id. return rc; } diff --git a/opennurbs_instance.cpp b/opennurbs_instance.cpp index a0993d4e..3e1b37b3 100644 --- a/opennurbs_instance.cpp +++ b/opennurbs_instance.cpp @@ -216,9 +216,9 @@ private: private: // When a component (layer, material, ...) from a linked file is inserted in the - // active model and a component id collision occures, the active model id of the + // active model and a component id collision occurs, the active model id of the // component has to be changed. This list keeps track of the changes so we can - // determine which runtime component correspondes to a component in the linked file. + // determine which runtime component corresponds to a component in the linked file. // The first id in the pair is component id in the linked reference file. // The second id in the pair is the component id in the runtime model. // @@ -600,7 +600,7 @@ void ON_ReferencedComponentSettingsImpl::BeforeLinkedDefinitionWriteImpl( ON_Layer* ref_model_layer_copy = new ON_Layer(*model_layer); // The runtime index and id commonly change every time the file is read, - // so saving this varaible runtime identification information + // so saving this variable runtime identification information // leads to confusion. ref_model_layer_copy->ClearName(); ref_model_layer_copy->ClearIndex(); @@ -746,7 +746,7 @@ bool ON_ReferencedComponentSettingsImpl::Internal_UpdateLayer( // Dale Lear August 2017 - RH-39457 // Saved PerViewport settings need to be applied to model_layer // - // Per view settings from the reference file have no meatning because the + // Per view settings from the reference file have no meaning because the // views they apply to are in the reference file and those views are // not merge into the active model. // The per view settings are simply copied from previous_model_layer to model_layer diff --git a/opennurbs_internal_V2_annotation.cpp b/opennurbs_internal_V2_annotation.cpp index 5c65c93f..29b03037 100644 --- a/opennurbs_internal_V2_annotation.cpp +++ b/opennurbs_internal_V2_annotation.cpp @@ -856,7 +856,7 @@ bool ON_OBSOLETE_V5_Annotation::Write( ON_BinaryArchive& file ) const // 28 Aug, 2010 - Lowell - changed minor version 0->1 to write // annotative scale flag // 24 September 2010 Dale Lear - // I incremented chunk version to 1.2 and wrote the TextFormaula() string. + // I incremented chunk version to 1.2 and wrote the TextFormula() string. rc = file.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,3); if (!rc) return false; @@ -881,7 +881,7 @@ bool ON_OBSOLETE_V5_Annotation::Write( ON_BinaryArchive& file ) const // June 17, 2010 - Lowell - Added adjustment to position text // a little better in pre-v5 files. - // There's no adjustment for right/left justify becasue we don't + // There's no adjustment for right/left justify because we don't // know the width of the text here // This doesn't change the size or position of any fields being // written, but just adjusts the plane to tune up the alignment @@ -942,7 +942,7 @@ bool ON_OBSOLETE_V5_Annotation::Write( ON_BinaryArchive& file ) const case ON_INTERNAL_OBSOLETE::V5_eAnnotationType::dtDimRadius: case ON_INTERNAL_OBSOLETE::V5_eAnnotationType::dtDimDiameter: // 9 August 2005 Dale Lear - radial dimensions do - // not support user postioned text. The never have + // not support user positioned text. The never have // in Rhino, but the old files had 5 points in them. if ( 4 == points.Count() ) { @@ -1143,7 +1143,7 @@ bool ON_OBSOLETE_V5_Annotation::Read( ON_BinaryArchive& file ) case ON_INTERNAL_OBSOLETE::V5_eAnnotationType::dtDimRadius: case ON_INTERNAL_OBSOLETE::V5_eAnnotationType::dtDimDiameter: // 9 August 2005 Dale Lear - radial dimensions do - // not support user postioned text. The never have + // not support user positioned text. The never have // in Rhino, but the old files had 5 points in them. if ( 5 == m_points.Count() ) { @@ -1268,7 +1268,7 @@ bool ON_OBSOLETE_V5_Annotation::Read( ON_BinaryArchive& file ) // The only example of this kind of text formatting I've seen here is from a file referenced by // https://mcneel.myjetbrains.com/youtrack/issue/RH-59675 // Uncommenting the following clause will convert all of the '\n' in V5 wrapped text to '\r\n' - // causeing V6 to make line breaks at those places. + // causing V6 to make line breaks at those places. // The text will no longer be "wrapped", but will have hard returns at the end of each line // where it was wrapped in V5. //////////////////////////////////// @@ -2107,7 +2107,7 @@ bool ON_OBSOLETE_V5_DimLinear::GetTightBoundingBox( int ON_OBSOLETE_V5_DimLinear::Repair() { // returns 0 = unable to repair - // 1 = in perfect condtion + // 1 = in perfect condition // 2 == repaired. const int ext0_pt_index = ON_OBSOLETE_V5_DimLinear::ext0_pt_index; diff --git a/opennurbs_internal_V5_dimstyle.cpp b/opennurbs_internal_V5_dimstyle.cpp index 48434543..cd380ac1 100644 --- a/opennurbs_internal_V5_dimstyle.cpp +++ b/opennurbs_internal_V5_dimstyle.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_internal_Vx_annotation.cpp b/opennurbs_internal_Vx_annotation.cpp index f4837021..adf46eb7 100644 --- a/opennurbs_internal_Vx_annotation.cpp +++ b/opennurbs_internal_Vx_annotation.cpp @@ -26,7 +26,7 @@ ///////////////////////////////////////////////////////////////////////////// // // This file contains code that translates current annotation object -// defintions to and from obsolete V2 and V5 annotation object definitions. +// definitions to and from obsolete V2 and V5 annotation object definitions. // This code is used to read and write old file formats. diff --git a/opennurbs_internal_defines.h b/opennurbs_internal_defines.h index 3c9be623..60130a4d 100644 --- a/opennurbs_internal_defines.h +++ b/opennurbs_internal_defines.h @@ -42,7 +42,6 @@ inline bool IsFloatEqual (float f1, float f2) { return (fabsf(f1 - f2) < 1e-6) inline bool IsDoubleEqual(double d1, double d2) { return (fabs (d1 - d2) < 1e-10); } ON_UUID RdkPlugInId(void); -ON_UUID UniversalRenderEngineId(void); ON__INT64 Integerize(float dirty); ON__INT64 Integerize(double dirty); diff --git a/opennurbs_intersect.cpp b/opennurbs_intersect.cpp index c067789f..125b826c 100644 --- a/opennurbs_intersect.cpp +++ b/opennurbs_intersect.cpp @@ -67,7 +67,7 @@ bool ON_Intersect( const ON_BoundingBox& bbox, ON_3dVector v = line.Direction(); const int i = v.MaximumCoordinateIndex(); - // gaurd against ON_UNSET_VALUE as input + // guard against ON_UNSET_VALUE as input if ( !(tol >= 0.0) ) tol = 0.0; @@ -1268,11 +1268,11 @@ int ON_Intersect( const ON_Sphere& sphere0, return 3;//Same sphere. } - //Spheres are appart. + //Spheres are apart. if (d > r0 + r1) return 0; - //Spheres tangent and appart + //Spheres tangent and apart if (d == r0+r1){ ON_3dPoint P = C0 + r0*D; circle.Create(P, 0.0); diff --git a/opennurbs_ipoint.h b/opennurbs_ipoint.h index 8db14ae7..05f9f344 100644 --- a/opennurbs_ipoint.h +++ b/opennurbs_ipoint.h @@ -63,7 +63,7 @@ public: public: /* For those times when a location was incorrectly represented by a vector. - It is intentional that ther is not an ON_2iPoint constructor from an ON_2iVector. + It is intentional that there is not an ON_2iPoint constructor from an ON_2iVector. */ static const ON_2iPoint FromVector(const class ON_2iVector& v); @@ -122,7 +122,7 @@ public: /* For those times when a direction was incorrectly represented by a point. - It is intentional that ther is not an ON_2iVector constructor from an ON_2iPoint. + It is intentional that there is not an ON_2iVector constructor from an ON_2iPoint. */ static const ON_2iVector FromPoint(const class ON_2iPoint& p); diff --git a/opennurbs_knot.cpp b/opennurbs_knot.cpp index 7aad3343..429d596a 100644 --- a/opennurbs_knot.cpp +++ b/opennurbs_knot.cpp @@ -220,7 +220,7 @@ int ON_NurbsSpanIndex( j = len-2; else if (side < 0) { // if user wants limit from below and t = an internal knot, - // back up to prevous span + // back up to previous span while(j > 0 && t == knot[j]) j--; } diff --git a/opennurbs_layer.cpp b/opennurbs_layer.cpp index d84e7819..208b1a9b 100644 --- a/opennurbs_layer.cpp +++ b/opennurbs_layer.cpp @@ -287,7 +287,7 @@ void ON_Layer::Dump( ON_TextLog& dump ) const } else { - dump.Print("Has custome section style\n"); + dump.Print("Has custom section style\n"); } } @@ -1149,12 +1149,6 @@ public: const ON__LayerPerViewSettings* b ); - static - int CompareViewportId( - const ON__LayerPerViewSettings* a, - const ON__LayerPerViewSettings* b - ); - /* Returns: A bitfield that sets the bits if a layer setting is @@ -1260,11 +1254,6 @@ int ON__LayerPerViewSettings::Compare( const ON__LayerPerViewSettings* a, const return rc; } -int ON__LayerPerViewSettings::CompareViewportId( const ON__LayerPerViewSettings* a, const ON__LayerPerViewSettings* b ) -{ - return ON_UuidCompare(a->m_viewport_id,b->m_viewport_id); -} - unsigned int ON__LayerPerViewSettings::SettingsMask() const { // It is critical that this function returns @@ -1751,7 +1740,7 @@ void ON__LayerExtensions::DeleteViewportSettings( { delete ud; // Set bit 0x01 of ON_Layer::m_extension_bits to prevent - // ON_Layer visibilty and color queries from wasting + // ON_Layer visibility and color queries from wasting // time looking for userdata. SetExtensionBit( const_cast(layer_m_extension_bits), 0x01 ); } @@ -1771,7 +1760,7 @@ void ON__LayerExtensions::DeleteViewportSettings( { delete ud; // Set bit 0x01 of ON_Layer::m_extension_bits to prevent - // ON_Layer visibilty and color queries from wasting + // ON_Layer visibility and color queries from wasting // time looking for userdata. SetExtensionBit( const_cast(layer_m_extension_bits), 0x01 ); } @@ -2022,7 +2011,7 @@ void ON_Layer::SetPerViewportPersistentVisibility( ON_UUID viewport_id, bool bVi if ( ON_UuidIsNotNil(viewport_id) ) { bool bCreate = false; // This "false" is correct because the per viewport visibility - // setting needs to be in existance for this call to make any + // setting needs to be in existence for this call to make any // sense in the first place. ON__LayerPerViewSettings* vp_settings = ON__LayerExtensions::ViewportSettings( *this, &m_extension_bits, viewport_id, bCreate ); if (vp_settings ) @@ -2047,7 +2036,7 @@ void ON_Layer::UnsetPerViewportPersistentVisibility( ON_UUID viewport_id ) else { bool bCreate = false; // This "false" is correct because the per viewport visibility - // setting needs to be in existance for this call to make any + // setting needs to be in existence for this call to make any // sense in the first place. ON__LayerPerViewSettings* vp_settings = ON__LayerExtensions::ViewportSettings( *this, &m_extension_bits, viewport_id, bCreate ); if (vp_settings ) @@ -2309,7 +2298,7 @@ bool ON_Layer::CopyPerViewportSettings( { if ( ON_UuidIsNil(viewport_id) ) { - // copy per viwport settings for every viewport + // copy per viewport settings for every viewport const ON__LayerExtensions* soruce_layer_ud = ON__LayerExtensions::LayerExtensions(source_layer,&source_layer.m_extension_bits,false); if ( 0 != soruce_layer_ud ) { @@ -2328,7 +2317,7 @@ bool ON_Layer::CopyPerViewportSettings( } else { - // copy per viwport settings for a specified viewport. + // copy per viewport settings for a specified viewport. const ON__LayerPerViewSettings* src = ON__LayerExtensions::ViewportSettings( source_layer, &source_layer.m_extension_bits, viewport_id, false); if ( 0 != src ) { @@ -2522,4 +2511,4 @@ void ON_Layer::SetPerViewportIsVisibleInNewDetails(bool bVisible) if (nullptr == m_private) m_private = new ON_LayerPrivate(); m_private->m_visible_in_new_details = bVisible; -} \ No newline at end of file +} diff --git a/opennurbs_layer.h b/opennurbs_layer.h index abe4ddc3..574f6a08 100644 --- a/opennurbs_layer.h +++ b/opennurbs_layer.h @@ -312,7 +312,7 @@ public: /* Description: Set the index of the linetype used by objects on this layer that do - not have a per object lintypes + not have a per object linetypes Parameters: linetype_index - [in] Passing -1 will clear the setting. @@ -733,7 +733,7 @@ public: public: - // Layers are origanized in a hierarchical + // Layers are organized in a hierarchical // structure (like file folders). // If a layer is in a parent layer, // then m_parent_layer_id is the id of @@ -819,7 +819,7 @@ public: /* Description: - Returns true if a layer's per-viewport visiblity property will be true, + Returns true if a layer's per-viewport visibility property will be true, initially, in newly created detail views. */ bool PerViewportIsVisibleInNewDetails() const; diff --git a/opennurbs_leader.cpp b/opennurbs_leader.cpp index 7574753c..90e016d2 100644 --- a/opennurbs_leader.cpp +++ b/opennurbs_leader.cpp @@ -1069,7 +1069,7 @@ bool ON_Leader::UpdateTextPosition( ON_2dPoint attachpt(ON_2dPoint::Origin); ON_2dPoint from(ON_2dPoint::Origin); ON_Line ll; - if (LandingLine2d(dimstyle, leaderscale, ll)) // from ponit is end of landing line + if (LandingLine2d(dimstyle, leaderscale, ll)) // from point is end of landing line { text_dir = ll.Direction(); if (text_dir.Unitize()) diff --git a/opennurbs_line.cpp b/opennurbs_line.cpp index 474d540c..b2286224 100644 --- a/opennurbs_line.cpp +++ b/opennurbs_line.cpp @@ -520,7 +520,7 @@ bool ON_Line::IsFartherThan( double d, const ON_Line& L ) const // If ( b >= 0.0), then this->from and L(b) are a pair of closest points. if ( b < 0.0 ) { - // Othersise L.from and this(a) are a pair of closest points. + // Otherwise L.from and this(a) are a pair of closest points. b = 0.0; ClosestPointTo(L.from,&a); } @@ -533,7 +533,7 @@ bool ON_Line::IsFartherThan( double d, const ON_Line& L ) const // If ( b >= 0.0), then this->to and L(b) are a pair of closest points. if ( b < 0.0 ) { - // Othersise L.to and this(a) are a pair of closest points. + // Otherwise L.to and this(a) are a pair of closest points. b = 0.0; ClosestPointTo(L.from,&a); } @@ -590,7 +590,7 @@ ON_Triangle::ON_Triangle(const ON_3dPoint & a, const ON_3dPoint & b, const ON_3d ON_Triangle::ON_Triangle(double x) { - // Note this constructor overload is usefull so that ON_Triangle(0) doesn't + // Note this constructor overload is useful so that ON_Triangle(0) doesn't // get interpreted as ON_Triangle(nullptr) ON_3dPoint p(x, x, x); m_V[0] = m_V[1] = m_V[2] = p; diff --git a/opennurbs_line.h b/opennurbs_line.h index a8b1db9e..5bbee6f8 100644 --- a/opennurbs_line.h +++ b/opennurbs_line.h @@ -114,7 +114,7 @@ public: Description: Get a plane that contains the line. Parameters: - plane - [out] a plane that contains the line. The orgin + plane - [out] a plane that contains the line. The origin of the plane is at the start of the line. The distance from the end of the line to the plane is <= tolerance. If possible a plane parallel to the world xy, yz or zx diff --git a/opennurbs_linecurve.cpp b/opennurbs_linecurve.cpp index ec116cca..2c1e156c 100644 --- a/opennurbs_linecurve.cpp +++ b/opennurbs_linecurve.cpp @@ -557,7 +557,7 @@ bool ON_LineCurve::Trim( const ON_Interval& domain ) ON_3dPoint p = PointAt( domain[0] ); ON_3dPoint q = PointAt( domain[1] ); if( !p.IsCoincident(q)){ - // 7-May-21 GBA, A successfull trim should return an IsValid ON_LineCurve . + // 7-May-21 GBA, A successful trim should return an IsValid ON_LineCurve . m_line.from = p; m_line.to = q; m_t = domain; diff --git a/opennurbs_linecurve.h b/opennurbs_linecurve.h index 0fbd7de4..a1387ffc 100644 --- a/opennurbs_linecurve.h +++ b/opennurbs_linecurve.h @@ -221,7 +221,7 @@ public: ON_3dPoint end_point ) override; - bool Reverse() override; // reverse parameterizatrion + bool Reverse() override; // reverse parameterization // Domain changes from [a,b] to [-b,-a] bool Evaluate( // returns false if unable to evaluate @@ -303,7 +303,7 @@ public: // 0 unable to create NURBS representation // with desired accuracy. // 1 success - returned NURBS parameterization - // matches the curve's to wthe desired accuracy + // matches the curve's to the desired accuracy // 2 success - returned NURBS point locus matches // the curve's to the desired accuracy but, on // the interior of the curve's domain, the @@ -324,7 +324,7 @@ public: // 0 unable to create NURBS representation // with desired accuracy. // 1 success - returned NURBS parameterization - // matches the curve's to wthe desired accuracy + // matches the curve's to the desired accuracy // 2 success - returned NURBS point locus matches // the curve's to the desired accuracy but, on // the interior of the curve's domain, the diff --git a/opennurbs_linetype.h b/opennurbs_linetype.h index 919f06e4..90479577 100644 --- a/opennurbs_linetype.h +++ b/opennurbs_linetype.h @@ -241,7 +241,7 @@ public: Description: Units used to define the linetype width None = width is defined in pixels (default) - Unset = width is the same as the document's unitsystem + Unset = width is the same as the document's unit system */ ON::LengthUnitSystem WidthUnits() const; @@ -249,7 +249,7 @@ public: Description: Set the units used to define the linetype width None = width is defined in pixels (default) - Unset = width is the same as the document's unitsystem + Unset = width is the same as the document's unit system */ void SetWidthUnits(ON::LengthUnitSystem units); diff --git a/opennurbs_locale.cpp b/opennurbs_locale.cpp index fab00cc1..ef796c7d 100644 --- a/opennurbs_locale.cpp +++ b/opennurbs_locale.cpp @@ -761,7 +761,7 @@ bool ON_Locale::ParseName( if ( region_code_capacity > 0 && region_code_capacity <= (size_t)(s1-s0) ) return false; for (size_t i = 0; i < region_code_capacity && s0 < s1; i++) - region_code[i] = ToUpper(*s0++); // unppercase for regions is a convention + region_code[i] = ToUpper(*s0++); // uppercase for regions is a convention continue; } } @@ -1170,7 +1170,7 @@ ON_Locale ON_Locale::FromAppleName( { // Apple uses "zh-Hant" for the "language" name and "zh_TW" for the "locale" name // when identifying OS X string services that might be useful to people who live - // in Tiawan. + // in Taiwan. return ON_Locale::FromWindowsLCIDAndName(ON_Locale::WindowsLCID::zh_TW_LCID, "zh-TW"); } diff --git a/opennurbs_locale.h b/opennurbs_locale.h index e6582f42..5617d781 100644 --- a/opennurbs_locale.h +++ b/opennurbs_locale.h @@ -200,7 +200,7 @@ public: Remarks: ON_Locale::InvariantCulture.BCP47LanguageName() = ""; - ON_Locale::Oridnal.BCP47LanguageName() = ""; + ON_Locale::Ordinal.BCP47LanguageName() = ""; */ const char* BCP47LanguageTag() const; diff --git a/opennurbs_lock.h b/opennurbs_lock.h index 5f7e640e..136a768b 100644 --- a/opennurbs_lock.h +++ b/opennurbs_lock.h @@ -16,7 +16,7 @@ /* Description: - ON_Lock is a thread safe lock semephore. It is implemented using + ON_Lock is a thread safe lock semaphore. It is implemented using platform specific compare and set functions. */ class ON_CLASS ON_Lock @@ -63,7 +63,7 @@ public: Description: Calls ReturnLock(ON_Lock::DefaultLockedValue); Returns: - True if the lock state was locked with a locak value = ON_Lock::DefaultLockedValue + True if the lock state was locked with a lock value = ON_Lock::DefaultLockedValue and the current lock value was changed from ON_Lock::DefaultLockedValue to ON_Lock::UnlockedValue. False otherwise. */ diff --git a/opennurbs_lookup.cpp b/opennurbs_lookup.cpp index f2da3e18..530d8825 100644 --- a/opennurbs_lookup.cpp +++ b/opennurbs_lookup.cpp @@ -187,7 +187,7 @@ void ON_SN_BLOCK::CullBlockHelper() // value is zero and remove them from the array. // // This is a high speed helper function. - // The calling function must verfy m_purged > 0. + // The calling function must verify m_purged > 0. // // This function removes all m_sn[] elements // that have 0 == m_sn_active. @@ -574,7 +574,7 @@ struct ON_SerialNumberMap::SN_ELEMENT* ON_SerialNumberMap::FindElementHelper(ON_ { // m_sn_block0.m_sn[] needs to be sorted // - // This is a rare occurance. It only happens + // This is a rare occurrence. It only happens // when commands add new objects in an order that // is different from that in which the CRhinoObject // class constructor was called. In testing, @@ -1100,7 +1100,7 @@ ON_SerialNumberMap::RemoveSerialNumberAndId(ON__UINT64 sn) if ( m_e_blk == &m_sn_block0 ) { // Every element in m_sn_block0 is purged. - // Empyt m_sn_block0. + // Empty m_sn_block0. m_sn_count -= m_sn_block0.m_count; m_sn_purged -= m_sn_block0.m_count; m_sn_block0.EmptyBlock(); @@ -1357,7 +1357,7 @@ ON__UINT64 ON_SerialNumberMap::GarbageCollectMoveHelper(ON_SN_BLOCK* dst,ON_SN_B { // This helper is used by GarbageCollectHelper and moves // as many entries as possible from src to dst. - // Returns: the number of entries transfered. + // Returns: the number of entries transferred. ON__UINT32 i,j,n; if ( src && dst ) { @@ -1736,7 +1736,7 @@ struct ON_SerialNumberMap::SN_ELEMENT* ON_SerialNumberMap::AddSerialNumberAndId( if (IdIsEqual(&m_inactive_id, &id)) { // This id was recently removed and is now being added back - // (which turns out to be a common occurance - go figure). + // (which turns out to be a common occurrence - go figure). // No need to check for duplicates. m_inactive_id = ON_nil_uuid; } diff --git a/opennurbs_mapchan.h b/opennurbs_mapchan.h index 6245c77e..36fbe479 100644 --- a/opennurbs_mapchan.h +++ b/opennurbs_mapchan.h @@ -39,7 +39,7 @@ public: ON_UUID m_mapping_id; // Identifies an ON_TextureMapping - // RUNTIME textrure mapping table index. + // RUNTIME texture mapping table index. // If -1, it needs to be set. This value is not saved int files. int m_mapping_index; @@ -75,7 +75,7 @@ ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray; // use. This allows different rendering plug-ins to have different // materials on the same object. The values of // ON_3dmObjectAttributes.m_material_index and -// ON_3dmObjectAttributes.m_matrial_source reflect the settings +// ON_3dmObjectAttributes.m_material_source reflect the settings // of the renderer that is currently active. // @@ -119,7 +119,7 @@ public: mapping_id - [in] ON_TextureMapping id Returns: - True if the mapping channel was added or a pefect + True if the mapping channel was added or a perfect match already existed. False if a mapping channel with a different mapping_id already exists for this plug-in and channel. diff --git a/opennurbs_material.cpp b/opennurbs_material.cpp index 3ae47c5a..59e52bdc 100644 --- a/opennurbs_material.cpp +++ b/opennurbs_material.cpp @@ -893,7 +893,7 @@ double ON_Material::FresnelReflectionCoefficient( g = fresnel_index_of_refraction*fresnel_index_of_refraction + c*c - 1.0; g = (g > 0.0) ? sqrt(g) : 0.0; - // unsafe (potiential divide by zero, overflow, ...) and inefficient + // unsafe (potential divide by zero, overflow, ...) and inefficient // return ( ((g-c)*(g-c))/(2*(g+c)*(g+c)) ) * (1.0f + ( ((c*(g+c)-1.0)*(c*(g+c)-1.0))/((c*(g+c)+1.0)*(c*(g+c)+1.0)) ) ); x = g+c; @@ -922,7 +922,7 @@ double ON_Material::FresnelReflectionCoefficient( return x; // x is } - return 1.0; // error occured + return 1.0; // error occurred } double ON_Material::FresnelReflectionCoefficient( @@ -1615,15 +1615,10 @@ int ON_Material::CompareAppearance( const ON_Material& a, const ON_Material& b ) // around that. if (0 == rc) { - static const ON_UUID uuidUniversal = - { - // {99999999-9999-9999-9999-999999999999} - 0x99999999, 0x9999, 0x9999, { 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99 } - }; if ( - 0 != ON_UuidCompare(&uuidUniversal, &a.m_plugin_id) + 0 != ON_UuidCompare(&ON_UniversalRenderEngineId, &a.m_plugin_id) && - 0 != ON_UuidCompare(&uuidUniversal, &b.m_plugin_id) + 0 != ON_UuidCompare(&ON_UniversalRenderEngineId, &b.m_plugin_id) ) { rc = ON_UuidCompare(&a.m_plugin_id, &b.m_plugin_id); @@ -2975,7 +2970,7 @@ ON_Xform ON_Texture::GetPictureShrinkSurfaceTransformation( return *error_return; // The new brep has a smaller surface. - // Adust the texture transform to use the proper subset of the old picture image texture. + // Adjust the texture transform to use the proper subset of the old picture image texture. ON_Xform x = ON_Xform::TranslationTransformation(p0 - ON_3dPoint::Origin) * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, sx, sy, 1.0); @@ -3427,7 +3422,7 @@ int ON_TextureMapping::EvaluateCylinderMapping( else if ( r <= 1.001 ) { // The point is inside the capped cylinder. - // Use normal to dermine which surface to use + // Use normal to determine which surface to use // for closest point test. ON_3dVector n(m_Nxyz*N); if ( ( fabs(n.z) > fabs(n.x) && fabs(n.z) > fabs(n.y) ) ) @@ -4648,6 +4643,10 @@ public: } return false; } + const ON_BoundingBox& BBox() const + { + return m_bbox; + } protected: bool HasFace(int fi) { @@ -4683,6 +4682,7 @@ public: if (!IsBanned(fi)) { m_fis.push_back(fi); + GrowBoundingBox(fi); int* pSeamed = nullptr; const int nSeamed = m_seamTool.SeamedNeighbours(fi, pSeamed); @@ -4708,12 +4708,22 @@ public: } } } + void GrowBoundingBox(int fi) + { + const ON_MeshFace& face = m_mesh.m_F[fi]; + const int fcc = face.IsQuad() ? 4 : 3; + for (int fci = 0; fci < fcc; fci++) + { + m_bbox.Set(m_mesh.Vertex(face.vi[fci]), 1); + } + } const ON_Mesh& m_mesh; const ON_2fPointArray& m_tc; const SeamTool& m_seamTool; std::vector m_fis; std::vector m_bannedFis; std::vector m_nextStepFis; + ON_BoundingBox m_bbox; // Cached results assuming same set of sample points is used all the time mutable bool m_bEvaluated; @@ -4825,10 +4835,12 @@ public: // } //} + ON_BoundingBox samplePointBbox; ON_SimpleArray commonFis; ON_SimpleArray allFis; for (int fvi = 0; fvi < count; fvi++) { + samplePointBbox.Set(pPts[fvi], 1); ON_RTreeSphere sphere; sphere.m_point[0] = pPts[fvi].x; sphere.m_point[1] = pPts[fvi].y; @@ -4907,9 +4919,14 @@ public: for (int i = 0; i < allFis.Count(); i++) { const TcSeamlessPatch& sp = patchCache.Get(allFis[i]); - if (sp.Evaluate(count, pSamplePts, maxDist, tcCount, pTcsOut)) + ON_BoundingBox patchMaxDistBb(sp.BBox()); + patchMaxDistBb.Expand(ON_3dVector(maxDist, maxDist, maxDist)); + if (patchMaxDistBb.Includes(samplePointBbox)) { - bSuccess = true; + if (sp.Evaluate(count, pSamplePts, maxDist, tcCount, pTcsOut)) + { + bSuccess = true; + } } } if (bSuccess) @@ -6229,7 +6246,7 @@ ON__CChangeTextureCoordinateHelper::ON__CChangeTextureCoordinateHelper( // It is critical to reserve enough room in the arrays // before duplication starts. Otherwise, during duplication, - // a dyanamic array can be reallocated, which will make + // a dynamic array can be reallocated, which will make // saved array base pointers will be invalid, and you crash // the next time they are used. @@ -6848,7 +6865,7 @@ void AdjustMeshPeriodicTextureCoordinatesHelper( { // This helper adjusts texture coordinates on faces that // span the seam on mapping spheres and cylinders and - // resolves the mulitiple valued problem that + // resolves the multiple valued problem that // exists at the poles of sphere mappings. const int vcnt = mesh.m_V.Count(); @@ -7497,7 +7514,7 @@ ON_MappingRef::ON_MappingRef() void ON_MaterialRef::Default() { memset(this,0,sizeof(*this)); - // runtme index value of -1 means not set + // runtime index value of -1 means not set m_material_index = -1; m_material_backface_index = -1; m_material_source = ON::material_from_layer; @@ -7842,7 +7859,7 @@ const ON_MappingRef* ON_ObjectRenderingAttributes::MappingRef( //ALB 2013.12.03 //Fixes http://mcneel.myjetbrains.com/youtrack/issue/RH-5730 - //I'm sick of this bug being considered irrelavent, and since I've decided to go out of my way to + //I'm sick of this bug being considered irrelevant, and since I've decided to go out of my way to //Sort out as many mapping problems as I can, I'm fixing this one like this. if (m_mappings.Count() > 0) { diff --git a/opennurbs_material.h b/opennurbs_material.h index d38029d9..84d9bdc8 100644 --- a/opennurbs_material.h +++ b/opennurbs_material.h @@ -202,6 +202,8 @@ public: The RDK material id identifies a material definition managed by the RDK (rendering development kit). Multiple materials in a Rhino or opennurbs model can reference the same RDK material. + When setting this value, it is necessary to also set this material's + plug-in id to ON_UniversalRenderEngineId. See SetMaterialPlugInId(). */ void SetRdkMaterialInstanceId( ON_UUID rdk_material_instance_id @@ -349,7 +351,7 @@ public: m_index_of_refraction: Default is 1.0. Physically, the index of refraction is >= 1.0 and is - the value (speed of light in vacum)/(speed of light in material). + the value (speed of light in vacuum)/(speed of light in material). Some rendering algorithms set m_index_of_refraction to zero or values < 1.0 to generate desirable effects. */ diff --git a/opennurbs_math.cpp b/opennurbs_math.cpp index e599b052..65093c1d 100644 --- a/opennurbs_math.cpp +++ b/opennurbs_math.cpp @@ -550,7 +550,7 @@ ON_EvJacobian( double ds_o_ds, double ds_o_dt, double dt_o_dt, /* NOTE: a = |Du|^2 * |Dv|^2 and b = (Du o Dv)^2 are always >= 0 */ det = a - b; if (ds_o_ds <= dt_o_dt* ON_EPSILON || dt_o_dt <= ds_o_ds* ON_EPSILON) { - /* one of the paritals is (numerically) zero with respect + /* one of the partials is (numerically) zero with respect * to the other partial - value of det is unreliable */ rc = false; @@ -731,7 +731,7 @@ ON_EvNormal(int limit_dir, * All I need is the direction, so I just need to compute a*A + b*B as carefully * as possible. Note that * (3) a*A + b*B = Du X (a*Duv + b*Dvv) - Dv X (a*Duu + b*Duv). - * Formaula (3) requires fewer flops than using formulae (1) and (2) to + * Formula (3) requires fewer flops than using formulae (1) and (2) to * compute a*A + b*B. In addition, when |Du| << |Dv| or |Du| >> |Dv|, * formula (3) reduces the number of subtractions between numbers of * similar size. Since the (nearly) zero first partial is the most common @@ -810,7 +810,7 @@ bool ON_EvTangent( if (d1 == 0.0) { - // Use L'hopital's rule to show that if the unit tanget + // Use L'hopital's rule to show that if the unit tangent // exists and the 1rst derivative is zero and the 2nd derivative is // nonzero, then the unit tangent is equal to +/-the unitized // 2nd derivative. The sign is equal to the sign of D1(s) o D2(s) @@ -853,7 +853,7 @@ ON_EvCurvature( if (d1 == 0.0) { - // Use L'hopital's rule to show that if the unit tanget + // Use L'hopital's rule to show that if the unit tangent // exists and the 1rst derivative is zero and the 2nd derivative is // nonzero, then the unit tangent is equal to +/-the unitized // 2nd derivative. The sign is equal to the sign of D1(s) o D2(s) @@ -2044,7 +2044,7 @@ ON_SolveQuadraticEquation( * is numerical noise and is assumed to be zero. * * If it is really important to have the best possible answer, - * you sould probably tune up the returned roots using + * you should probably tune up the returned roots using * Brent's algorithm. * * REFERENCE: @@ -2278,7 +2278,7 @@ COMMENTS: The computation is performed in such a way that the output "X" pointer can be equal to the input "d" pointer; i.e., if the d array will not be used after the call to ON_SolveTriDiagonal(), then - it is not necessary to allocate seperate space for X and d. + it is not necessary to allocate separate space for X and d. EXAMPLE: REFERENCE: NRC, section 2.6 @@ -5068,7 +5068,7 @@ bool ON_Sym3x3EigenSolver(double A, double B, double C, &ee2, EE2, &ee3, EE3); - /* Step 3. Apply rotation to express results in orignal coordinate system */ + /* Step 3. Apply rotation to express results in original coordinate system */ E1.Set(cos_phi*EE1.x + sin_phi * EE1.z, EE1.y, -sin_phi * EE1.x + cos_phi * EE1.z); E2.Set(cos_phi*EE2.x + sin_phi * EE2.z, EE2.y, -sin_phi * EE2.x + cos_phi * EE2.z); E3.Set(cos_phi*EE3.x + sin_phi * EE3.z, EE3.y, -sin_phi * EE3.x + cos_phi * EE3.z); @@ -5152,17 +5152,17 @@ bool ON_SymTriDiag3x3EigenSolver(double A, double B, double C, /* Description: - QL Algorithm with implict shifts, to determine the eigenvalues and eigenvectors of a + QL Algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a symmetric, tridiagonal matrix. -Parametrers: +Parameters: d - [in/out] On input d[0] to d[n-1] are the diagonal entries of the matrix. As output d[0] to d[n-1] are the eigenvalues. e - [in/out] On Input e[0] to e[n-1] are the off-diagonal entries of the matrix. with e[n-1] not used, but must be allocated. on output e is unpredictable. n - [in] matrix is n by n -pV - [out] If not nullptr the it should be an n by n matix. +pV - [out] If not nullptr the it should be an n by n matrix. The kth column will be a normalized eigenvector of d[k] */ bool ON_TriDiagonalQLImplicit(double* d, double* e, int n, ON_Matrix* pV) diff --git a/opennurbs_math.h b/opennurbs_math.h index b89e12f9..44449e54 100644 --- a/opennurbs_math.h +++ b/opennurbs_math.h @@ -253,7 +253,7 @@ public: and lower triangles. Since the matrix is symmetrix, you should do something like evaluate the upper triangle and copy the values to the - lower tiangle. + lower triangle. Returns: -1 = Hessian evaluation not available. 0 = unable to evaluate @@ -680,7 +680,7 @@ Parameters: a plane containing the points, pass null here. plane_equation - [out] If this point is not null, then the equation of the plane - containing the points is retuened here. + containing the points is returned here. Returns: 0 - points are not coplanar to the specified tolerance 1 - points are coplanar to the specified tolerance @@ -884,7 +884,7 @@ int ON_ComparePointList( // returns ON_DECL bool ON_IsPointListClosed( int, // dim - bool, // true for homogeneos rational points + bool, // true for homogeneous rational points int, // count int, // stride const double* @@ -919,7 +919,7 @@ Parameters: Initial point id. Typically 1 or 0. point_ids - [out] If not null, then point_ids[] must be an array of length point_count - and the ids are retuened in this array. point_ids[0] = first_point_id. + and the ids are returned in this array. point_ids[0] = first_point_id. point_id_map - [out] If point_id_index is not null, then it must have length point_count. The returned values are a permutation of (0,1,...,point_count-1) such that @@ -1269,7 +1269,7 @@ Returns: critical, then check the solution anytime pr <= 1e-10 In general, the difference between M*X and B will be reasonably small. However, when the pr is small - there tend to be vector E, substantually different + there tend to be vector E, substantially different from zero, such that M*(X+E) - B is also reasonably small. See Also: @@ -1488,7 +1488,7 @@ Parameters: K - [out] Sectional curvature Curvature of the intersection curve of the surface and plane through the surface point where the partial - derivatives were evaluationed. + derivatives were evaluated. Returns: True if successful. False if first partials are not linearly independent, in @@ -1519,7 +1519,7 @@ ON_3dVector ON_NormalCurvature( /* Description: - Determing if two curvatures are different enough + Determine if two curvatures are different enough to qualify as a curvature discontinuity. Parameters: Km - [in] @@ -1541,7 +1541,7 @@ Parameters: curvature_tolerance - [in] If |Kp-Km| <= curvature_tolerance, then false is returned, otherwise other tests are used - to determing continuity. + to determine continuity. zero_curvature - [in] (ignored if < 2^-110 = 7.7037197787136e-34) If |K| <= zero_curvature, then K is treated as zero. When in doubt, use ON_ZERO_CURVATURE_TOLERANCE. @@ -1565,7 +1565,7 @@ Returns: True if the curvatures are different enough that the curve should be considered not G2. In addition to the tests described under the curvature_tolerance and - radius_tolerance checks, other hurestic tests are used. + radius_tolerance checks, other heuristic tests are used. */ ON_DECL bool ON_IsCurvatureDiscontinuity( @@ -1882,7 +1882,7 @@ int ON_Intersect( // 1: intersection is a single point // pointA is obtained by evaluating the line // pointB is obtained by evaluating the cylinder -// 2: 2 distincts intersection points +// 2: 2 distinct intersection points // 3: line lies on cylinder // Remarks: // The value of cylinder.IsFinite() determines if the diff --git a/opennurbs_matrix.cpp b/opennurbs_matrix.cpp index 027b29eb..cd5b28ba 100644 --- a/opennurbs_matrix.cpp +++ b/opennurbs_matrix.cpp @@ -1593,7 +1593,7 @@ unsigned int ON_RowReduce( } } - // swap columns M[jj] and M[rank] to maximum coefficeint is in M[rank][rank] + // swap columns M[jj] and M[rank] to maximum coefficient is in M[rank][rank] xx = -a[jj]; a[jj] = a[rank]; //a[rank] = -xx; // DEBUG @@ -1834,7 +1834,7 @@ unsigned int ON_GetEigenvectors( if (bLastTry) { - // For an explaination, see the code below where bLastTry is set to true. + // For an explanation, see the code below where bLastTry is set to true. break; } @@ -1922,7 +1922,7 @@ unsigned int ON_GetEigenvectors( // with respect to pivot[0], from the point of view of a // double and addition. If the entries in the matrix // are numerically reasonable for double precision - // calcualatons, then pivot[1] is a reasonable choice for + // calculations, then pivot[1] is a reasonable choice for // a zero tolerance. if (!(r1 <= tols[0])) { @@ -1930,7 +1930,7 @@ unsigned int ON_GetEigenvectors( // If r1 < tols[0](1.0e-3), there are at least 3 orders of // magnitude between the maximum pivot and pivot[1]. - // If d1 > tols[2](1.0e4) *pivots[1], pivot[1] is substantually closer to + // If d1 > tols[2](1.0e4) *pivots[1], pivot[1] is substantially closer to // zero than it is to pivot[0]. if (!(r1 <= tols[1] && d1 > tols[2]*pivots[1])) { diff --git a/opennurbs_md5.h b/opennurbs_md5.h index d0f7392f..89dd76db 100644 --- a/opennurbs_md5.h +++ b/opennurbs_md5.h @@ -237,7 +237,7 @@ public: /* Description: - Make one or more calls to AccumulateBytes() as the sequenence of bytes is available. + Make one or more calls to AccumulateBytes() as the sequence of bytes is available. Parameters: buffer - [in] sizeof_buffer - [in] @@ -261,8 +261,8 @@ public: /* Returns: - MD5 hash value of the sequenence of ByteCount() bytes that have been - passed to this ON_MD5 classe's Update() function since construction + MD5 hash value of the sequence of ByteCount() bytes that have been + passed to this ON_MD5 class's Update() function since construction or the last call to Reset(). Remarks: You may use Hash() to compute intermediate MD5 hash values. diff --git a/opennurbs_memory.h b/opennurbs_memory.h index 914d8d83..7e0e8b3f 100644 --- a/opennurbs_memory.h +++ b/opennurbs_memory.h @@ -66,7 +66,7 @@ public: The constructor saves the current state of memory allocation tracking and then enables/disables memory allocation tracking. Otherwise: - Does nothting. + Does nothing. */ ON_MemoryAllocationTracking( bool bEnableAllocationTracking @@ -77,7 +77,7 @@ public: Windows Debug Builds: The destructor restores the saved state of memory allocation tracking. Otherwise: - Does nothting. + Does nothing. */ ~ON_MemoryAllocationTracking(); diff --git a/opennurbs_memory_util.cpp b/opennurbs_memory_util.cpp index 4fb284c9..f247d540 100644 --- a/opennurbs_memory_util.cpp +++ b/opennurbs_memory_util.cpp @@ -22,7 +22,7 @@ #endif // Memory utilities used by OpenNURBS. If you are using -// custom memory managment, NOTHING in this file needs to +// custom memory management, NOTHING in this file needs to // be changed. diff --git a/opennurbs_mesh.cpp b/opennurbs_mesh.cpp index 953ed44f..18ef3a4b 100644 --- a/opennurbs_mesh.cpp +++ b/opennurbs_mesh.cpp @@ -109,7 +109,7 @@ public: // // Whenever there is a question about which values are valid, // it is assumed the m_V array is valid and the double precision - // informtion should be destroyed. + // information should be destroyed. int m_fcount = 0; // single precision vertex count int m_dcount = 0; // double precision vertex count ON__UINT32 m_fCRC = 0; // crc of float vertex array @@ -1222,11 +1222,11 @@ bool ON_Mesh::IsValid( ON_TextLog* text_logx ) const const ON_3fPoint* fV = m_V.Array(); for ( fi = 0; fi < facet_count; fi++ ) { - // This test is considered relatively harsh for float precision meshes with nearly degnerate faces + // This test is considered relatively harsh for float precision meshes with nearly degenerate faces // after they are transformed by a transform with a reasonable sized translation // component, as in https://mcneel.myjetbrains.com/youtrack/issue/RH-10177. // However, removing this creates unreasonable pressure on double precision meshes, because, after being - // trasformed to double precision, a wrongly valid single-precision-collapsed-edge mesh makes an + // transformed to double precision, a wrongly valid single-precision-collapsed-edge mesh makes an // invalid double-precision mesh altogether. This cannot be tolerated. // The goal should be to have invalid single-precision-only meshes be treated by MeshRepair when created. // See https://mcneel.myjetbrains.com/youtrack/issue/RH-54563 and @@ -2340,7 +2340,7 @@ bool ON_Mesh::Write( ON_BinaryArchive& file ) const //// This id was used in the ON_Mesh::m_mapping_id //// field to indicate the texture coordinates are the //// canonical ON_Mesh uv texture coordinates by the -//// OpenNURBS parameteric surface meshers like +//// OpenNURBS parametric surface meshers like //// ON_Surface::CreateMesh() and ON_Brep::CreateMesh(). // //// {B988A6C2-61A6-45a7-AAEE-9AED7EF4E316} @@ -2902,7 +2902,7 @@ bool ON_Mesh::Transform( const ON_Xform& xform ) { - // Tansform user data before doing sanity checks in case rogue code + // Transform user data before doing sanity checks in case rogue code // damages m_V[], m_dV[] or other data members. TransformUserData(xform); DestroyTree(); @@ -3132,7 +3132,7 @@ bool ON_Mesh::SwapCoordinates( void ON_Mesh::SetClosed(int b) { - // 6 Novermber 2003 Dale Lear - let expert user set m_mesh_is_closed + // 6 November 2003 Dale Lear - let expert user set m_mesh_is_closed char mesh_is_closed = 0; switch(b) { @@ -3212,7 +3212,7 @@ int ON_MeshIsManifold_Compare3floats( const void* a, const void* b ) continue; // neither x nor y is a nan // at least one of x and y is a nan - // use conventaion (not a nan) < (nan) because this code must use a well ordered compare for all values. + // use convention (not a nan) < (nan) because this code must use a well ordered compare for all values. if (x == x) return -1; // x is not a nan, y is a nan if (y == y) @@ -4139,7 +4139,7 @@ unsigned int ON_Mesh::AppendDuplicateVertex( /* Description: - Increases the capactiy of arrays to be at least the requested capacity. + Increases the capacity of arrays to be at least the requested capacity. Parameters: new_vertex_capacity - [in] desired capacity @@ -5918,7 +5918,7 @@ void ON_Mesh::Append( std::vector> meshes ) { if (this_mesh_mp_hash != mp_hash) { - // variable mesh paramters - means output gets none. + // variable mesh parameters - means output gets none. bSetMeshParameters = false; } } @@ -7006,7 +7006,7 @@ const bool ON_MeshParameters::TextureRangeIsValid() const void ON_MeshParameters::SetTextureRangePictureFrameHack() { - // A 2012 hack to fix cited issues. Serch for calls in core Rhino + // A 2012 hack to fix cited issues. Search for calls in core Rhino // code for comments with more details. // Fix http://mcneel.myjetbrains.com/youtrack/issue/RH-17042 // Setting mp.TextureRange() = 0 here fixes RH-17042. @@ -7850,7 +7850,7 @@ static bool Internal_MeshParametersRead_UpdateSubDParameters( /* The adaptive SubD stuff appeared in early Nov 2020. The Dec 1 2020 date gives the changes - time to work through the build and disitrubution processes. + time to work through the build and distribution processes. */ const unsigned before_adaptive_subd_display = ON_VersionNumberConstruct(7, 1, 2020, 12, 1, 0); if (archive_opennurbs_version >= before_adaptive_subd_display) @@ -7872,7 +7872,7 @@ static bool Internal_MeshParametersRead_UpdateSubDParameters( const size_t mp_count = sizeof(mp) / sizeof(mp[0]); for (size_t mp_dex = 0; mp_dex < mp_count; ++mp_dex) { - // If the only geometry setting differnce bewteen a built-in type and archive_mp + // If the only geometry setting difference between a built-in type and archive_mp // is the subd meshing parameters, update archive_mp to use the built-in's subd // meshing parameters. const ON_SubDDisplayParameters mp_subdp = mp[mp_dex].SubDDisplayParameters(); @@ -8300,7 +8300,7 @@ struct EDGEINFO // 6 = edge would be a boundary if mesh were exploded // 7 = quad would not be convex // 8 = if the edge were removed, the quad would not pass the min_diagonal_length_ratio test (not "square" enough) - // 16 = tha diagnoal is too short to remove in the first pass that makes the "obvious" quads. + // 16 = tha diagonal is too short to remove in the first pass that makes the "obvious" quads. double length; }; @@ -8519,8 +8519,8 @@ bool ON_Mesh::ConvertTrianglesToQuads( } // It is CRITICAL that the length compare use >=. - // Otherwise tesselations of equailateral triangles - // will not work right in this fuction. + // Otherwise tesselations of equilateral triangles + // will not work right in this function. fei = top.m_topf[ei.fi[1]].m_topei; if ((i != fei[0] && EI[fei[0]].length >= ei.length) || (i != fei[1] && EI[fei[1]].length >= ei.length) @@ -10154,7 +10154,7 @@ double ON_SurfaceCurvature::MaximumRadius() const } else { - // The minimum directional curvaature is in a principal curvature direction. + // The minimum directional curvature is in a principal curvature direction. k = (fabs(k1) <= fabs(k2)) ? fabs(k1) : fabs(k2); } @@ -10811,7 +10811,7 @@ bool ON_MeshTopology::IsValid() const } } - // make sure every mesh.m_V[] maps to a topoligical vertex + // make sure every mesh.m_V[] maps to a topological vertex for ( vi = 0; vi < v_count; vi++ ) { if ( vCheck[vi] != 1 ) return false; // mesh.m_V[vi] is not referenced @@ -10958,7 +10958,7 @@ void ON_MeshTopology::Dump( ON_TextLog& dump ) const dump.Print("{%g,%g,%g} ", p.x, p.y, p.z); } - // list all mesh geometry viertices that are coincident with this + // list all mesh geometry vertices that are coincident with this // topological vertex dump.Print("("); for ( j = 0; j < v.m_v_count; j++ ) { @@ -10967,7 +10967,7 @@ void ON_MeshTopology::Dump( ON_TextLog& dump ) const dump.Print("m_V[%d]",v.m_vi[j]); } - // list all toplogical edges that begin/end at this topological vertex + // list all topological edges that begin/end at this topological vertex dump.Print(") ("); for ( j = 0; j < v.m_tope_count; j++ ) { if ( j ) @@ -10981,7 +10981,7 @@ void ON_MeshTopology::Dump( ON_TextLog& dump ) const for ( ei = 0; ei < tope_count; ei++ ) { const ON_MeshTopologyEdge& e = m_tope[ei]; dump.Print("tope %d: topv%d to topvv%d (", ei, e.m_topvi[0], e.m_topvi[1] ); - // list all mesh topolical faces attached to this topolical edge + // list all mesh topological faces attached to this topological edge for ( j = 0; j < e.m_topf_count; j++ ) { if (j) dump.Print(","); @@ -11035,7 +11035,7 @@ bool ON_MeshTopology::Create() while ( 0 == b32IsValid || -1 == b32IsValid ) { - // while() is for flow control - this is a while() {... break;} statment. + // while() is for flow control - this is a while() {... break;} statement. Destroy(); b32IsValid = 0; @@ -14060,7 +14060,7 @@ void ON_Mesh::UpdateDoublePrecisionVertices() // a subset of the float precision vertices // have been modified. So, attempt to // keep the precision on double vertices - // that alread agree with the float vertices + // that already agree with the float vertices // in float precision. ON_3fPoint P; while (dV < dVend) @@ -17480,7 +17480,7 @@ unsigned int ON_Mesh::MergeFaceSets( emarks[ci.m_index] |= e_list_mark; - // add an emark to face tounching this edge + // add an emark to face touching this edge vmarks[e.m_topvi[0]] |= emark; vmarks[e.m_topvi[1]] |= emark; for (int efi = 0; efi < e.m_topf_count; ++efi) @@ -17761,7 +17761,7 @@ unsigned int ON_Mesh::MergeFaceSets( ngon_fi.Append(fi); } - // grow ngon by jumping accross edges in ci_list[] + // grow ngon by jumping across edges in ci_list[] Internal_GrowNgon( top, emarks, fmarks, e_list_mark | fmark, // etest_mask, diff --git a/opennurbs_mesh.h b/opennurbs_mesh.h index f676279e..0ba4b75a 100644 --- a/opennurbs_mesh.h +++ b/opennurbs_mesh.h @@ -275,7 +275,7 @@ public: normalized_mesh_density - [in] A double between 0.0 and 1.0 - The table below shows the correpondence between normalized_density and subd display density. + The table below shows the correspondence between normalized_density and subd display density. Mesh density percentage / normalized_mesh_density / subd display density 0% -> [0.0, ON_ZERO_TOLERANCE] -> 1 = adaptive MinimumUserInterfaceDensity @@ -288,7 +288,7 @@ public: Invalid input -> adaptive DefaultDensity; Returns: - A valid ON_SubDDisplayParameters with the specified subd display denstity. + A valid ON_SubDDisplayParameters with the specified subd display density. */ static const ON_SubDDisplayParameters CreateFromMeshDensity( double normalized_mesh_density @@ -381,7 +381,7 @@ public: /* Description: - In almast all cases, you are better off using SetAdaptiveDisplayDensity(). + In almost all cases, you are better off using SetAdaptiveDisplayDensity(). Parameters: absolute_display_density - [in] absolute_display_density <= ON_SubDDisplayParameters::MaximumDensity @@ -543,7 +543,7 @@ private: // class ON_CLASS ON_MeshParameters { - // surface meshing perameters + // surface meshing parameters public: // The Rhino legacy mesher is the mesher used in Rhino 1, 2, 3, 4, 5, 6. @@ -713,14 +713,14 @@ public: /* Description: - Mesh creationg parameters to create the default render mesh. + Mesh creation parameters to create the default render mesh. */ static const ON_MeshParameters DefaultMesh; /* Description: - Mesh creationg parameters to create the a render mesh + Mesh creation parameters to create the a render mesh when meshing speed is preferred over mesh quality. */ static @@ -728,7 +728,7 @@ public: /* Description: - Mesh creationg parameters to create the a render mesh + Mesh creation parameters to create the a render mesh when mesh quality is preferred over meshing speed. */ static @@ -736,7 +736,7 @@ public: /* Description: - Mesh creationg parameters to create the default analysis mesh. + Mesh creation parameters to create the default analysis mesh. */ static const ON_MeshParameters DefaultAnalysisMesh; @@ -764,7 +764,7 @@ public: Invalid input is treated as 0.5. Returns: - A valid ON_MeshParameters with the specified subd display denstity. + A valid ON_MeshParameters with the specified subd display density. */ static const ON_MeshParameters CreateFromMeshDensity( double normalized_mesh_density @@ -1041,7 +1041,7 @@ public: // these mesh creation parameters is enabled. // // If CustomSettingsEnabled() is false, then these mesh - // creation parameters should be gnored. + // creation parameters should be ignored. // const bool CustomSettingsEnabled() const; void SetCustomSettingsEnabled( @@ -1128,8 +1128,8 @@ public: // surfaces when the active area is a small subset of // the entire surface, there will be large regions of // unused texture space in [0,1]x[0,1]. When the 3d region - // being meshed is far from being sqaure-ish, there will be - // a substantual amount of distortion mapping [0,1]x[0,1] + // being meshed is far from being square-ish, there will be + // a substantial amount of distortion mapping [0,1]x[0,1] // texture space to the 3d mesh. // // 2: packed, scaled, normalized (default) @@ -1150,7 +1150,7 @@ public: void SetTextureRangePictureFrameHack(); // If the object being meshed is closed, m_bClosedObjectPostProcess is true, - // m_bJaggedSeams = false, and the resultig mesh is not closed, then a post meshing process + // m_bJaggedSeams = false, and the resulting mesh is not closed, then a post meshing process // is applied to find and close gaps in the mesh. Typically the resulting mesh // is not closed because the input object has a geometric flaw like loops in // trimming curves. @@ -1223,7 +1223,7 @@ public: int grid_min_count ); - // desired masimum number of quads in initial grid + // desired maximum number of quads in initial grid const int GridMaxCount() const; void SetGridMaxCount( int grid_max_count @@ -1371,7 +1371,7 @@ private: // ////////////////////////////////////////////////////////// private: - // This value is perminantly reserved for use by ON_SubD core code + // This value is permanently reserved for use by ON_SubD core code // that is part of public opennurbs. unsigned int m_subd_stuff_reserved5 = 0; @@ -2074,7 +2074,7 @@ public: unsigned int OuterBoundaryEdgeCount() const; /* - Pamameters: + Parameters: mesh_face_list - [in] ON_Mesh face list. bPermitHoles - [in] @@ -2096,7 +2096,7 @@ public: ) const; /* - Pamameters: + Parameters: mesh_face_list - [in] ON_Mesh face list. bPermitHoles - [in] @@ -2287,7 +2287,7 @@ Parameters: of the faces that form the ngon. ngon_vi - [out] An array of vertex indices that make the ngon boundary. - ngon_boundary_markers - [out] indexes into ngon_boundary_points to differiate (inner) boundaries, + ngon_boundary_markers - [out] indexes into ngon_boundary_points to differentiate (inner) boundaries, if empty there is only an outer boundary. Returns: Number of vertices in the ngon outer boundary or 0 if the input is @@ -2403,7 +2403,7 @@ Returns: ngons. Parameters: ngon_buffer - [in] - memory used to create ngon classan array with a capacity for at least 10 ON__UINT_PTR elements. + memory used to create ngon class array with a capacity for at least 10 ON__UINT_PTR elements. mesh_face_index - [in] fvi - [in] mesh face vertex indices. @@ -2783,15 +2783,15 @@ public: const ON_Mesh* m_mesh; ////////// - // number of topoligical vertices (<= m_mesh.VertexCount()) + // number of topological vertices (<= m_mesh.VertexCount()) int TopVertexCount() const; ////////// - // number of topoligical edges + // number of topological edges int TopEdgeCount() const; ////////// - // number of topoligical faces (same as m_mesh.FaceCount()) + // number of topological faces (same as m_mesh.FaceCount()) int TopFaceCount() const; class ON_MeshComponentRef MeshComponentRef( @@ -2805,7 +2805,7 @@ public: ON_COMPONENT_INDEX::TYPE::mesh_vertex or ON_COMPONENT_INDEX::TYPE::meshtop_vertex. Return: - If ci correctly identifes a mesh topology vertex, then + If ci correctly identifies a mesh topology vertex, then component index with type of ON_COMPONENT_INDEX::TYPE::meshtop_vertex is returned. Otherwise ON_COMPONENT_INDEX::UnsetComponentIndex is returned. */ @@ -3214,7 +3214,7 @@ public: ON_SurfaceCurvatureColorMapping& operator=(const ON_SurfaceCurvatureColorMapping&) = default; /// - /// Construce a ON_SurfaceCurvatureColorMapping for cnverting a specified + /// Construct a ON_SurfaceCurvatureColorMapping for converting a specified /// range of curvatures to a color. /// /// @@ -3230,7 +3230,7 @@ public: /// A kappa value k in between kappa_range[0] and kappa_range[1] /// is mapped to the saturated color with /// hue = ON_SurfaceCurvatureColorMapping::DefaultHueRangeRadians.ParameterAt(kappa_range.NormalizedParameterAt(k)). - /// Kappa values outside the kappa_range inteval are mapped to the hue + /// Kappa values outside the kappa_range interval are mapped to the hue /// assigned to the nearest end of the kappa_range interval. /// ON_SurfaceCurvatureColorMapping( @@ -3239,7 +3239,7 @@ public: ); /// - /// Construce a ON_SurfaceCurvatureColorMapping for cnverting a specified + /// Construct a ON_SurfaceCurvatureColorMapping for converting a specified /// range of curvatures to a color. /// /// @@ -3253,12 +3253,12 @@ public: /// A kappa value k in between kappa_range[0] and kappa_range[1] /// is mapped to the saturated color with /// hue = hue_range_in_radians.ParameterAt(kappa_range.NormalizedParameterAt(k)). - /// Kappa values outside the kappa_range inteval are mapped to the hue + /// Kappa values outside the kappa_range interval are mapped to the hue /// assigned to the nearest end of the kappa_range interval. /// /// /// When in doubt, pass ON_SurfaceCurvatureColorMapping::DefaultHueRangeRadians. - /// This paramter specifies the range of color hues (in radians) assigned + /// This parameter specifies the range of color hues (in radians) assigned /// to the kappa_range interval. /// This interval may be increasing or decreasing. /// @@ -3389,13 +3389,13 @@ public: ON_SurfaceDraftAngleColorMapping& operator=(const ON_SurfaceDraftAngleColorMapping&) = default; /// - /// Construce a ON_SurfaceDraftAngleColorMapping for cnverting a specified + /// Construct a ON_SurfaceDraftAngleColorMapping for converting a specified /// range of draft angles to a color. /// /// - /// Specify the up direction used to caluclate the draft angle. + /// Specify the up direction used to calculate the draft angle. /// The draft angle of a surface normal N is 0 if N is perpendicular to up, - /// pi/2 (90 degrees) if N an up piont the same direction, + /// pi/2 (90 degrees) if N an up point the same direction, /// and -pi/2 (-90 degrees) if N and up point opposite directions. /// /// @@ -3417,20 +3417,20 @@ public: ); /// - /// Construce a ON_SurfaceDraftAngleColorMapping for cnverting a specified + /// Construct a ON_SurfaceDraftAngleColorMapping for converting a specified /// range of draft angles to a color. /// /// - /// Specify the up direction used to caluclate the draft angle. + /// Specify the up direction used to calculate the draft angle. /// The draft angle of a surface normal N is 0 if N is perpendicular to up, - /// pi/2 (90 degrees) if N an up piont the same direction, + /// pi/2 (90 degrees) if N an up point the same direction, /// and -pi/2 (-90 degrees) if N and up point opposite directions. /// /// /// A range that is used to convert draft angles to colors. /// This interval may be increasing, decreasing, or a singleton. /// A draft angle equal to angle_range_in_radians[0] is mapped to - /// hue_range_in_radianss[0]. + /// hue_range_in_radians[0]. /// A draft angle equal to angle_range_in_radians[1] is mapped to /// hue_range_in_radians[1]. /// A draft angle a in between angle_range_in_radians[0] and angle_range_in_radians[1] @@ -3441,7 +3441,7 @@ public: /// /// /// When in doubt, pass ON_SurfaceDraftAngleColorMapping::DefaultHueRangeRadians. - /// This paramter specifies the range of color hues (in radians) assigned + /// This parameter specifies the range of color hues (in radians) assigned /// to the angle_range_in_radians interval. /// The hue interval may be increasing or decreasing. /// @@ -3734,7 +3734,7 @@ public: /* Description: - Increases the capactiy of arrays used to hold vertex information. + Increases the capacity of arrays used to hold vertex information. Parameters: new_vertex_capacity - [in] desired capacity @@ -4637,7 +4637,7 @@ Returns: 0: The mesh is not closed. There is at least one face with an edge that is geometrically distinct (as an unoriented line segment) from all other edges. - 1: The mesh is closed. Every geometrically distict edge is used + 1: The mesh is closed. Every geometrically distinct edge is used by two or more faces. */ void SetClosed(int closed); @@ -4818,7 +4818,7 @@ Returns: first_vid - [in] Initial vertex id. Typically 1 or 0. Vid - [out] - If not null, then Vid[] sould be an array of length VertexCount(). + If not null, then Vid[] should be an array of length VertexCount(). and the vertex ids will be stored in this array. If null, the array will be allocated by calling onmalloc(). The returned array Vid[i] is the id of the vertex m_V[i]. If m_V[i] and @@ -5175,7 +5175,7 @@ Returns: Distance to offset direction - [in] If this parameter is ON_3dVector::UnsetVector, offset each vertex in the normal direction - orherwise, offset every vertex in the input direction + otherwise, offset every vertex in the input direction Returns: New mesh that is an offset of a duplicate of this mesh Or nullptr if the input was invalid or the mesh could not be duplicated or offset @@ -5212,7 +5212,7 @@ Returns: /* Description: If you modify the values of double precision vertices, - then you must call UpdateSinglePrecisonVertices(). + then you must call UpdateSinglePrecisionVertices(). Remarks: If double precision vertices are not present, this function does nothing. @@ -5254,7 +5254,7 @@ Returns: Array of double precision vertices. If you modify the values in this array, you must make the same modifications to the single precision vertices, or call - UpdateSinglePrecisonVertices(). + UpdateSinglePrecisionVertices(). Example: // add a bunch of double precision information @@ -5266,7 +5266,7 @@ Returns: // This call updates the single precision values // in m_V[] and sets all the counts and CRCs that // are used in validity checking. - mesh.UpdateSinglePrecisonVertices(); + mesh.UpdateSinglePrecisionVertices(); Remarks: Avoid multiple calls to DoublePrecisionVertices(). @@ -5822,7 +5822,7 @@ Returns: Description: For each ngon with index in the specified range that has interior vertices, remove the interior vertices and - triangluate the ngon. + triangulate the ngon. Parameters: vertex_face_map - [in] - Pass null if you don't have one. @@ -5841,7 +5841,7 @@ Returns: Returns: true one or more vertices were removed and one or more ngons - were triangluated. This changes the mesh's vertex and face + were triangulated. This changes the mesh's vertex and face information and invalidates any input vertex_face_map. false The mesh was not modified. @@ -6049,7 +6049,7 @@ The map is an array of length m_F.Count(), ngon_map[] // Texture coordinates / surface parameters // // If m_S.Count() == m_V.Count(), then the mesh has texture - // coordinates, or it is a tessellation of a parameteric surface + // coordinates, or it is a tessellation of a parametric surface // and m_S[j] is the texture coordinate / surface parameter at // m_V[j]. // If the values in m_S are changed, then you need to call diff --git a/opennurbs_mesh_modifiers.cpp b/opennurbs_mesh_modifiers.cpp index a741f887..cb1206d0 100644 --- a/opennurbs_mesh_modifiers.cpp +++ b/opennurbs_mesh_modifiers.cpp @@ -1756,7 +1756,6 @@ public: ~CImpl(); void LoadFromXML(const ON_XMLRootNode& root); - void SaveToXML(ON_XMLRootNode& root) const; void DeleteAll(void); diff --git a/opennurbs_mesh_ngon.cpp b/opennurbs_mesh_ngon.cpp index c7dd9606..8777a7d5 100644 --- a/opennurbs_mesh_ngon.cpp +++ b/opennurbs_mesh_ngon.cpp @@ -1614,7 +1614,7 @@ void ON_Mesh::SetNgonCount( } else { - // less expensive to reacalculate map array + // less expensive to recalculate map array while ( --ngon_count0 >= ngon_count ) { if ( a[ngon_count0] ) @@ -2266,7 +2266,7 @@ class ON_V4V5_MeshNgon* ON_V4V5_MeshNgonList::V4V5_AddNgon(int N) return 0; ngon.vi = (int*)(blk + 1); ngon.fi = ngon.vi + N; - memset(ngon.vi,0xFF,(2*N)*sizeof(int)); // set all indicies to -1 + memset(ngon.vi,0xFF,(2*N)*sizeof(int)); // set all indices to -1 blk->next = m_memblk_list; m_memblk_list = blk; return &ngon; @@ -2308,13 +2308,13 @@ public: ON_V4V5_MeshNgonUserData(const ON_V4V5_MeshNgonUserData&); ON_V4V5_MeshNgonUserData& operator=(const ON_V4V5_MeshNgonUserData&); - // vitual ON_UserData override + // virtual ON_UserData override bool IsValid( class ON_TextLog* text_log = nullptr ) const override; unsigned int SizeOf() const override; bool Write(ON_BinaryArchive&) const override; bool Read(ON_BinaryArchive&) override; - // vitual ON_UserData override + // virtual ON_UserData override bool GetDescription( ON_wString& ) override; bool Archive() const override; @@ -2522,7 +2522,7 @@ bool ON_V4V5_MeshNgonUserData::Read(ON_BinaryArchive& archive) return rc; } -// vitual ON_UserData override +// virtual ON_UserData override bool ON_V4V5_MeshNgonUserData::GetDescription( ON_wString& description ) { description = L"Mesh N-gon list"; @@ -3307,7 +3307,7 @@ static bool FaceInPlane( { // Note: // This function is called only with Fvi[] lists that have been checked to - // have valid enteries. + // have valid entries. double point_buffer[3]; if ( !(fabs(e.ValueAt(vertex_list.GetPoint(Fvi[0],point_buffer))) <= planar_tolerance) ) @@ -3572,7 +3572,7 @@ static unsigned int SetFaceNeighborMap( break; } if ( 5 == nbr_face_side ) - break; // we found a neighbor and are finished seaching + break; // we found a neighbor and are finished searching } } } @@ -3708,7 +3708,7 @@ static int GetCoplanarConnectedFaces( break; } if ( 5 == nbr_face_side ) - break; // we found a neighbor and are finished seaching + break; // we found a neighbor and are finished searching } } } @@ -3764,7 +3764,7 @@ Parameters: array of length ngon_fi_count that contains the face neighbor information. ngon_nbr_map[face_index].m_NFS[j] must be zero - for open boundaryies. If the face side identified by + for open boundaries. If the face side identified by ngon_nbr_map[face_index].m_NFS[j] is assigned to an ngon boundary, then it is marked as a boundary segment. ngon_vi - [out] @@ -4463,7 +4463,7 @@ unsigned int ON_MeshNgon::FindPlanarNgons( { NgonMap.Reserve(face_count); NgonMap.SetCount(face_count); - ngonMap = NgonMap.Array(); // in case a reallocation occured. + ngonMap = NgonMap.Array(); // in case a reallocation occurred. for ( face_index = 0; face_index < face_count; face_index++ ) ngonMap[face_index] = ON_UNSET_UINT_INDEX; } diff --git a/opennurbs_mesh_tools.cpp b/opennurbs_mesh_tools.cpp index 40745597..8b08d765 100644 --- a/opennurbs_mesh_tools.cpp +++ b/opennurbs_mesh_tools.cpp @@ -537,7 +537,7 @@ bool ON_Mesh::CollapseEdge( int topei ) // Change values in mesh m_V[], m_N[] and m_T[] arrays. for ( mei = 0; mei < me_list_count; mei++ ) { - // We need to set the vertex location of all mesh vertices associated with the toplogical + // We need to set the vertex location of all mesh vertices associated with the topological // edge or we risk "tearing apart" vertexes at corners where there are more than 2 mesh vertexes // associated with the topological vertex. Don't to this for anything but the location. int i; @@ -1424,6 +1424,17 @@ int ON_Mesh::GetConnectedComponents( bool bUseVertexConnections, if (0 == pNewMesh) continue; + // Jussi, July 16 2024, RH-82825: + // Copy packed texture information so that surface paramater mapping + // can be reapplied without changing texture appearance. + pNewMesh->m_packed_tex_domain[0] = m_packed_tex_domain[0]; + pNewMesh->m_packed_tex_domain[1] = m_packed_tex_domain[1]; + pNewMesh->m_packed_tex_rotate = m_packed_tex_rotate; + pNewMesh->m_srf_domain[0] = m_srf_domain[0]; + pNewMesh->m_srf_domain[1] = m_srf_domain[1]; + pNewMesh->m_srf_scale[0] = m_srf_scale[0]; + pNewMesh->m_srf_scale[1] = m_srf_scale[1]; + ON_3dPointArray& pNewMesh_D = ( 0 != pMesh_D ) ? pNewMesh->DoublePrecisionVertices() : bogus_D; diff --git a/opennurbs_model_component.cpp b/opennurbs_model_component.cpp index 0cf5b6e6..a7379179 100644 --- a/opennurbs_model_component.cpp +++ b/opennurbs_model_component.cpp @@ -160,7 +160,7 @@ void ON_ModelComponent::Dump( if (false == text_log.IsTextHash()) { // m_runtime_serial_number depends on how many components have - // been contructed before this one. It must be suppressed when + // been constructed before this one. It must be suppressed when // calculating content hash values from text logs. text_log.Print("Model component %llu\n", m_runtime_serial_number); } @@ -179,7 +179,7 @@ void ON_ModelComponent::Dump( { text_log.Print("Reference model = %u\n", reference_model_sn); } - // linked instance defintion model + // linked instance definition model const unsigned int idef_model_sn = InstanceDefinitionModelSerialNumber(); if (idef_model_sn > 0) { @@ -291,7 +291,7 @@ static ON__UINT64 ON_ModelComponentContentVersionNumberOne( ON__UINT64 runtime_serial_number ) { - // make it unlikely for classes created sequentually to have the same content version numbers. + // make it unlikely for classes created sequentially to have the same content version numbers. ON__UINT64 s = ON_CRC32(0, sizeof(runtime_serial_number), &runtime_serial_number ); return (runtime_serial_number*0x100000000ULL | s); } @@ -1276,7 +1276,7 @@ const ON_NameHash& ON_ModelComponent::Internal_NameHash() const { if (m_component_name_hash.IsEmptyNameHash() && m_component_name.IsNotEmpty()) { - // lazy evaulation because SHA-1 calculation takes appreciable time + // lazy evaluation because SHA-1 calculation takes appreciable time // For components whose names are in a tree structure, like layers, // the parent id must be included. @@ -2280,7 +2280,7 @@ bool ON_ModelComponent::SetDeletedModelComponentState( ON_ComponentManifest* manifest ) { - bDeleted = bDeleted ? true : false; // inusre exact "true" + bDeleted = bDeleted ? true : false; // ensure exact "true" ON_ComponentStatus component_status = ModelComponentStatus(); if (bDeleted == component_status.IsDeleted()) { @@ -3199,7 +3199,7 @@ bool ON_BinaryArchive::Write3dmReferencedComponentIndex( || false == map_item.SourceIsSet() ) { - ON_ERROR("model_id not in arcive manifest map."); + ON_ERROR("model_id not in archive manifest map."); } else if (false == ReferencedComponentIndexMapping()) { @@ -3761,20 +3761,20 @@ bool ON_BinaryArchive::AddManifestMapItem( // // -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentWeakReference::ON_ModelComponentWeakReference() ON_NOEXCEPT {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentWeakReference::~ON_ModelComponentWeakReference() {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentWeakReference::ON_ModelComponentWeakReference(const ON_ModelComponentWeakReference& src) ON_NOEXCEPT : m_wp(src.m_wp) {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentWeakReference& ON_ModelComponentWeakReference::operator=(const ON_ModelComponentWeakReference& src) { if ( this != &src) @@ -3815,20 +3815,20 @@ ON_ModelComponentWeakReference& ON_ModelComponentWeakReference::operator=(const // // -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentReference::ON_ModelComponentReference() ON_NOEXCEPT {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentReference::~ON_ModelComponentReference() {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentReference::ON_ModelComponentReference(const ON_ModelComponentReference& src) ON_NOEXCEPT : m_sp(src.m_sp) {} -// Explicit implementation to insure m_sp is completely managed in the openurbs DLL. +// Explicit implementation to insure m_sp is completely managed in the opennurbs DLL. ON_ModelComponentReference& ON_ModelComponentReference::operator=(const ON_ModelComponentReference& src) { if ( this != &src) diff --git a/opennurbs_model_component.h b/opennurbs_model_component.h index 0243c889..6d397a66 100644 --- a/opennurbs_model_component.h +++ b/opennurbs_model_component.h @@ -134,7 +134,7 @@ public: Parameters: component_type - [in] Returns: - True if component's of the specified type require uniquen names. + True if component's of the specified type require unique names. Remarks: In general, component names ignore case and parent when testing for equality. @@ -186,7 +186,7 @@ public: /* Returns: - True if a componenent name can begin with the first code point. + True if a component name can begin with the first code point. Remarks: Component names cannot begin with a (, ), [, ], {, }, or space. These brackets can be the second or later code points. @@ -205,7 +205,7 @@ public: The first code point is decoded from this string and passed to ON_ModelComponent::IsValidComponentNameFirstCodePoint(). Returns: - True if a componenent name can begin with the first code point. + True if a component name can begin with the first code point. Remarks: Component names cannot begin with a (, ), [, ], {, }, or space. These brackets can be the second or later code points. @@ -533,7 +533,7 @@ public: /* Description: - Calling LockType() will prhibit future changes to the Type attribute. + Calling LockType() will prohibit future changes to the Type attribute. */ void LockComponentType(); @@ -614,7 +614,7 @@ public: /* Description: - Calling LockModelComponentId() will prhibit future changes to the ModelComponentId attribute. + Calling LockModelComponentId() will prohibit future changes to the ModelComponentId attribute. */ void LockId(); @@ -647,7 +647,7 @@ public: of identical type in the model and is locked. If the index has not been set, ON_UNSET_INT_INDEX is returned. The Index() value can change when saved in an archive (.3dm file). - Use the Id() when you need to reference model compoenents in an archive. + Use the Id() when you need to reference model components in an archive. */ int Index() const; @@ -689,7 +689,7 @@ public: /* Description: - Calling LockModelComponentIndex() will prhibit future changes to the ModelComponentIndex attribute. + Calling LockModelComponentIndex() will prohibit future changes to the ModelComponentIndex attribute. */ void LockIndex(); @@ -866,7 +866,7 @@ public: and linked block "Z" referencing D.3dm. File D.3dm contains a layer "delta", dimstyle "d1", and an embedded block "D_blk". - Reading file A.3dm will craete the following components: + Reading file A.3dm will create the following components: Layers: alpha X>B.3dm @@ -911,7 +911,7 @@ public: and linked block "Z" referencing D.3dm. File D.3dm contains a layer "delta", dimstyle "d1", and an embedded block "D_blk". - Reading file A.3dm will craete the following components: + Reading file A.3dm will create the following components: Layers: alpha X>B.3dm @@ -1147,7 +1147,7 @@ public: can possibly call SetName() or the ON_ModelComponent destructor could be called. Remarks: - About the only good use for this function is when a model compoenent is + About the only good use for this function is when a model component is persistent and the name is needed for a formatted string. For any other use, call the Name() function and store the result in an ON_wString. This function is dangerous because the returned pointer @@ -1238,7 +1238,7 @@ public: /* Description: - If NameIsSet() is true, then the name is deleted in a waty that can be undone by calling UndeleteName() and + If NameIsSet() is true, then the name is deleted in a way that can be undone by calling UndeleteName() and the DeletedNameIsSet() property is changed to true. If NameIsSet() is false or NameIsLocked() is true, then nothing is changed. @@ -1421,7 +1421,7 @@ public: Returns: True if this model component is a system constant. Remarks: - An incomplete list of system constant model compoenents is below: + An incomplete list of system constant model components is below: ON_ModelComponent::Unset @@ -1735,7 +1735,7 @@ public: Decrements the iterator and returns the new type. Returns: The new type - ON_ModelComponent::Type::Unset if the iterator is decrented the first type. + ON_ModelComponent::Type::Unset if the iterator is decremented the first type. */ ON_ModelComponent::Type PreviousType(); @@ -1750,7 +1750,7 @@ public: private: ON__INT32 m_type_count = 0; - // -1 iterated before first, m_type_count = iteratated past last + // -1 iterated before first, m_type_count = iterated past last ON__INT32 m_current_index = ON_UNSET_UINT_INDEX; ON_ModelComponent::Type m_types[32]; @@ -1766,11 +1766,11 @@ class ON_CLASS ON_ModelComponentReference public: static const ON_ModelComponentReference Empty; - // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentReference() ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the openurbs DLL. - ~ON_ModelComponentReference(); // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentReference(const ON_ModelComponentReference&) ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentReference& operator=(const ON_ModelComponentReference&); // No = default to insure m_sp is completely managed in the openurbs DLL. + // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentReference() ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the opennurbs DLL. + ~ON_ModelComponentReference(); // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentReference(const ON_ModelComponentReference&) ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentReference& operator=(const ON_ModelComponentReference&); // No = default to insure m_sp is completely managed in the opennurbs DLL. #if defined(ON_HAS_RVALUEREF) ON_ModelComponentReference( ON_ModelComponentReference&& ) ON_NOEXCEPT; @@ -1847,7 +1847,7 @@ public: ONX_Model::ComponentFromRuntimeSerialNumber() Remarks: If .NET or other wrappers using "lazy garbage collection" memory management are in use, - there may be stale references awaiting gargage collection and this function will return + there may be stale references awaiting garbage collection and this function will return nullptr when you think it should not. For this function to work reliably, the ONX_Model and its components and references should be in well constructed C++ code with carefully @@ -1894,11 +1894,11 @@ public: static const ON_ModelComponentWeakReference Empty; public: - // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentWeakReference() ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the openurbs DLL. - ~ON_ModelComponentWeakReference(); // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentWeakReference(const ON_ModelComponentWeakReference&) ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the openurbs DLL. - ON_ModelComponentWeakReference& operator=(const ON_ModelComponentWeakReference&); // No = default to insure m_sp is completely managed in the openurbs DLL. + // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentWeakReference() ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the opennurbs DLL. + ~ON_ModelComponentWeakReference(); // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentWeakReference(const ON_ModelComponentWeakReference&) ON_NOEXCEPT; // No = default to insure m_sp is completely managed in the opennurbs DLL. + ON_ModelComponentWeakReference& operator=(const ON_ModelComponentWeakReference&); // No = default to insure m_sp is completely managed in the opennurbs DLL. #if defined(ON_HAS_RVALUEREF) ON_ModelComponentWeakReference( ON_ModelComponentWeakReference&& ) ON_NOEXCEPT; diff --git a/opennurbs_model_geometry.cpp b/opennurbs_model_geometry.cpp index 26d516d0..d15acef8 100644 --- a/opennurbs_model_geometry.cpp +++ b/opennurbs_model_geometry.cpp @@ -128,7 +128,7 @@ ON_ModelGeometryComponent::ON_ModelGeometryComponent( ON_ModelComponent::Type ty ON_ModelGeometryComponent::~ON_ModelGeometryComponent() { - // This destructor is explictily implemented to insure m_geometry_sp + // This destructor is explicitly implemented to insure m_geometry_sp // and m_attributes_sp are destroyed by the same c-runtime // that creates them. } diff --git a/opennurbs_msbuild.Cpp.props b/opennurbs_msbuild.Cpp.props index 2825a4ee..d8442deb 100644 --- a/opennurbs_msbuild.Cpp.props +++ b/opennurbs_msbuild.Cpp.props @@ -14,7 +14,7 @@ This file defines the MSBuild properties: The full path to the directory where the final build results (.exe, .dll, .pdb, .lib, ... files) are delivered. -Every build conguration of every opennurbs component should have this +Every build configuration of every opennurbs component should have this property sheet as the first property sheet after the Microsoft boiler plate. ******************************************************************************* @@ -75,7 +75,7 @@ property sheet as the first property sheet after the Microsoft boiler plate. diff --git a/opennurbs_nurbscurve.cpp b/opennurbs_nurbscurve.cpp index 81619b1c..ce54c37d 100644 --- a/opennurbs_nurbscurve.cpp +++ b/opennurbs_nurbscurve.cpp @@ -691,7 +691,7 @@ bool ON_NurbsCurve::IsValid( ON_TextLog* text_log ) const { // fix for RR 21239 // 16 November 2010 Chuck and Dale Lear added m_dim <= 3 - // so the 3d checking does not interfer with applications + // so the 3d checking does not interfere with applications // that use high dimension curves where the start and end // points can be arbitrary. ON_3dPoint P0 = PointAtStart(); @@ -1583,10 +1583,10 @@ ON_NurbsCurve::Evaluate( // returns false if unable to evaluate if ( -2 == side || 2 == side ) { // 9 November 2010 Dale Lear - ON_TuneupEvaluationParameter fix - // When evluation passes through ON_CurveProxy or ON_PolyCurve reparamterization + // When evaluation passes through ON_CurveProxy or ON_PolyCurve reparamterization // and the original side parameter was -1 or +1, it is changed to -2 or +2 - // to indicate that if t is numerically closed to an end paramter, then - // it should be tuned up to be at the end paramter. + // to indicate that if t is numerically closed to an end parameter, then + // it should be tuned up to be at the end parameter. double a = t; if ( ON_TuneupEvaluationParameter( side, m_knot[span_index+m_order-2], m_knot[span_index+m_order-1], &a) ) { @@ -1691,7 +1691,7 @@ bool ON_IsG2CurvatureContinuous( } else { - cos_Kangle_tolerance = 2.0*cos_Kangle_tolerance*cos_Kangle_tolerance - 1.0; // = cos(2*tangent_angle_tolerace) + cos_Kangle_tolerance = 2.0*cos_Kangle_tolerance*cos_Kangle_tolerance - 1.0; // = cos(2*tangent_angle_tolerance) if ( cos_angle_tolerance >= 0.0 && cos_Kangle_tolerance < 0.0 ) cos_Kangle_tolerance = 0.0; } @@ -2964,7 +2964,7 @@ bool TweakSplitTrimParameter(double k0, double k1, double& t ) // // 2014-July-7 Dale Lear // Fix RH-21610 (k0 = 5e6, k1 = k0 + 1, t = k1 - 0.2) - // I changed the test Lowell referes to above. Lowell's 4.0*ON_SQRT_EPSILON + // I changed the test Lowell refers to above. Lowell's 4.0*ON_SQRT_EPSILON // is now 8.0*ON_EPSILON in the ktol2 initialization value. // I added ktol1 base on the span length. // If you modify this code in the future, please reference a bug with sample @@ -2999,7 +2999,7 @@ bool ON_NurbsCurve::Trim( const ON_Interval& in ) int ki, side, i0, i1, i1_max, new_cv_count; //Greg Arden 28 April 2003. Do not change any curve that is trimmed to its entire domain. - // This is especiallly important for periodic curves. + // This is especially important for periodic curves. if(in==Domain()) return true; @@ -3601,7 +3601,7 @@ double ON_NurbsSurface::GetCubicBezierApproximation( // uv[4] = {{1/3,1/3}, {2/3,1/3}, {1/3,2/3}, {2/3,2/3} } // K[n] = (27*27)*bezCV(uv[n]) - // P[n] = this(domain.ParamaterAt(uv[n])); + // P[n] = this(domain.ParameterAt(uv[n])); // 36* M * Transpose[C11,C21,C12,C22] = [X0,X1,X2,X3] // uv[4] = {{1/3,1/3{, {2/3,1/3}, {1/3,2/3}, {2/3,2/3} } // X0 = nurbs_srf(1/3,1/3) - K[0]/(27*27) @@ -4108,12 +4108,6 @@ bool ON_ChangeRationalNurbsCurveEndWeights( return true; } -double ON_Fuzz( double x, double absolute_tolerance ) -{ - double fuzz = fabs(x)*ON_RELATIVE_TOLERANCE; - return(fuzz > absolute_tolerance) ? fuzz : absolute_tolerance; -} - bool ON_NurbsCurve::SpanIsSingular( int span_index ) const diff --git a/opennurbs_nurbscurve.h b/opennurbs_nurbscurve.h index 35d19774..b73e9309 100644 --- a/opennurbs_nurbscurve.h +++ b/opennurbs_nurbscurve.h @@ -298,7 +298,7 @@ public: // Returns: // Number of nonempty smooth (c-infinity) spans. // Remarks: - // A nonempty span is bracked by knots m_knot[i] < m_knot[i+1] + // A nonempty span is bracketed by knots m_knot[i] < m_knot[i+1] // with m_order-2 <= i < m_cv_count-1. int SpanCount() const override; @@ -397,9 +397,9 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature discontinuity. + Search for a derivative, tangent, or curvature discontinuity. Parameters: - c - [in] type of continity to test for. If ON::continuity::C1_continuous + c - [in] type of continuity to test for. If ON::continuity::C1_continuous t0 - [in] search begins at t0 t1 - [in] (t0 < t1) search ends at t1 t - [out] if a discontinuity is found, the *t reports the @@ -528,7 +528,7 @@ public: // Description: // virtual ON_Curve::Reverse override. - // Reverse parameterizatrion by negating all knots + // Reverse parameterization by negating all knots // and reversing the order of the control vertices. // Remarks: // Domain changes from [a,b] to [-b,-a] @@ -560,7 +560,7 @@ public: distance tolerance to use when checking control points between the span ends Returns - true if the span is a non-degenrate line. This means: + true if the span is a non-degenerate line. This means: - dimension = 2 or 3 - There are full multiplicity knots at each end of the span. - The length of the the line segment from the span's initial @@ -587,12 +587,12 @@ public: /* Description: Looks for problems caused by knots that are close together - or have mulitplicity >= order. If bRepair is true, the problems + or have multiplicity >= order. If bRepair is true, the problems are fixed. Does not change the domain. Parameters: knot_tolerance - [in] >= 0 When in doubt, use zero. bRepair - [in] If true, then problems are repaired. - Otherwise this function looks for problemsn that + Otherwise this function looks for problems that can be repaired, but does not modify the curve. Returns: True if bad knots were found and can be repaired. @@ -649,7 +649,7 @@ public: int GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the curve's to wthe desired accuracy + // matches the curve's to the desired accuracy // 2: success - returned NURBS point locus matches // the curve's to the desired accuracy but, on // the interior of the curve's domain, the @@ -666,7 +666,7 @@ public: int HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the curve's to wthe desired accuracy + // matches the curve's to the desired accuracy // 2: success - returned NURBS point locus matches // the curve's to the desired accuracy but, on // the interior of the curve's domain, the @@ -764,7 +764,7 @@ public: Pointer to control vertex. Remarks: If the NURBS curve is rational, the format of the - returned array is a homogeneos rational point with + returned array is a homogeneous rational point with length m_dim+1. If the NURBS curve is not rational, the format of the returned array is a nonrational euclidean point with length m_dim. @@ -1127,8 +1127,8 @@ public: True if the span was successfully removed. Remarks: The NURBS curve must have 2 or more spans (m_cv_count > m_order). - Set m0 = mulitiplicity of the knot at m_knot[span_index+m_order-2] - and m1 = mulitiplicity of the knot at m_knot[span_index+m_order-1]. + Set m0 = multiplicity of the knot at m_knot[span_index+m_order-2] + and m1 = multiplicity of the knot at m_knot[span_index+m_order-1]. If (m0 + m1) < degree, then the degree-(m0+m1) cvs will be added to the NURBS curve. If (m0+m1) > degree, then (m0+m1)-degree cvs will be removed from the curve. diff --git a/opennurbs_nurbssurface.cpp b/opennurbs_nurbssurface.cpp index c9cf67ed..70c3769a 100644 --- a/opennurbs_nurbssurface.cpp +++ b/opennurbs_nurbssurface.cpp @@ -1229,7 +1229,7 @@ int ON_NurbsSurface::HasNurbForm() const return 1; } -// virutal ON_Surface::GetNurbForm() override +// virtual ON_Surface::GetNurbForm() override int ON_NurbsSurface::GetNurbForm( ON_NurbsSurface& srf, double // tolerance diff --git a/opennurbs_nurbssurface.h b/opennurbs_nurbssurface.h index 7b2674b6..3977e4cc 100644 --- a/opennurbs_nurbssurface.h +++ b/opennurbs_nurbssurface.h @@ -361,12 +361,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -716,7 +716,7 @@ public: Pointer to control vertex. Remarks: If the NURBS surface is rational, the format of the - returned array is a homogeneos rational point with + returned array is a homogeneous rational point with length m_dim+1. If the NURBS surface is not rational, the format of the returned array is a nonrational euclidean point with length m_dim. @@ -1077,7 +1077,7 @@ public: GridPoints - [in] Grid of points to interpolate. u_Tangents - [in] Grid of Tangent directions ( actually first derivatives) to interpolate. v_Tangents - [in] Grid of Tangent directions ( actually first derivatives) to interpolate. - TwistVectors - [in] Grid of twist vectors (mixed second partial derovative) to interpolate. + TwistVectors - [in] Grid of twist vectors (mixed second partial derivative) to interpolate. hermite_surface -[in] optional existing ON_NurbsSurface returned here. Returns: @@ -1561,7 +1561,7 @@ public: /* Description: - Evaluates bezer volume map. + Evaluates bezier volume map. Parameters: rst - [in] Returns: @@ -1591,7 +1591,7 @@ public: /* Description: - Evaluates bezer volume map. + Evaluates bezier volume map. Parameters: rst - [in] Returns: @@ -1648,7 +1648,7 @@ public: Pointer to control vertex. Remarks: If the Nurbs surface is rational, the format of the - returned array is a homogeneos rational point with + returned array is a homogeneous rational point with length m_dim+1. If the Nurbs surface is not rational, the format of the returned array is a nonrational euclidean point with length m_dim. diff --git a/opennurbs_object.cpp b/opennurbs_object.cpp index b6598b0c..6cf39001 100644 --- a/opennurbs_object.cpp +++ b/opennurbs_object.cpp @@ -102,10 +102,10 @@ static int ON__isnand(const double* x) } else { - // This sitation is not handled by this algorithm + // This situation is not handled by this algorithm // and that is a bug in the algorithm. ON_ERROR("Unexpected bit pattern in double 2.0."); - // assum little endian doubles + // assume little endian doubles b7 = 7; b6 = 6; } @@ -177,7 +177,7 @@ static int ON__isnanf(const float* x) } else { - // This sitation is not handled by this algorithm + // This situation is not handled by this algorithm // and that is a bug in the algorithm. ON_ERROR("Unexpected bit pattern in float 2.0f."); // assume little endian floats @@ -288,7 +288,7 @@ void ON_DBL_SNAN( double* x) // must use memcpy(). On Intel FPU, assignment using x = u.x - // will set x to qnan and invalid op exception occures. + // will set x to qnan and invalid op exception occurs. memcpy(x,&u.x,sizeof(*x)); } @@ -344,7 +344,7 @@ void ON_FLT_SNAN( float* x) #endif // must use memcpy(). On Intel FPU, assignment using x = u.x - // will set x to qnan and invalid op exception occures. + // will set x to qnan and invalid op exception occurs. memcpy(x,&u.x,sizeof(*x)); } @@ -842,7 +842,7 @@ ON_UUID ON_GetMostRecentClassIdCreateUuid() ON_Object* ON_ClassId::Create() const { // Save the uuid so that Rhino's .NET SDK - // can create approprate class. The C++ + // can create appropriate class. The C++ // opennurbs toolkit never uses this value. s_most_recent_class_id_create_uuid = m_uuid; return m_create ? m_create() : 0; @@ -1785,7 +1785,7 @@ bool ON_Object::ThisIsNullptr( bool bSilentError ) const { - // CLang warns that these tests may be ommitted because in "well-defined C++ code" + // CLang warns that these tests may be omitted because in "well-defined C++ code" // they are always false. // // Earth to CLang: diff --git a/opennurbs_object.h b/opennurbs_object.h index fb56cf2c..2ea69e5b 100644 --- a/opennurbs_object.h +++ b/opennurbs_object.h @@ -262,7 +262,7 @@ ON_UUID ON_GetMostRecentClassIdCreateUuid(); All classes derived from ON_Object must have the declaration macro ON_OBJECT_DECLARE( ); as the first line in their class definition, must have a robust -operator=(), should have a robust copy constructory, and must +operator=(), should have a robust copy constructor, and must have exactly one of the following implementation macros in a .cpp file. Classes with a pure virtual function: @@ -523,8 +523,8 @@ public: initialized. Parameters: text_log - [in] if the object is not valid and text_log - is not nullptr, then a brief englis description of the - reason the object is not valid is appened to the log. + is not nullptr, then a brief english description of the + reason the object is not valid is appended to the log. The information appended to text_log is suitable for low-level debugging purposes by programmers and is not intended to be useful as a high level user @@ -669,7 +669,7 @@ public: ON_Material.m_material_id, ON_3dmObjectAttributes.m_uuid ). Returns: - The id used to identify the object in the openurbs model. + The id used to identify the object in the opennurbs model. */ virtual ON_UUID ModelObjectId() const; @@ -995,7 +995,7 @@ public: // // Component status interface // - // Currently implemnented on ON_SubD and ON_Brep + // Currently implemented on ON_SubD and ON_Brep // /* @@ -1106,7 +1106,7 @@ public: Call whenever a component status setting is modified by directly changing it on a component in a way that will result in any saved information about the parent - object's aggretate component status becoming invalid. + object's aggregate component status becoming invalid. Returns: Aggregate information about the object's component states. @@ -1123,7 +1123,7 @@ public: Call whenever a component status setting is modified by directly changing it on a component in a way that will result in any saved information about the parent - object's aggretate component status becoming invalid. + object's aggregate component status becoming invalid. Remarks: The implementations of this function are nearly instant. diff --git a/opennurbs_object_history.cpp b/opennurbs_object_history.cpp index ffea25cd..bdf6bbc9 100644 --- a/opennurbs_object_history.cpp +++ b/opennurbs_object_history.cpp @@ -2140,7 +2140,7 @@ bool ON_HistoryRecord::SetSubDEdgeChainValues(int value_id, const ON_SimpleArray return false; const ON_UUID parent_subd_id = c->PersistentSubDId(); if (ON_nil_uuid == parent_subd_id) - return false; // a persistent id is reqiured so that update history can find the new subd and update the runtime ON_SubDEdgePtr values. + return false; // a persistent id is required so that update history can find the new subd and update the runtime ON_SubDEdgePtr values. if (c->EdgeCount() <= 0) return false; if (false == c->HasPersistentEdgeIds()) @@ -2596,7 +2596,7 @@ void ON_HistoryRecord::Dump( ON_TextLog& text_log ) const (m_record_type == ON_HistoryRecord::RECORD_TYPE::feature_parameters) ? "feature parameters" : "history parameters"); - // list antededents + // list antecedents uuid_list.SetCount(0); m_antecedents.GetUuids(uuid_list); count = uuid_list.Count(); @@ -2700,7 +2700,7 @@ bool ON_HistoryRecord::Internal_ReadV5( ON_BinaryArchive& archive ) // 16 October 2012 Dale Lear // Fixing http://dev.mcneel.com/bugtrack/?q=101403 - // Changing bSortDescendantsAferRead from true to false + // Changing bSortDescendantsAfterRead from true to false // per discussion in the bug report. const bool bSortDescendantsAferRead = false; rc = m_descendants.Read(archive,bSortDescendantsAferRead); @@ -2806,7 +2806,7 @@ bool ON_HistoryRecord::Write(ON_BinaryArchive& archive) const bool ON_HistoryRecord::Internal_WriteV5( ON_BinaryArchive& archive ) const { // 2015-06-01 Dale Lear - // Save m_bCopyOnReplaceObject in the file in chunck version 1.2 + // Save m_bCopyOnReplaceObject in the file in chunk version 1.2 const int minor_version = (archive.Archive3dmVersion() >= 60) diff --git a/opennurbs_objref.cpp b/opennurbs_objref.cpp index eb333aa4..1d403d5d 100644 --- a/opennurbs_objref.cpp +++ b/opennurbs_objref.cpp @@ -1186,6 +1186,41 @@ bool ON_ObjRef::SetParentIRef( const ON_InstanceRef& iref, return false; } + // 24 June 2024, Mikko, RH-82669: + // Flip brep/mesh/SubD if the xform is orientation reversing. + if (-1 == iref.m_xform.IsSimilarity()) + { + switch (proxy_geo->ObjectType()) + { + case ON::object_type::brep_object: + { + ON_Brep* brep = ON_Brep::Cast(proxy_geo); + if (0 != brep) + brep->Flip(); + } + break; + + case ON::object_type::mesh_object: + { + ON_Mesh* mesh = ON_Mesh::Cast(proxy_geo); + if (0 != mesh) + mesh->Flip(); + } + break; + + case ON::object_type::subd_object: + { + ON_SubD* subd = ON_SubD::Cast(proxy_geo); + if (0 != subd) + subd->ReverseOrientation(); + } + break; + + default: + break; + } + } + // 13 July 2011 - Part of the fix for bug 87827 // was to put the m_geometry and m_parent_geometry // assignments after the call to SetProxy() which diff --git a/opennurbs_offsetsurface.h b/opennurbs_offsetsurface.h index 72f62405..b4e8a6b4 100644 --- a/opennurbs_offsetsurface.h +++ b/opennurbs_offsetsurface.h @@ -138,7 +138,7 @@ public: /* Description: Sets the offset distance at a point. Call this function - once for each point wher the user specifies an offset. + once for each point where the user specifies an offset. Parameters: s - [in] t - [in] (s,t) is a base surface evaluation parameter diff --git a/opennurbs_optimize.cpp b/opennurbs_optimize.cpp index 648cbe2b..02641478 100644 --- a/opennurbs_optimize.cpp +++ b/opennurbs_optimize.cpp @@ -288,7 +288,7 @@ ON_LocalZero1::BracketSpan( double s0, double f0, double s1, double f1 ) i0++; if ( i0 <= i1 ) { // we have s0 < m_k[i0] <= ... <= m_k[i1] < s1 - Evaluate( m_k[i0], &fm, nullptr,-1 ); // gaurd against C0 discontinuities + Evaluate( m_k[i0], &fm, nullptr,-1 ); // guard against C0 discontinuities Evaluate( m_k[i0], &fp, nullptr, 1 ); if ( (f0 <= 0.0 && fm >= 0.0) || (f0 >= 0.0 && fm <= 0.0) ) { m_s1 = m_k[i0]; @@ -577,7 +577,7 @@ bool ON_LocalZero1::NewtonRaphson( double s0, double f0, if ( fabs(s1-s0) <= m_t_tolerance ) { // a root has been bracketed to an interval that is small enough - // to satisify user. + // to satisfy user. *t = (fabs(f0) <= fabs(f1)) ? s0 : s1; return true; } diff --git a/opennurbs_parse.h b/opennurbs_parse.h index c0f05b89..44eafed8 100644 --- a/opennurbs_parse.h +++ b/opennurbs_parse.h @@ -792,7 +792,7 @@ public: /* Returns: - True if a aritimetic should be parsed in expressions. + True if a arithmetic should be parsed in expressions. Example: If parsing expression arithmetic is enabled, then the string "3/0.25" will return a value of 12. @@ -904,7 +904,7 @@ public: /* Returns: True if a number may use scientific E notation to specify - mulitiplication by a power of 10. + multiplication by a power of 10. Example: If parsing scientific E notation is enables, then the string "2.99792458e8" will be parsed as 2999792458. @@ -920,7 +920,7 @@ public: /* Returns: True if a number may use scientific E notation may use - 'D' or 'E' to specify mulitiplication by a power of 10. + 'D' or 'E' to specify multiplication by a power of 10. Example: If parsing 'D' as 'E' in scientific E notation is enabled, then the string "2.99792458D8" will be parsed as 2999792458. @@ -1113,7 +1113,7 @@ public: - The numerator and denominator must be integers. - Strings like "1.0/3.0", "3.5/2" or "pi/2" are not parsed as rational numbers. Use ON_ParseSettings::ParseDivision - to constrol parsing of these types of strings. + to control parsing of these types of strings. */ bool ParseRationalNumber() const; @@ -1140,7 +1140,7 @@ public: /* Returns: - True if muliplication signs that appear between numbers will be + True if multiplication signs that appear between numbers will be parsed. Example: If this property is true, then strings like 2*3 will be parsed @@ -1201,7 +1201,7 @@ public: /* Returns: - True if paired arentheses symbols that are encountered during + True if paired parentheses symbols that are encountered during number parsing will be parsed. Example: If this property is true, then strings like 2(3+4) will be parsed @@ -1405,7 +1405,7 @@ public: Parameters: c - [in] Returns: - Returns '0' throught '9' if c is a digit, otherwise returns 0. + Returns '0' through '9' if c is a digit, otherwise returns 0. */ char IsDigit(ON__UINT32 c) const; @@ -1712,7 +1712,7 @@ public: /* Parameters: bParseMultiplication - [in] - True if muiltiplication should be permitted in number parsing. + True if multiplication should be permitted in number parsing. Remarks: See ON_ParseSettings::ParseMultiplication() for details about this property. diff --git a/opennurbs_parse_number.cpp b/opennurbs_parse_number.cpp index d11a3441..559f57d4 100644 --- a/opennurbs_parse_number.cpp +++ b/opennurbs_parse_number.cpp @@ -1058,7 +1058,7 @@ int ON_ParseNumberExpression( ) { // Please discuss changes with Dale Lear. - // Do not make this funtion recursive. + // Do not make this function recursive. // This function support parsing limited arithmetic expressions. ON_ParseSettings input_parse_settings(parse_settings); @@ -1789,7 +1789,7 @@ int ON_ParseAngleExpression( if ( ON::AngleUnitSystem::None == angle_us ) { // Surveyor's notation implies degrees when no angle unit - // is explictly supplied. This is done because it is + // is explicitly supplied. This is done because it is // difficult for many users to enter a degree symbol // when typing input and Surveyor's notation is almost // always in degrees. [TODO cite reference]. @@ -1798,7 +1798,7 @@ int ON_ParseAngleExpression( // The value of right_angle is calculated this way because it will // yield the most precise result in all angle unit systems since - // IEEE double muliplication by 0.25 is exact and the value + // IEEE double multiplication by 0.25 is exact and the value // returned by ON::AngleUnitScale(ON::turns,angle_us) is exact // for all supported angle units except radians where pi rounded // because the IEEE double must approximate the value of pi. diff --git a/opennurbs_parse_settings.cpp b/opennurbs_parse_settings.cpp index 340383ab..1e82ab0e 100644 --- a/opennurbs_parse_settings.cpp +++ b/opennurbs_parse_settings.cpp @@ -220,7 +220,7 @@ ON_ParseSettings& ON_ParseSettings::operator|=(const ON_ParseSettings& other) if (0 == m_context_length_unit_system) { - // "this" wins if it alread has a locale id. + // "this" wins if it already has a locale id. // The reason is that the |= operator is used to add // a property to "this" when its current // property has a "false" value. @@ -229,7 +229,7 @@ ON_ParseSettings& ON_ParseSettings::operator|=(const ON_ParseSettings& other) if (0 == m_context_angle_unit_system) { - // "this" wins if it alread has a locale id. + // "this" wins if it already has a locale id. // The reason is that the |= operator is used to add // a property to "this" when its current // property has a "false" value. @@ -238,7 +238,7 @@ ON_ParseSettings& ON_ParseSettings::operator|=(const ON_ParseSettings& other) if (0 == m_context_locale_id) { - // "this" wins if it alread has a locale id. + // "this" wins if it already has a locale id. // The reason is that the |= operator is used to add // a property to "this" when its current // property has a "false" value. @@ -271,7 +271,7 @@ ON_ParseSettings& ON_ParseSettings::operator&=(const ON_ParseSettings& other) if ( m_context_locale_id != other.m_context_locale_id ) { // If m_context_locale_id != other.m_context_locale_id - // identify the same language, then preserve the lauguage. + // identify the same language, then preserve the language. // This is useful when parsing unit names, particularly in // English where en-US SI unit names end in "er" and many // other en-* SI unit names end in "re". Setting @@ -1204,7 +1204,7 @@ bool ON_ParseSettings::IsDigitSeparator(ON__UINT32 c) const break; case 0x066C: // UNICODE ARABIC THOUSANDS SEPARATOR - // Intended to be used with eastern arabic numerials, + // Intended to be used with eastern arabic numerals, // but its lexical function is always a thousands separator. return false; break; @@ -1233,7 +1233,7 @@ bool ON_ParseSettings::IsDecimalPoint(ON__UINT32 c) const break; case 0x066B: // UNICODE ARABIC DECIMAL SEPARATOR - // Intended to be used with eastern arabic numerials, + // Intended to be used with eastern arabic numerals, // but its lexical function is always a decimal point. return true; break; diff --git a/opennurbs_photogrammetry.cpp b/opennurbs_photogrammetry.cpp index 662e6861..c10aeabb 100644 --- a/opennurbs_photogrammetry.cpp +++ b/opennurbs_photogrammetry.cpp @@ -419,7 +419,7 @@ Parameters: world coordinate unit vector in the camera up direction. = OrientationRotation * (0,1,0) camera_Z - [out] - world coordinate unit vector pointing into the cameara (from the + world coordinate unit vector pointing into the camera (from the image toward the camera). = OrientationRotation * (0,0,1) */ diff --git a/opennurbs_photogrammetry.h b/opennurbs_photogrammetry.h index b286676a..e1306d76 100644 --- a/opennurbs_photogrammetry.h +++ b/opennurbs_photogrammetry.h @@ -117,7 +117,7 @@ public: camera_Y - [out] world coordinate unit vector in the camera up direction. camera_Z - [out] - world coordinate unit vector pointing into the cameara (from the + world coordinate unit vector pointing into the camera (from the image toward the camera). */ bool GetOrientationFrame( diff --git a/opennurbs_plane.cpp b/opennurbs_plane.cpp index 5fcb3f52..2adcfe2a 100644 --- a/opennurbs_plane.cpp +++ b/opennurbs_plane.cpp @@ -430,7 +430,7 @@ bool ON_Plane::Transform( const ON_Xform& xform ) ON_3dPoint origin_pt = xform*origin; - // use care tranforming vectors to get + // use care transforming vectors to get // maximum precision and the right answer bool bUseVectorXform = ( 0.0 == xform.m_xform[3][0] && 0.0 == xform.m_xform[3][1] diff --git a/opennurbs_plane.h b/opennurbs_plane.h index 9cc3755a..dccb78f9 100644 --- a/opennurbs_plane.h +++ b/opennurbs_plane.h @@ -34,7 +34,7 @@ public: normal - [in] non-zero normal to the plane Remarks: origin = point, zaxis = unitized normal, xaxis - xaxis set with xaxis.PerpindicularTo(zaxis). + xaxis set with xaxis.PerpendicularTo(zaxis). See Also: ON_Plane::CreateFromNormal */ @@ -109,7 +109,7 @@ public: normal - [in] non-zero normal to the plane Remarks: origin = point, zaxis = unitized normal, xaxis - xaxis set with xaxis.PerpindicularTo(zaxis). + xaxis set with xaxis.PerpendicularTo(zaxis). Returns: true if valid plane is created. See Also: diff --git a/opennurbs_planesurface.cpp b/opennurbs_planesurface.cpp index 42abe7d7..803cc544 100644 --- a/opennurbs_planesurface.cpp +++ b/opennurbs_planesurface.cpp @@ -530,7 +530,7 @@ bool ON_PlaneSurface::Split( 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 + // matches the surface's to the 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 @@ -589,7 +589,7 @@ int ON_PlaneSurface::HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 diff --git a/opennurbs_planesurface.h b/opennurbs_planesurface.h index 7c9ea1e7..efbea5f9 100644 --- a/opennurbs_planesurface.h +++ b/opennurbs_planesurface.h @@ -185,12 +185,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -286,7 +286,7 @@ public: double curvature_tolerance=ON_SQRT_EPSILON ) const override; - bool Reverse( // reverse parameterizatrion, Domain changes from [a,b] to [-b,-a] + bool Reverse( // reverse parameterization, Domain changes from [a,b] to [-b,-a] int // dir 0 = "s", 1 = "t" ) override; diff --git a/opennurbs_point.cpp b/opennurbs_point.cpp index af0dc5f7..a719d5b5 100644 --- a/opennurbs_point.cpp +++ b/opennurbs_point.cpp @@ -5894,7 +5894,7 @@ double ON_Length2d( double x, double y ) // For small denormalized doubles (positive but smaller // than DBL_MIN), some compilers/FPUs set 1.0/fx to +INF. // Without the ON_DBL_MIN test we end up with - // microscopic vectors that have infinte length! + // microscopic vectors that have infinite length! // // This code is absolutely necessary. It is a critical // part of the bug fix for RR 11217. @@ -6509,7 +6509,7 @@ double ON_Length3d(double x, double y, double z) // For small denormalized doubles (positive but smaller // than DBL_MIN), some compilers/FPUs set 1.0/x to +INF. // Without the ON_DBL_MIN test we end up with - // microscopic vectors that have infinte length! + // microscopic vectors that have infinite length! // // This code is absolutely necessary. It is a critical // part of the bug fix for RR 11217. @@ -8027,7 +8027,7 @@ bool ON_IsDegenrateConicHelper(double A, double B, double C, double D, double E) // (F = 0 in our case here.) // zero_tol was tuned by - // 1) testing sets of equaly spaced collinear + // 1) testing sets of equally spaced collinear // points with coordinate sizes ranging from 0.001 to 1.0e4 and // segment lengths from 0.001 to 1000.0. // 2) testing ellipses with axes lengths ranging from 0.001 to 1000 @@ -8119,7 +8119,7 @@ bool ON_GetConicEquationThrough6Points( double* zero_pivot ) { - // Sets conic[] to the coefficents = (A,B,C,D,E,F), + // Sets conic[] to the coefficients = (A,B,C,D,E,F), // such that A*x*x + B*x*y + C*y*y + D*x + E*y + F = 0 // for each of the 6 input points. @@ -8453,7 +8453,7 @@ bool ON_GetConicEquationThrough6Points( } // By construction, M[][] is singular and M[4][4] should be nearly zero. - // It should be upper triangluar with diagonal 1,1,1,1,0-ish + // It should be upper triangular with diagonal 1,1,1,1,0-ish if ( max_pivot ) *max_pivot = max_piv; if ( min_pivot ) @@ -8522,7 +8522,7 @@ bool ON_GetConicEquationThrough6Points( if ( (fabs(A) >= fabs(C)) ? (A<0.0):(C<0.0) ) { - // Make the largest A/C coefficent positive. + // Make the largest A/C coefficient positive. A = -A; B = -B; C = -C; D = -D; E = -E; F = -F; } @@ -8613,7 +8613,7 @@ bool ON_IsConicEquationAnEllipse( P[0] = x0*X[0] + y0*Y[0]; P[1] = x0*X[1] + y0*Y[1]; - // set A and C to elipse axes lengths + // set A and C to ellipse axes lengths F = conic[5] -(A*x0*x0 + C*y0*y0); if ( !(0.0 != F) ) return false; // F is 0.0 or a NaN @@ -9934,7 +9934,7 @@ void ON_PeriodicDomain::Initialize(const ON_Interval dom[2], const bool closed[2 // // * proj(Pin[i]) = proj(Out[i]) // * Out[0] = Pin[0] -// * Out[i+1] and Out[i] are in adjacnt bands +// * Out[i+1] and Out[i] are in adjacent bands ON_2dPoint ON_PeriodicDomain::LiftToCover(ON_2dPoint Pin, bool stealth ) { ON_2dPoint out = Pin; diff --git a/opennurbs_point.h b/opennurbs_point.h index 65b7ffc1..8f851aa3 100644 --- a/opennurbs_point.h +++ b/opennurbs_point.h @@ -164,16 +164,16 @@ public: /// /// /// interval_parameter may have any value but it is clamped - /// to be in the intervaly before the normalized parameter is evaluated. + /// to be in the interval before the normalized parameter is evaluated. /// /// /// Set a = the value at the beginning of this interval and /// b = the value at the end of this interval. /// If a, b or interval_parameter is unset or nan, ON_DBL_QNAN is returned. - /// If interval_parameter is in this interval, the correxponding normalized + /// If interval_parameter is in this interval, the corresponding normalized /// parameter is returned. - /// If interval_parameter is outside the interval, the normalized paramter for - /// the end closest to interval_parameter is retuend. + /// If interval_parameter is outside the interval, the normalized parameter for + /// the end closest to interval_parameter is returned. /// double ClampedNormalizedParameterAt( double interval_parameter @@ -255,7 +255,7 @@ public: this->Min() <= other.Min() and other.Max() <= this->Max(). If bProperSubSet is true, then the result is true when this->Min() <= other.Min() and other.Max() <= this->Max() - and at least one of the inequalites is strict. + and at least one of the inequalities is strict. */ bool Includes( const ON_Interval& other, @@ -562,12 +562,12 @@ public: const ON_Xform& ); - void Rotate( // rotatation in XY plane + void Rotate( // rotation in XY plane double angle, // angle in radians const ON_2dPoint& center // center of rotation ); - void Rotate( // rotatation in XY plane + void Rotate( // rotation in XY plane double sin_angle, // sin(angle) double cos_angle, // cos(angle) const ON_2dPoint& center // center of rotation @@ -1180,7 +1180,7 @@ public: double LengthSquared() const; double Length() const; - // Signed area of the parallelagram. The volume element. + // Signed area of the parallelogram. The volume element. // returns x*B.y - y*B.x double WedgeProduct(const ON_2dVector& B) const; @@ -1325,7 +1325,7 @@ ON_CrossProduct( ON_DECL double -ON_WedgeProduct( // signed area of the parallelagram. Volume element. +ON_WedgeProduct( // signed area of the parallelogram. Volume element. const ON_2dVector& A, // returns A.x * B.y - A.y * B.x const ON_2dVector& B ); @@ -1700,7 +1700,7 @@ public: /* Returns: - If the three points are valid and not colinear, a unitized plane equation is returned. + If the three points are valid and not collinear, a unitized plane equation is returned. Otherwise ON_PlaneEquation::NanPlaneEquation is returned. */ static const ON_PlaneEquation CreateFromThreePoints( @@ -1948,7 +1948,7 @@ public: This function has to invert xform. If you have apply the same transformation to a bunch of planes, then it will be more efficient to calculate xform's inverse transpose - and apply the resultingt transformation to the equation's + and apply the resulting transformation to the equation's coefficients as if they were 4d point coordinates. */ bool Transform( const ON_Xform& xform ); @@ -2272,7 +2272,7 @@ public: /// - /// Create an ON_SurfaceCurvature from a gaussian and mean curvature values using the relationsip + /// Create an ON_SurfaceCurvature from a gaussian and mean curvature values using the relationship /// between the principal curvatures, gaussian and mean. /// k1 = mean + sqrt(mean*mean - gaussian) /// k2 = mean - sqrt(mean*mean - gaussian) @@ -2428,7 +2428,7 @@ public: /// /// The minimum radius of curvature is 1/max(fabs(k1),fabs(k2)). - /// Infinte radius values are returned as ON_SurfaceCurvature::InfinteRadius. + /// Infinite radius values are returned as ON_SurfaceCurvature::InfiniteRadius. /// /// /// Minimum radius of curvature up to a maximum of 1e300. @@ -2440,7 +2440,7 @@ public: /// If a principal curvature value is zero /// or the principal curvatures have opposite signs, /// then the maximum radius of curvature is infinite - /// and ON_SurfaceCurvature::InfinteRadius is returned. + /// and ON_SurfaceCurvature::InfiniteRadius is returned. /// Otherwise the maximum radius of curvature is 1/min(fabs(k1),fabs(k2)). /// /// @@ -2462,7 +2462,7 @@ public: /// /// If kappa_style and the principal curvatures are valid, the specified /// type of curvature value is returned. - /// Infinte radii are returned as ON_SurfaceCurvature::InfinteRadius. + /// Infinite radii are returned as ON_SurfaceCurvature::InfiniteRadius. /// Otherwise ON_DBL_QNAN is returned. /// double KappaValue(ON::curvature_style kappa_style) const; @@ -2485,7 +2485,7 @@ ON_DECL /// /// /// Returns (lhs.k1==rhs.k1 && lhs.k2==rhs.k2) -/// Note that if any princial curvature is a nan, then false is returned. +/// Note that if any principal curvature is a nan, then false is returned. /// bool operator==( const ON_SurfaceCurvature& lhs, @@ -2513,7 +2513,7 @@ public: enum : unsigned { /// - /// The maximum order of a paritial derivative that + /// The maximum order of a partial derivative that /// an ON_SurfaceValues class can possibly store is 15. /// MaximumDerivativeOrder = 15 @@ -2521,7 +2521,7 @@ public: /// /// NOTE WELL: CreateFromLocalArray is for experts dealing with unusual situations. - /// Create a ON_SurfaceValues where the storage for deritave values is managed externally. + /// Create a ON_SurfaceValues where the storage for derivative values is managed externally. /// This is typically used by experts to easily get surface evaluation results stored in value_array[] when /// the evaluation function returns the results in a ON_SurfaceValues class. /// The caller is responsible for ensuring that the value_array[] memory is not freed or deleted @@ -2558,7 +2558,7 @@ public: /// /// NOTE WELL: CreateFromVectorArray is for experts dealing with unusual situations. - /// Create a ON_SurfaceValues where the storage for the values is deritave values is managed externally. + /// Create a ON_SurfaceValues where the storage for the values is derivative values is managed externally. /// This is typically used by experts to easily get surface evaluation results stored in value_array[] /// when the evaluation function returns the results in a ON_SurfaceValues class. /// The caller is responsible for ensuring that the value_array[] memory is not freed or deleted @@ -2656,7 +2656,7 @@ public: /// /// If (u,v) are the surface parameters, then - /// Derivatieve(0,0) = point, + /// Derivative(0,0) = point, /// Derivative(1,0) = 1st partial with respect to u (D/Du). /// Derivative(0,1) = 1st partial with respect to v (D/Dv). /// Derivative(2,0) = 2nd partial with respect to u (D/Du^2). @@ -2692,7 +2692,7 @@ public: /// Returns a pointer to an array of stride*(derivative_order_capacity + 1)*(derivative_order_capacity + 2)/2 doubles. /// /// - /// True if the returned inforamation can be passed to a legacy bispan evaluator. + /// True if the returned information can be passed to a legacy bispan evaluator. /// bool GetDerivativeArrayForExperts( unsigned& derivative_order_capacity, @@ -2721,7 +2721,7 @@ private: /// /// True if and expert is managing the memory m_derivatives - /// pionts at and that expert has made sure the memory will + /// points at and that expert has made sure the memory will /// exist for the duration of this class's scope. /// bool Internal_DerivativeMemoryIsExternal() const; @@ -3311,13 +3311,13 @@ public: /* Returns: - A copy of the refenced points in an ON_SimpleArray. + A copy of the referenced points in an ON_SimpleArray. */ ON_SimpleArray To3dPointArray() const; /* Returns: - A copy of the refenced points in an ON_SimpleArray. + A copy of the referenced points in an ON_SimpleArray. */ ON_SimpleArray To3fPointArray() const; @@ -4189,7 +4189,7 @@ private: // Number of boundary segments in the polyline ON__UINT32 m_boundary_segment_count = 0; - // In the comments below, H is the horizontal line throught the winding point + // In the comments below, H is the horizontal line through the winding point // and V is the vertical line through the winding point. // signed net number of times polyline crosses H to the left of the winding point. diff --git a/opennurbs_pointgrid.cpp b/opennurbs_pointgrid.cpp index 1ad97c59..0c35f468 100644 --- a/opennurbs_pointgrid.cpp +++ b/opennurbs_pointgrid.cpp @@ -333,7 +333,7 @@ ON_PointGrid::Transpose() int i, j; bool rc = false; if ( IsValid() ) { - // slow stupid way - can be imporved if necessary + // slow stupid way - can be improved if necessary ON_PointGrid t(m_point_count[1],m_point_count[0]); for ( i = 0; i < m_point_count[0]; i++ ) for ( j = 0; j < m_point_count[1]; j++ ) { t[j][i] = Point(i,j); diff --git a/opennurbs_polycurve.cpp b/opennurbs_polycurve.cpp index 580e1f2b..c9d826a4 100644 --- a/opennurbs_polycurve.cpp +++ b/opennurbs_polycurve.cpp @@ -1012,7 +1012,7 @@ ON_PolyCurve::IsPlanar( if ( !GetTestPlane( *this, test_plane ) ) { // 5 May 2006 Dale Lear - // Added additiional attempts to get a test_plane + // Added additional attempts to get a test_plane // for poorly parameterized polycurves. (RR 20057 fix). ON_3dPoint P, Q; ON_3dVector X; @@ -1352,8 +1352,8 @@ bool ON_PolyCurve::HasGapAt(int segment_index) const // // June 2019 - sometime in the past decade ON_PolyCurve::HasGap() // changed and the test here is different from ON_Curve::IsClosed(). - // The initial "Note" no longer applies becaue it's no longer - // clear why the current ON_PolyCurve::HasGap() elimiated the "b c" + // The initial "Note" no longer applies because it's no longer + // clear why the current ON_PolyCurve::HasGap() eliminated the "b c" // test that remained in ON_Curve::IsClosed(). if ( false == ON_PointsAreCoincident( 3, false, &P0.x, &P1.x ) ) @@ -1983,7 +1983,7 @@ bool ON_PolyCurve::GetNextDiscontinuity( } - // check for discontinity between curve segments + // check for discontinuity between curve segments int next_segment_index = segment_index+segment_index_delta; if ( next_segment_index < 0 || next_segment_index >= count ) { @@ -2386,7 +2386,7 @@ bool ON_NurbsCurve::IsContinuous( { if ( ON::continuity::Cinfinity_continuous == desired_continuity ) { - // Cinfinity_continuous is a euphanisim for "at a knot" + // Cinfinity_continuous is a euphemism for "at a knot" return false; } @@ -2535,10 +2535,10 @@ bool ON_PolyCurve::Evaluate( // returns false if unable to evaluate if ( -2 == side || 2 == side ) { // 9 November 2010 Dale Lear - ON_TuneupEvaluationParameter fix - // When evluation passes through ON_CurveProxy or ON_PolyCurve reparamterization + // When evaluation passes through ON_CurveProxy or ON_PolyCurve reparamterization // and the original side parameter was -1 or +1, it is changed to -2 or +2 - // to indicate that if t is numerically closed to an end paramter, then - // it should be tuned up to be at the end paramter. + // to indicate that if t is numerically closed to an end parameter, then + // it should be tuned up to be at the end parameter. double a = t; if ( ON_TuneupEvaluationParameter( side, m_t[segment_index], m_t[segment_index+1], &a) ) { @@ -3505,7 +3505,7 @@ bool ON_PolyCurve::Split( /* 4 April 2003 Greg Arden Made the following changes: 1. Use ParameterSearch() to decide if we should snap domain - boundries to m_t array values. + boundaries to m_t array values. 2. Make sure resulting polycurves have Domain() specified as split parameter. 3. When true is returned the result passes IsValid(). diff --git a/opennurbs_polycurve.h b/opennurbs_polycurve.h index 88fc924b..b5d11742 100644 --- a/opennurbs_polycurve.h +++ b/opennurbs_polycurve.h @@ -83,8 +83,8 @@ public: If true, gaps are allowed between polycurve segments. If false, gaps are not allowed between polycurve segments. text_log - [in] if the object is not valid and text_log - is not nullptr, then a brief englis description of the - reason the object is not valid is appened to the log. + is not nullptr, then a brief english description of the + reason the object is not valid is appended to the log. The information appended to text_log is suitable for low-level debugging purposes by programmers and is not intended to be useful as a high level user @@ -248,9 +248,9 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature discontinuity. + Search for a derivative, tangent, or curvature discontinuity. Parameters: - c - [in] type of continity to test for. If ON::continuity::C1_continuous + c - [in] type of continuity to test for. If ON::continuity::C1_continuous t0 - [in] search begins at t0 t1 - [in] (t0 < t1) search ends at t1 t - [out] if a discontinuity is found, the *t reports the @@ -627,7 +627,7 @@ public: Description: Modify the one or both locations at the end of segment[gap_index-1] and the start of segment[gap_index] - so they are coindicent. + so they are coincident. Parameters: gap_index - [in] 1 <= gap_index < Count() If the locations at the end of segment[gap_index-1] and @@ -672,7 +672,7 @@ public: ON_Curve* ); - //PrependAndMatch() and AppendAndMatch() return false if this->IsCLosed() or + //PrependAndMatch() and AppendAndMatch() return false if this->IsClosed() or //this->Count() > 0 and curve is closed bool PrependAndMatch(ON_Curve*); //Prepend and match end of curve to start of polycurve bool AppendAndMatch(ON_Curve*); //Append and match start of curve to end of polycurve diff --git a/opennurbs_polyedgecurve.cpp b/opennurbs_polyedgecurve.cpp index 86b3a71e..93b0dcf8 100644 --- a/opennurbs_polyedgecurve.cpp +++ b/opennurbs_polyedgecurve.cpp @@ -276,7 +276,7 @@ bool ON_PolyEdgeCurve::ChangeClosedCurveSeam( double t ) s += 1.0; if ( fabs(s) <= ON_SQRT_EPSILON || fabs(1.0-s) <= ON_SQRT_EPSILON ) { - // split parameter is at start/end of this segemnt + // split parameter is at start/end of this segment if ( t != crvd[0] ) { DestroyRuntimeCache(); @@ -431,8 +431,8 @@ bool ON_PolyEdgeCurve::IsClosed(void) const if ( !rc && SegmentCount() > 1 ) { // Since the segments that make up a ON_PolyEdgeCurve - // cannot have their ends matched (becuase the curves - // belong to objects alread in the rhino model), + // cannot have their ends matched (because the curves + // belong to objects already in the rhino model), // the IsClosed() test has to tolerate larger gaps // in brep topology. // @@ -451,7 +451,7 @@ bool ON_PolyEdgeCurve::IsClosed(void) const // // Do NOT add a test for sloppy geometric closure here. // If the edges are in the same brep and they don't - // meet topologicially, then there is something in the + // meet topologically, then there is something in the // brep that is separating the edges. int evi0 = seg0->ReversedEdgeDir() ? 1 : 0; int evi1 = seg1->ReversedEdgeDir() ? 0 : 1; diff --git a/opennurbs_polyedgecurve.h b/opennurbs_polyedgecurve.h index cb3f0605..58326c03 100644 --- a/opennurbs_polyedgecurve.h +++ b/opennurbs_polyedgecurve.h @@ -212,7 +212,7 @@ public: /* Returns: True if this segment has an ON_BrepTrim and the direction of - the ON_BrepTrime is the reverse of the direction of the segment. + the ON_BrepTrim is the reverse of the direction of the segment. */ bool ReversedTrimDir() const; diff --git a/opennurbs_polyline.h b/opennurbs_polyline.h index e4fca060..05a9bf00 100644 --- a/opennurbs_polyline.h +++ b/opennurbs_polyline.h @@ -124,7 +124,7 @@ public: Determine if a polyline is convex. Parameters: bStrictlyConvex - [in] - If false, colinear segments are considered convex. + If false, collinear segments are considered convex. Returns True if the polyline is a closed, convex loop. */ diff --git a/opennurbs_polylinecurve.cpp b/opennurbs_polylinecurve.cpp index 97e1d9bb..3b5c317a 100644 --- a/opennurbs_polylinecurve.cpp +++ b/opennurbs_polylinecurve.cpp @@ -904,10 +904,10 @@ ON_PolylineCurve::Evaluate( // returns false if unable to evaluate if ( -2 == side || 2 == side ) { // 9 November 2010 Dale Lear - ON_TuneupEvaluationParameter fix - // When evluation passes through ON_CurveProxy or ON_PolyCurve reparamterization + // When evaluation passes through ON_CurveProxy or ON_PolyCurve reparamterization // and the original side parameter was -1 or +1, it is changed to -2 or +2 - // to indicate that if t is numerically closed to an end paramter, then - // it should be tuned up to be at the end paramter. + // to indicate that if t is numerically closed to an end parameter, then + // it should be tuned up to be at the end parameter. double a = t; if ( ON_TuneupEvaluationParameter( side, m_t[segment_index], m_t[segment_index+1], &a) ) { diff --git a/opennurbs_polylinecurve.h b/opennurbs_polylinecurve.h index ad447cd5..4a93a956 100644 --- a/opennurbs_polylinecurve.h +++ b/opennurbs_polylinecurve.h @@ -270,9 +270,9 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature discontinuity. + Search for a derivative, tangent, or curvature discontinuity. Parameters: - c - [in] type of continity to test for. If ON::continuity::C1_continuous + c - [in] type of continuity to test for. If ON::continuity::C1_continuous t0 - [in] search begins at t0 t1 - [in] (t0 < t1) search ends at t1 t - [out] if a discontinuity is found, the *t reports the diff --git a/opennurbs_precompiledheader.cpp b/opennurbs_precompiledheader.cpp index 38b46206..8cff2ae4 100644 --- a/opennurbs_precompiledheader.cpp +++ b/opennurbs_precompiledheader.cpp @@ -1,7 +1,4 @@ -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2024 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +9,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ // CHECK SETTINGS BEFORE ANYTHING IS INCLUDED @@ -80,7 +76,7 @@ #error ON_COMPILING_OPENNURBS must be defined when compiling opennurbs #endif -// CHECK SETTINGS AFTER EVERTHING IS INCLUDED +// CHECK SETTINGS AFTER EVERYTHING IS INCLUDED #if defined(_MSC_VER) diff --git a/opennurbs_public.h b/opennurbs_public.h index f2c74a91..edae1e0e 100644 --- a/opennurbs_public.h +++ b/opennurbs_public.h @@ -1,7 +1,4 @@ -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2024 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +9,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_public.vcxproj b/opennurbs_public.vcxproj index 9b9ce9f1..55147b08 100644 --- a/opennurbs_public.vcxproj +++ b/opennurbs_public.vcxproj @@ -112,7 +112,6 @@ true ProgramDatabase true - /bigobj %(AdditionalOptions) Windows diff --git a/opennurbs_public_examples.h b/opennurbs_public_examples.h index d7866a7d..bbf7691a 100644 --- a/opennurbs_public_examples.h +++ b/opennurbs_public_examples.h @@ -1,5 +1,4 @@ -/* -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2024 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -10,7 +9,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_PUBLIC_EXAMPLES_INC_) #define OPENNURBS_PUBLIC_EXAMPLES_INC_ diff --git a/opennurbs_public_memory.cpp b/opennurbs_public_memory.cpp index 86eb43fe..6562d683 100644 --- a/opennurbs_public_memory.cpp +++ b/opennurbs_public_memory.cpp @@ -1,7 +1,4 @@ -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2024 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +9,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_public_version.h b/opennurbs_public_version.h index f790afb7..60b4b91d 100644 --- a/opennurbs_public_version.h +++ b/opennurbs_public_version.h @@ -6,7 +6,7 @@ // To update version numbers, edit ..\build\build_dates.msbuild #define RMA_VERSION_MAJOR 8 -#define RMA_VERSION_MINOR 9 +#define RMA_VERSION_MINOR 10 //////////////////////////////////////////////////////////////// // @@ -14,10 +14,10 @@ // first step in each build. // #define RMA_VERSION_YEAR 2024 -#define RMA_VERSION_MONTH 7 -#define RMA_VERSION_DATE 12 -#define RMA_VERSION_HOUR 18 -#define RMA_VERSION_MINUTE 12 +#define RMA_VERSION_MONTH 8 +#define RMA_VERSION_DATE 15 +#define RMA_VERSION_HOUR 13 +#define RMA_VERSION_MINUTE 0 //////////////////////////////////////////////////////////////// // @@ -35,8 +35,8 @@ // 3 = build system release build #define RMA_VERSION_BRANCH 0 -#define VERSION_WITH_COMMAS 8,9,24194,18120 -#define VERSION_WITH_PERIODS 8.9.24194.18120 +#define VERSION_WITH_COMMAS 8,10,24228,13000 +#define VERSION_WITH_PERIODS 8.10.24228.13000 #define COPYRIGHT "Copyright (C) 1993-2024, Robert McNeel & Associates. All Rights Reserved." #define SPECIAL_BUILD_DESCRIPTION "Public OpenNURBS C++ 3dm file IO library." @@ -44,11 +44,11 @@ #define RMA_VERSION_NUMBER_MAJOR_WSTRING L"8" #define RMA_PREVIOUS_VERSION_NUMBER_MAJOR_WSTRING L"7" -#define RMA_VERSION_NUMBER_SR_STRING "SR9" -#define RMA_VERSION_NUMBER_SR_WSTRING L"SR9" +#define RMA_VERSION_NUMBER_SR_STRING "SR10" +#define RMA_VERSION_NUMBER_SR_WSTRING L"SR10" -#define RMA_VERSION_WITH_PERIODS_STRING "8.9.24194.18120" -#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.9.24194.18120" +#define RMA_VERSION_WITH_PERIODS_STRING "8.10.24228.13000" +#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.10.24228.13000" diff --git a/opennurbs_quaternion.cpp b/opennurbs_quaternion.cpp index 7144bc43..776d200f 100644 --- a/opennurbs_quaternion.cpp +++ b/opennurbs_quaternion.cpp @@ -453,7 +453,7 @@ double ON_Quaternion::Length() const // For small denormalized doubles (positive but smaller // than DBL_MIN), some compilers/FPUs set 1.0/fa to +INF. // Without the ON_DBL_MIN test we end up with - // microscopic quaternions that have infinte norm! + // microscopic quaternions that have infinite norm! // // This code is absolutely necessary. It is a critical // part of the bug fix for RR 11217. diff --git a/opennurbs_quaternion.h b/opennurbs_quaternion.h index 77d6df30..b72935e4 100644 --- a/opennurbs_quaternion.h +++ b/opennurbs_quaternion.h @@ -207,7 +207,7 @@ public: static ON_Quaternion RotationZYZ(double alpha, double beta, double gamma); /* - Descriptin: + Description: Sets the quaternion to the unit quaternion which rotates plane0.xaxis to plane1.xaxis, plane0.yaxis to plane1.yaxis, and diff --git a/opennurbs_rand.cpp b/opennurbs_rand.cpp index 655737f6..b741e7d6 100644 --- a/opennurbs_rand.cpp +++ b/opennurbs_rand.cpp @@ -386,7 +386,7 @@ void ON_RandomNumberGenerator::RandomPermutation(void* base, size_t nel, size_t // number int the range 0 to N-1 when N is not a factor of 2^32. // As usual, this bias is not worth worrying about // unlsess 2^32 / N is smallish. If you need a random - // permuation of a very large array, look elsewhere. + // permutation of a very large array, look elsewhere. if ( 0 == sizeof_element % sizeof(ON__UINT64) ) { diff --git a/opennurbs_rand.h b/opennurbs_rand.h index f76ad8ab..967ff59d 100644 --- a/opennurbs_rand.h +++ b/opennurbs_rand.h @@ -110,7 +110,7 @@ public: /* Returns: - A upredictable seed value for a random number generator. + A unpredictable seed value for a random number generator. This function is much slower than ON_RandomNumberGenerator::RandomNumber(). */ static ON__UINT32 RandomSeed(); @@ -186,7 +186,7 @@ public: /* Description: - Places two Gaussians with mean zero and standard devation one, + Places two Gaussians with mean zero and standard deviation one, generated by a Box-Muller transform, into the doubles pointed to by its arguments. Parameters: u - [out] diff --git a/opennurbs_render_content.cpp b/opennurbs_render_content.cpp index f5607bad..350a7b02 100644 --- a/opennurbs_render_content.cpp +++ b/opennurbs_render_content.cpp @@ -225,12 +225,6 @@ ON_UUID RdkPlugInId(void) return uuid; } -ON_UUID UniversalRenderEngineId(void) -{ - static ON_UUID uuid = { 0x99999999, 0x9999, 0x9999, { 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99 } }; - return uuid; -} - class ON_RenderContentPrivate { public: @@ -722,7 +716,7 @@ ON_RenderContent::ON_RenderContent(const wchar_t* kind) _private->InternalSetPropertyValue(ON_RENDER_CONTENT_PLUG_IN_ID, RdkPlugInId()); // Set the render engine id to 'universal'. - _private->InternalSetPropertyValue(ON_RENDER_CONTENT_RENDER_ENGINE_ID, UniversalRenderEngineId()); + _private->InternalSetPropertyValue(ON_RENDER_CONTENT_RENDER_ENGINE_ID, ON_UniversalRenderEngineId); } ON_RenderContent::ON_RenderContent(const ON_RenderContent& rc) @@ -1773,10 +1767,8 @@ int ONX_Model::AddRenderMaterial(const wchar_t* candidate_name) if (!ON_ModelComponent::IsValidComponentName(candidate_name)) return ON_UNSET_INT_INDEX; - static ON_UUID uuidPB = { 0x5a8d7b9b, 0xcdc9, 0x49de, { 0x8c, 0x16, 0x2e, 0xf6, 0x4f, 0xb0, 0x97, 0xab } }; - ON_RenderMaterial mat; - mat.SetTypeId(uuidPB); + mat.SetTypeId(ON_RenderContentType_PhysicallyBasedMaterial); const ON_wString mat_name = m_manifest.UnusedName(mat.ComponentType(), ON_nil_uuid, candidate_name, nullptr, nullptr, 0, nullptr); @@ -1798,10 +1790,8 @@ int ONX_Model::AddRenderEnvironment(const wchar_t* candidate_name) if (!ON_ModelComponent::IsValidComponentName(candidate_name)) return ON_UNSET_INT_INDEX; - static ON_UUID uuidBE = { 0xba51ce00, 0xba51, 0xce00, { 0xba, 0x51, 0xce, 0xba, 0x51, 0xce, 0x00, 0x00 } }; - ON_RenderEnvironment env; - env.SetTypeId(uuidBE); + env.SetTypeId(ON_RenderContentType_BasicEnvironment); const ON_wString env_name = m_manifest.UnusedName(env.ComponentType(), ON_nil_uuid, candidate_name, nullptr, nullptr, 0, nullptr); @@ -1828,10 +1818,8 @@ int ONX_Model::AddRenderTexture(const wchar_t* filename) return ON_UNSET_INT_INDEX; } - static const ON_UUID uuidBM = { 0x57e0ed08, 0x1907, 0x4529, { 0xb0, 0x1b, 0x0c, 0x4a, 0x24, 0x24, 0x55, 0xfd } }; - ON_RenderTexture tex; - tex.SetTypeId(uuidBM); + tex.SetTypeId(ON_RenderContentType_BitmapTexture); tex.SetParameter(ON_RENDER_TEXTURE_FILENAME, clean_filename); const ON_wString candidate_name = ON_FileSystemPath::FileNameFromPath(clean_filename, false); @@ -1840,7 +1828,7 @@ int ONX_Model::AddRenderTexture(const wchar_t* filename) tex.SetName(tex_name); const ON_ModelComponentReference mcr = AddModelComponent(tex, true); - const auto* model_tex = ON_RenderTexture::Cast(mcr.ModelComponent()); + const ON_RenderTexture* model_tex = ON_RenderTexture::Cast(mcr.ModelComponent()); if (nullptr == model_tex) { ON_ERROR("Failed to add render texture; AddModelComponent() failed"); @@ -1855,3 +1843,62 @@ ON_DECL void ON_EnsureNameValid(ON_wString& name) { EnsureNameValid(name); } + +ON_UUID ON_UniversalRenderEngineId = { 0x99999999, 0x9999, 0x9999, { 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99 } }; + +ON_UUID ON_RenderContentType_2DCheckerTexture = { 0xfd60c44e, 0x080c, 0x4967, { 0x92, 0xaa, 0x41, 0x0e, 0x8a, 0xa9, 0x5a, 0x0f } }; +ON_UUID ON_RenderContentType_3DCheckerTexture = { 0x6cdbb011, 0x3e2a, 0x4769, { 0x87, 0x2f, 0xe3, 0x89, 0x65, 0x63, 0xea, 0x3a } }; +ON_UUID ON_RenderContentType_AddTexture = { 0xdbfae616, 0x1ffb, 0x4b75, { 0xa6, 0x46, 0x1c, 0x7f, 0xa8, 0x9a, 0xa9, 0xb3 } }; +ON_UUID ON_RenderContentType_AdvancedDotTexture = { 0x9b654648, 0x5799, 0x41bf, { 0x82, 0x3c, 0x48, 0x31, 0x4d, 0x1e, 0xb6, 0xaa } }; +ON_UUID ON_RenderContentType_BasicEnvironment = { 0xba51ce00, 0xba51, 0xce00, { 0xba, 0x51, 0xce, 0xba, 0x51, 0xce, 0x00, 0x00 } }; +ON_UUID ON_RenderContentType_BitmapTexture = { 0x57e0ed08, 0x1907, 0x4529, { 0xb0, 0x1b, 0x0c, 0x4a, 0x24, 0x24, 0x55, 0xfd } }; +ON_UUID ON_RenderContentType_BlendMaterial = { 0xb1e4d000, 0xb1e4, 0xd000, { 0xb1, 0xe4, 0xd0, 0xb1, 0xe4, 0xd0, 0x07, 0x09 } }; +ON_UUID ON_RenderContentType_BlendMaterial_V8 = { 0x0322370f, 0xa9af, 0x4264, { 0xa5, 0x7c, 0x58, 0xff, 0x8e, 0x43, 0x45, 0xdd } }; +ON_UUID ON_RenderContentType_BlendTexture = { 0x3fa30f00, 0x4c3f, 0x4afe, { 0x88, 0xab, 0xd7, 0x13, 0xb0, 0xbe, 0x2f, 0xd8 } }; +ON_UUID ON_RenderContentType_CompositeMaterial = { 0x4eb8c64d, 0xde99, 0x45cb, { 0xb3, 0x7e, 0x68, 0x85, 0xb4, 0x07, 0x2a, 0x4d } }; +ON_UUID ON_RenderContentType_CustomMaterial = { 0xba51c000, 0xba51, 0xc000, { 0xba, 0x51, 0xc0, 0xba, 0x51, 0xc0, 0x00, 0x00 } }; +ON_UUID ON_RenderContentType_DefaultMaterial = { 0xdefadefa, 0xdefa, 0xdefa, { 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xfa } }; +ON_UUID ON_RenderContentType_DefaultEnvironment = { 0xdefaeeee, 0xdefa, 0xeeee, { 0xde, 0xfa, 0xee, 0xee, 0xde, 0xfa, 0xee, 0xee } }; +ON_UUID ON_RenderContentType_CrossHatchBumpTexture = { 0x6e9c1863, 0x9015, 0x44a4, { 0xaf, 0x6c, 0xc4, 0x27, 0x21, 0x0e, 0xa8, 0xde } }; +ON_UUID ON_RenderContentType_CubeMapTexture = { 0x956c41fa, 0xa03b, 0x4733, { 0xaf, 0xe7, 0x23, 0x44, 0xaa, 0x00, 0x82, 0xdd } }; +ON_UUID ON_RenderContentType_DisplayAttributeMaterial = { 0xc85d18a8, 0x68dd, 0x49fd, { 0xae, 0x3e, 0x72, 0xa3, 0x79, 0xc8, 0xc4, 0x86 } }; +ON_UUID ON_RenderContentType_DotBumpTexture = { 0xfee0999d, 0x26f1, 0x4aea, { 0x81, 0xfe, 0x85, 0x70, 0x28, 0x6a, 0xe9, 0x64 } }; +ON_UUID ON_RenderContentType_DoubleSidedMaterial = { 0xe6cd1973, 0xb739, 0x496e, { 0xab, 0x69, 0x32, 0x95, 0x7f, 0xa4, 0x84, 0x92 } }; +ON_UUID ON_RenderContentType_EmissionMaterial = { 0x94bb5698, 0xb0cd, 0x4d6e, { 0x84, 0xd7, 0xd2, 0x6f, 0x79, 0x81, 0x7d, 0x6e } }; +ON_UUID ON_RenderContentType_ExposureTexture = { 0x0f2f3b9b, 0xa330, 0x418c, { 0x83, 0x71, 0xf9, 0xf4, 0xe7, 0x61, 0xbe, 0x3c } }; +ON_UUID ON_RenderContentType_FBmTexture = { 0x8edbb011, 0x4e2a, 0x5769, { 0x87, 0x2f, 0xe3, 0x89, 0x65, 0x63, 0xea, 0x3b } }; +ON_UUID ON_RenderContentType_GemMaterial = { 0x5386a427, 0x85bb, 0x48a8, { 0x82, 0xa8, 0x10, 0x9f, 0xf0, 0x19, 0x27, 0xc3 } }; +ON_UUID ON_RenderContentType_GlassMaterial = { 0x51b4af08, 0x9dec, 0x4744, { 0x86, 0xf9, 0x54, 0x6f, 0xba, 0xcb, 0x80, 0x0d } }; +ON_UUID ON_RenderContentType_GradientTexture = { 0x8edbb013, 0x1e2b, 0x2669, { 0x87, 0x2f, 0xe3, 0x89, 0x65, 0x63, 0xea, 0x3b } }; +ON_UUID ON_RenderContentType_GraniteTexture = { 0x56587545, 0xb6de, 0x4f1f, { 0x8c, 0x60, 0x46, 0x39, 0xa2, 0x13, 0x8d, 0x8c } }; +ON_UUID ON_RenderContentType_GridTexture = { 0x809acd47, 0x00c8, 0x4c2f, { 0xae, 0x38, 0xaa, 0x5e, 0x3d, 0x8b, 0xea, 0xc7 } }; +ON_UUID ON_RenderContentType_GritBumpTexture = { 0x1b762bb6, 0x8b95, 0x4c1b, { 0xb3, 0x38, 0x45, 0x93, 0xc3, 0x3f, 0xfb, 0x65 } }; +ON_UUID ON_RenderContentType_HatchBumpTexture = { 0xb4e3a0dd, 0x6b65, 0x4612, { 0x84, 0xb3, 0xcc, 0x64, 0xdd, 0xda, 0x49, 0x6e } }; +ON_UUID ON_RenderContentType_HDRTexture = { 0xf28c2d86, 0x0466, 0x40d4, { 0x89, 0xee, 0xa5, 0x4b, 0x6c, 0x5e, 0x92, 0x88 } }; +ON_UUID ON_RenderContentType_LeatherBumpTexture = { 0x5dfb43e6, 0x2f03, 0x432f, { 0xbe, 0xcf, 0x9f, 0x9a, 0xb3, 0x0c, 0x89, 0x41 } }; +ON_UUID ON_RenderContentType_MarbleTexture = { 0xa6cae674, 0xb2cd, 0x4585, { 0xa2, 0xbe, 0x9a, 0xb2, 0xe5, 0x0d, 0x35, 0x76 } }; +ON_UUID ON_RenderContentType_MaskTexture = { 0xb047bd26, 0x32eb, 0x43f7, { 0x9a, 0x4e, 0x6a, 0x82, 0x8c, 0x22, 0x67, 0xd1 } }; +ON_UUID ON_RenderContentType_MetalMaterial = { 0x037469d6, 0x0b9a, 0x4e5f, { 0xaf, 0x10, 0xe4, 0x83, 0xc9, 0x92, 0x99, 0x3a } }; +ON_UUID ON_RenderContentType_MultiplyTexture = { 0x95bf2b4a, 0xc79b, 0x48e8, { 0x97, 0xd0, 0x25, 0x84, 0xf2, 0xe8, 0xe5, 0x2b } }; +ON_UUID ON_RenderContentType_NoiseTexture = { 0x9b787367, 0xebbc, 0x4865, { 0xaf, 0x18, 0xfd, 0x9d, 0xab, 0x7e, 0xb1, 0x77 } }; +ON_UUID ON_RenderContentType_PaintMaterial = { 0x492fafa5, 0x0e48, 0x4c8e, { 0x89, 0xa0, 0x08, 0xd3, 0xa1, 0x9b, 0xfe, 0x89 } }; +ON_UUID ON_RenderContentType_PerlinMarbleTexture = { 0x113245f5, 0x2f12, 0x4e26, { 0x8d, 0xec, 0xb1, 0x18, 0x30, 0x40, 0x2c, 0x47 } }; +ON_UUID ON_RenderContentType_PerturbingTexture = { 0xe26c301a, 0xcad4, 0x4420, { 0x9e, 0xe6, 0xc4, 0x05, 0x62, 0xa2, 0xc9, 0xdd } }; +ON_UUID ON_RenderContentType_PhysicallyBasedMaterial = { 0x5a8d7b9b, 0xcdc9, 0x49de, { 0x8c, 0x16, 0x2e, 0xf6, 0x4f, 0xb0, 0x97, 0xab } }; +ON_UUID ON_RenderContentType_PhysicalSkyTexture = { 0xfd8913b1, 0x1654, 0x47c5, { 0x8f, 0xd2, 0xe1, 0xf0, 0x29, 0xdd, 0x4a, 0xb4 } }; +ON_UUID ON_RenderContentType_PictureMaterial = { 0xa7e351be, 0x9546, 0x42dc, { 0x89, 0x40, 0x88, 0x67, 0xf2, 0x82, 0x90, 0x31 } }; +ON_UUID ON_RenderContentType_PlasterMaterial = { 0x6736887e, 0x11dd, 0x4782, { 0x8c, 0xc9, 0xd5, 0x0e, 0x41, 0xff, 0x45, 0xb0 } }; +ON_UUID ON_RenderContentType_PlasticMaterial = { 0xab3f2653, 0x4d79, 0x459d, { 0x90, 0x03, 0x1a, 0x63, 0xd9, 0x65, 0x06, 0x2d } }; +ON_UUID ON_RenderContentType_ProjectionChangerTexture = { 0x103da058, 0x9de8, 0x4270, { 0xb9, 0x20, 0xbc, 0xac, 0xe5, 0xa6, 0xc7, 0xd9 } }; +ON_UUID ON_RenderContentType_RealtimeDisplayMaterial = ON_RenderContentType_DoubleSidedMaterial; +ON_UUID ON_RenderContentType_ResampleTexture = { 0x71d5feef, 0x4144, 0x4133, { 0x8c, 0x38, 0x1e, 0xef, 0x2b, 0xc8, 0x51, 0xf1 } }; +ON_UUID ON_RenderContentType_SimpleBitmapTexture = { 0xcfb368a4, 0xffb2, 0x404a, { 0xbb, 0xa9, 0x49, 0x72, 0x03, 0xb5, 0x05, 0x3a } }; +ON_UUID ON_RenderContentType_SingleColorTexture = { 0xb9368b92, 0x9f02, 0x45fb, { 0xb6, 0xcf, 0x09, 0x5e, 0xf8, 0x46, 0x35, 0x50 } }; +ON_UUID ON_RenderContentType_SpeckleBumpTexture = { 0xf1bf487d, 0xe84d, 0x4693, { 0xaf, 0xfc, 0x3f, 0x39, 0xf2, 0x39, 0xc2, 0x6c } }; +ON_UUID ON_RenderContentType_StuccoTexture = { 0x9d5173c5, 0x5f01, 0x4832, { 0xa4, 0x51, 0xa0, 0x22, 0x07, 0x4b, 0xa2, 0x08 } }; +ON_UUID ON_RenderContentType_TextureAdjustmentTexture = { 0x79c30c49, 0xed60, 0x4c14, { 0xab, 0x9b, 0x02, 0x24, 0x3f, 0x5c, 0xaf, 0x7f } }; +ON_UUID ON_RenderContentType_TileTexture = { 0x7edbb011, 0x4e2a, 0x5769, { 0x87, 0x2f, 0xe3, 0x89, 0x65, 0x63, 0xea, 0x3a } }; +ON_UUID ON_RenderContentType_TurbulenceTexture = { 0x9edbb011, 0x4e2a, 0x5769, { 0x87, 0x2f, 0xe3, 0x89, 0x65, 0x63, 0xea, 0x3c } }; +ON_UUID ON_RenderContentType_WavesTexture = { 0xbbb53de4, 0x265e, 0x416c, { 0xa2, 0x19, 0x6c, 0x98, 0x2e, 0x70, 0x03, 0x5f } }; +ON_UUID ON_RenderContentType_WoodBumpTexture = { 0x757ca668, 0x47c9, 0x43b2, { 0xbb, 0x58, 0x19, 0x03, 0xce, 0x9a, 0x7a, 0x72 } }; +ON_UUID ON_RenderContentType_WoodTexture = { 0x11700849, 0xa326, 0x4538, { 0xbd, 0x44, 0x11, 0x86, 0x46, 0x90, 0xda, 0x68 } }; diff --git a/opennurbs_render_content.h b/opennurbs_render_content.h index 7fff8ac2..49c0ade4 100644 --- a/opennurbs_render_content.h +++ b/opennurbs_render_content.h @@ -316,4 +316,74 @@ public: virtual ON_RenderContent* NewRenderContent(void) const override; }; +// Universal render engine id. Set as ON_Material plug-in id when using ON_RenderContentType_* +// ids in ON_Material::SetRdkMaterialInstanceId(). +extern ON_DECL ON_UUID ON_UniversalRenderEngineId; + +// Render materials. +extern ON_DECL ON_UUID ON_RenderContentType_BlendMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_BlendMaterial_V8; +extern ON_DECL ON_UUID ON_RenderContentType_CompositeMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_CustomMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_DefaultMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_DisplayAttributeMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_DoubleSidedMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_EmissionMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_GemMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_GlassMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_MetalMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_PaintMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_PhysicallyBasedMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_PictureMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_PlasterMaterial; +extern ON_DECL ON_UUID ON_RenderContentType_PlasticMaterial; + +// Display material used to support front and back materials for realtime rendering in the viewport. +extern ON_DECL ON_UUID ON_RenderContentType_RealtimeDisplayMaterial; + +// Render environments. +extern ON_DECL ON_UUID ON_RenderContentType_BasicEnvironment; +extern ON_DECL ON_UUID ON_RenderContentType_DefaultEnvironment; + +// Render textures. +extern ON_DECL ON_UUID ON_RenderContentType_2DCheckerTexture; +extern ON_DECL ON_UUID ON_RenderContentType_3DCheckerTexture; +extern ON_DECL ON_UUID ON_RenderContentType_AddTexture; +extern ON_DECL ON_UUID ON_RenderContentType_AdvancedDotTexture; +extern ON_DECL ON_UUID ON_RenderContentType_BitmapTexture; +extern ON_DECL ON_UUID ON_RenderContentType_BlendTexture; +extern ON_DECL ON_UUID ON_RenderContentType_CubeMapTexture; +extern ON_DECL ON_UUID ON_RenderContentType_ExposureTexture; +extern ON_DECL ON_UUID ON_RenderContentType_FBmTexture; +extern ON_DECL ON_UUID ON_RenderContentType_GradientTexture; +extern ON_DECL ON_UUID ON_RenderContentType_GraniteTexture; +extern ON_DECL ON_UUID ON_RenderContentType_GridTexture; +extern ON_DECL ON_UUID ON_RenderContentType_HDRTexture; +extern ON_DECL ON_UUID ON_RenderContentType_MarbleTexture; +extern ON_DECL ON_UUID ON_RenderContentType_MaskTexture; +extern ON_DECL ON_UUID ON_RenderContentType_MultiplyTexture; +extern ON_DECL ON_UUID ON_RenderContentType_NoiseTexture; +extern ON_DECL ON_UUID ON_RenderContentType_PerlinMarbleTexture; +extern ON_DECL ON_UUID ON_RenderContentType_PerturbingTexture; +extern ON_DECL ON_UUID ON_RenderContentType_PhysicalSkyTexture; +extern ON_DECL ON_UUID ON_RenderContentType_ProjectionChangerTexture; +extern ON_DECL ON_UUID ON_RenderContentType_ResampleTexture; +extern ON_DECL ON_UUID ON_RenderContentType_SimpleBitmapTexture; +extern ON_DECL ON_UUID ON_RenderContentType_SingleColorTexture; +extern ON_DECL ON_UUID ON_RenderContentType_StuccoTexture; +extern ON_DECL ON_UUID ON_RenderContentType_TextureAdjustmentTexture; +extern ON_DECL ON_UUID ON_RenderContentType_TileTexture; +extern ON_DECL ON_UUID ON_RenderContentType_TurbulenceTexture; +extern ON_DECL ON_UUID ON_RenderContentType_WavesTexture; +extern ON_DECL ON_UUID ON_RenderContentType_WoodTexture; + +// Simple bump textures. +extern ON_DECL ON_UUID ON_RenderContentType_CrossHatchBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_DotBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_GritBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_HatchBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_LeatherBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_SpeckleBumpTexture; +extern ON_DECL ON_UUID ON_RenderContentType_WoodBumpTexture; + #endif diff --git a/opennurbs_rendering.h b/opennurbs_rendering.h index ce20fa8c..06bcbd1f 100644 --- a/opennurbs_rendering.h +++ b/opennurbs_rendering.h @@ -123,7 +123,7 @@ public: mapping_id - [in] ON_TextureMapping id Returns: - True if the mapping channel was added or a pefect + True if the mapping channel was added or a perfect match already existed. False if a mapping channel with a different mapping_id already exists for this plug-in and channel. @@ -185,13 +185,13 @@ public: procedural textures and use these for quick previews. Returns: - True if advancded texture preview is enabled. + True if advanced texture preview is enabled. */ void EnableAdvancedTexturePreview(bool b); /* Returns: - True if advancded texture preview is enabled. + True if advanced texture preview is enabled. */ bool AdvancedTexturePreview() const; diff --git a/opennurbs_revsurface.cpp b/opennurbs_revsurface.cpp index 122ca291..b070567f 100644 --- a/opennurbs_revsurface.cpp +++ b/opennurbs_revsurface.cpp @@ -1095,13 +1095,13 @@ bool ON_RevSurface::Split( srf_en->m_bbox.Destroy(); // update bounding boxes - // if input box was valid, intesect calculated boxes with + // if input box was valid, intersect calculated boxes with // input box - srf_ws->BoundingBox(); // calcluates srf_ws->m_bbox + srf_ws->BoundingBox(); // calculates srf_ws->m_bbox if ( srf_ws->m_bbox.IsValid() && input_bbox.IsValid() ) srf_ws->m_bbox.Intersection(input_bbox); - srf_en->BoundingBox(); // calcluates srf_en->m_bbox + srf_en->BoundingBox(); // calculates srf_en->m_bbox if ( srf_en->m_bbox.IsValid() && input_bbox.IsValid() ) srf_en->m_bbox.Intersection(input_bbox); } diff --git a/opennurbs_revsurface.h b/opennurbs_revsurface.h index 8e1d9043..b0f0242c 100644 --- a/opennurbs_revsurface.h +++ b/opennurbs_revsurface.h @@ -32,7 +32,7 @@ public: ON_Line m_axis; // Start and end angles of revolution in radians. - // The interval m_angle must be increasing and satisfiy + // The interval m_angle must be increasing and satisfy // ON_ZERO_TOLERANCE < m_angle.Length() <= 2.0*ON_PI ON_Interval m_angle; @@ -262,12 +262,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -487,7 +487,7 @@ public: int GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 @@ -501,7 +501,7 @@ public: int HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 diff --git a/opennurbs_rtree.cpp b/opennurbs_rtree.cpp index e1ec4f44..a924db68 100644 --- a/opennurbs_rtree.cpp +++ b/opennurbs_rtree.cpp @@ -123,7 +123,7 @@ static size_t MemPoolBlkSize( size_t leaf_count ) const size_t sizeof_blklink = SizeofBlkLink(); // pagesize = OS memory manager page size. We want the - // allocated blocks to be some smallish mulitples of pagesize + // allocated blocks to be some smallish multiples of pagesize // to the active sections of the tree will end up in CPU cache // when the tree is being repeatedly searched. size_t pagesize = ON_MemoryPageSize(); @@ -383,7 +383,7 @@ bool ON_RTreeIterator::PushChildren(StackElement* sp, bool bFirstChild ) StackElement* spmax = &m_stack[0] + MAX_STACK; const ON_RTreeNode* node = sp->m_node; m_sp = 0; - // push first leaf coverted by this node onto the stack + // push first leaf converted by this node onto the stack while( 0 != node && node->m_level >= 0 && node->m_count > 0 ) { if ( 0 == node->m_level ) @@ -859,7 +859,7 @@ bool ON_SubDRTreeVertexFinder::Callback(void* a_context, ON__INT_PTR a_id) if (vf->m_bMarkFilterEnabled && vf->m_bMarkFilter != v->Mark()) { - // v is not eligable. + // v is not eligible. // Returning true means continue searching for other vertices return true; } @@ -872,7 +872,7 @@ bool ON_SubDRTreeVertexFinder::Callback(void* a_context, ON__INT_PTR a_id) case ON_SubDRTreeVertexFinder::MarkBitsFilter::Equal: if (vf->m_mark_bits != v_mark_bits) { - // v is not eligable. + // v is not eligible. // Returning true means continue searching for other vertices return true; } @@ -881,7 +881,7 @@ bool ON_SubDRTreeVertexFinder::Callback(void* a_context, ON__INT_PTR a_id) case ON_SubDRTreeVertexFinder::MarkBitsFilter::NotEqual: if (vf->m_mark_bits == v_mark_bits) { - // v is not eligable. + // v is not eligible. // Returning true means continue searching for other vertices return true; } @@ -1965,7 +1965,7 @@ bool ON_RTree::Search( // Do not return false if PairSearchHelperBool() returns false. The only reason // PairSearchHelperBool() returns false is that the user specified resultCallback() // terminated the search. This way a programmer with the ability to reason can - // distinguish between a terminiation and a failure to start because input is + // distinguish between a termination and a failure to start because input is // missing. PairSearchHelperBool(a_rtreeA.m_root,a_rtreeB.m_root,&r); @@ -1993,7 +1993,7 @@ bool ON_RTree::Search( // The only reason PairSearchHelperBoolTolerance() returns false is that // the user specified resultCallback() terminated the search. // This way a programmer with the ability to reason can distinguish between - // a terminiation and a failure to start because input is missing. + // a termination and a failure to start because input is missing. PairSearchHelperBoolTolerance(a_rtreeA.m_root, a_rtreeB.m_root, &r); return true; @@ -2613,7 +2613,7 @@ bool ON_RTree::Search( // Do not return false if PairSearchHelperBool() returns false. The only reason // PairSearchHelperBool() returns false is that the user specified resultCallback() // terminated the search. This way a programmer with the ability to reason can - // distinguish between a terminiation and a failure to start because input is + // distinguish between a termination and a failure to start because input is // missing. SingleTreeSearchHelperBool(this->m_root, this->m_root, &r); @@ -2637,7 +2637,7 @@ bool ON_RTree::Search( // Do not return false if PairSearchHelperBool() returns false. The only reason // PairSearchHelperBool() returns false is that the user specified resultCallback() // terminated the search. This way a programmer with the ability to reason can - // distinguish between a terminiation and a failure to start because input is + // distinguish between a termination and a failure to start because input is // missing. SingleTreeSearchHelperBoolTolerance(this->m_root, this->m_root, &r); @@ -2934,7 +2934,7 @@ static void DisconnectBranch(ON_RTreeNode* a_node, int a_index) // Pick a branch. Pick the one that will need the smallest increase -// in area to accomodate the new rectangle. This will result in the +// in area to accommodate the new rectangle. This will result in the // least total area for the covering rectangles in the current node. // In case of a tie, pick the one which was smaller before, to get // the best resolution when searching. @@ -3899,7 +3899,7 @@ bool ON_RTree::Search( return SearchBoundedPlaneXYZHelper(m_root, bounded_plane, result); } -// Search in an index tree or subtree for all data retangles that overlap the argument rectangle. +// Search in an index tree or subtree for all data rectangles that overlap the argument rectangle. static bool SearchHelper(const ON_RTreeNode* a_node, ON_RTreeBBox* a_rect, ON_RTreeSearchResultCallback& a_result ) @@ -4220,7 +4220,7 @@ bool SearchHelper(const ON_RTreeNode* a_node, const ON_Line* a_line, ON_RTreeSea -// Search in an index tree or subtree for all data retangles that overlap the argument rectangle. +// Search in an index tree or subtree for all data rectangles that overlap the argument rectangle. static bool SearchHelper(const ON_RTreeNode* a_node, const ON_RTreeBBox* a_rect, ON_SimpleArray &a_result) { diff --git a/opennurbs_rtree.h b/opennurbs_rtree.h index 84357934..4b1f58aa 100644 --- a/opennurbs_rtree.h +++ b/opennurbs_rtree.h @@ -16,7 +16,7 @@ /* The opennurbs rtree code is a modified version of the -free and unrestricted R-tree implementation obtianed from +free and unrestricted R-tree implementation obtained from http://www.superliminal.com/sources/sources.htm The first lines on the website indicate the code is free and unrestricted: @@ -342,7 +342,7 @@ public: See the comment for ON_RTreeIterator::First() Returns: True if a call to Value() will return a non-null pointer. - False if there is not a next leaf and all susequent calls to + False if there is not a next leaf and all subsequent calls to Value() will return null. See Also: ON_RTreeIterator::Prev(); @@ -381,7 +381,7 @@ public: See the comment for ON_RTreeIterator::Last() Returns: True if a call to Value() will return a non-null pointer. - False if there is not a previous leaf and all susequent calls to + False if there is not a previous leaf and all subsequent calls to Value() will return null. See Also: ON_RTreeIterator::Next(); diff --git a/opennurbs_sha1.h b/opennurbs_sha1.h index 2e4eeab8..8508fdbf 100644 --- a/opennurbs_sha1.h +++ b/opennurbs_sha1.h @@ -210,7 +210,7 @@ public: Parse a string of 40 hexadecimal digits to create a SHA-1 hash. Parameters: string_to_parse - [in] - bParseLeadinglSpaces - [in] + bParseLeadingSpaces - [in] If true, leading space characters are parsed. Otherwise leading space characters cause parsing to fail. bParseInteriorSpace - [in] @@ -222,7 +222,7 @@ public: bIgnoreInternalSpaces - [in] If true, isolated hyphens are ignored until 40 hex digits are read. bIgnoreInternalHyphens - [in] - If true, leading spaces and isolated interior spacess are ignored until 40 hex digits are read. + If true, leading spaces and isolated interior spaces are ignored until 40 hex digits are read. failure_return_value - [in] Value to return if string_to_parse cannot be parsed as 40 hex digits. Returns: @@ -270,7 +270,7 @@ public: Returns: True if this hash is not equal to ON_SHA1_Hash::EmptyContentHash or ON_SHA1_Hash::ZeroDigest. Remarks: - ON_SHA1_Hash::EmptyContentHash is the SHA1 of hasing zero bytes and has a non zero digest. + ON_SHA1_Hash::EmptyContentHash is the SHA1 of hashing zero bytes and has a non zero digest. ON_SHA1_Hash::ZeroDigest is 20 bytes of zeros. Opennurbs uses ON_SHA1_Hash::ZeroDigest to indicate a SHA1 has is not initialized. */ @@ -326,7 +326,7 @@ public: /* Description: - Make one or more calls to AccumulateBytes() as the sequenence of bytes is available. + Make one or more calls to AccumulateBytes() as the sequence of bytes is available. Parameters: buffer - [in] @@ -439,7 +439,7 @@ public: /* Description: - Accumuates the full and relative path names. + Accumulates the full and relative path names. */ void AccumulateFileReference( const class ON_FileReference& file_reference @@ -550,8 +550,8 @@ public: /* Returns: - SHA-1 hash value of the sequenence of ByteCount() bytes that have been - passed to this ON_SHA1 classe's Update() function since construction + SHA-1 hash value of the sequence of ByteCount() bytes that have been + passed to this ON_SHA1 class's Update() function since construction or the last call to Reset(). Remarks: You may use Hash() to compute intermediate SHA-1 hash values. @@ -606,7 +606,7 @@ private: /* Description: - Test speeds of various hash algoritmhs. + Test speeds of various hash algorithms. Parameters: byte_count - [in] Number of bytes to hash. This number is rounded up to the nearest multiple of 1024. @@ -638,7 +638,7 @@ void ON_TestHashSpeed( /* Description: - Test speeds of various hash algoritmhs and use text_log to print the results. + Test speeds of various hash algorithms and use text_log to print the results. Parameters: byte_count - [in] Number of bytes to hash. This number is rounded up to the nearest multiple of 1024. diff --git a/opennurbs_statics.cpp b/opennurbs_statics.cpp index ba2a81a2..cd048a59 100644 --- a/opennurbs_statics.cpp +++ b/opennurbs_statics.cpp @@ -120,7 +120,7 @@ Exceptions: If all exponent bits are all 0 (e = 0) and the fraction bits are all zero, then the value of the number is zero. If all exponent bits are all 0 (e = 0) and at least one fraction -bits is not zero, then the representaion is "denormalized". +bits is not zero, then the representation is "denormalized". In this case, the float absolute value is 0.f*2^-126 and the double absolute value is 0.f*2^-1022. If all exponent bits are 1 (float e = 11111111binary = 255decimal @@ -131,7 +131,7 @@ determines the sign of infinity. If all exponent bits are 1 and at least one fraction bit is not zero, the number is a "NaN" (not a number). If the most significant fraction bit is 1, the number is a quiet NaN or -"QNaN". If the most significan fraction bit is 0, the number +"QNaN". If the most significant fraction bit is 0, the number is a signalling NaN or "SNaN". Some authors (SH) QNaNs are used to indicate @@ -171,7 +171,7 @@ static double Internal_ON__dblinithelper(int i) } else { - // this sitation is not handled by this algorithm + // this situation is not handled by this algorithm // and that is a bug in the algorithm. ON_ERROR("CPU has unexpected bit pattern in double 2.0."); i7 = 0; @@ -245,7 +245,7 @@ static float Internal_ON__fltinithelper(int i) } else { - // this sitation is not handled by this algorithm + // this situation is not handled by this algorithm // and that is a bug in the algorithm. ON_ERROR("CPU has unexpected bit pattern in float 2.0f."); i3 = 0; @@ -356,7 +356,7 @@ int ON_DBL::CompareValue(double lhs, double rhs) int ON_DBL::Compare(const double* lhs, const double* rhs) { - // sort nullpt to the end + // sort nullptr to the end if (lhs == rhs) return 0; if (nullptr == lhs) @@ -394,7 +394,7 @@ const ON_SubDExpandEdgesParameters ON_SubDExpandEdgesParameters::Default; const ON_SubDComponentLocation ON_SubD::DefaultSubDAppearance = ON_SubDComponentLocation::Surface; -// The default type must be packed, unpacked, zero, or nan and should be packed or upacked. +// The default type must be packed, unpacked, zero, or nan and should be packed or unpacked. const ON_SubDTextureCoordinateType ON_SubD::DefaultTextureCoordinateType = ON_SubDTextureCoordinateType::Packed; @@ -442,8 +442,8 @@ const ON_UUID ON_SubD::CustomFacePackingId = { 0x91fd7018, 0x8bbe, 0x4492, { 0x8d, 0x2e, 0xe8, 0x76, 0x1c, 0x50, 0x5a, 0xcf } }; -// ON_SubD::DefaultFacePackingId must always identitify a built-in face packing -// algoritm. If a new built-in algorithm is developed that produces generally +// ON_SubD::DefaultFacePackingId must always identity a built-in face packing +// algorithm. If a new built-in algorithm is developed that produces generally // better packings and is as fast and reliable as the current default, then // ON_SubD::DefaultFacePackingId can be changed. Under no circumstances, should // the default be changed to anything that is more than 1.5 times slower than @@ -549,17 +549,17 @@ const ON_UUID ON_rhino8_id = { 0x868c63f5, 0x3760, 0x4a45,{ 0x86, 0x00, 0x53, 0x // in the core Rhino executable. const ON_UUID ON_rhino_id = ON_rhino8_id; -// Used to identifiy userdata read from V2 files +// Used to identify userdata read from V2 files // which were written before userdata had application ids. // {132F2340-DB90-494e-BF02-C36F0EA3197C} const ON_UUID ON_v2_userdata_id = { 0x132f2340, 0xdb90, 0x494e,{ 0xbf, 0x2, 0xc3, 0x6f, 0xe, 0xa3, 0x19, 0x7c } }; -// Used to identifiy userdata read from V3 files +// Used to identify userdata read from V3 files // which were written before userdata had application ids. // {4307B91D-6A9D-478e-B0A2-7C577997C663} const ON_UUID ON_v3_userdata_id = { 0x4307b91d, 0x6a9d, 0x478e,{ 0xb0, 0xa2, 0x7c, 0x57, 0x79, 0x97, 0xc6, 0x63 } }; -// Used to identifiy userdata read from V4 files +// Used to identify userdata read from V4 files // which were written before opennurbs 200609190 // required application ids. // {F73F2953-A244-44c2-B7C2-7E27390D1196} @@ -1056,7 +1056,7 @@ static ON_Plane Internal_ON_Plane_NanPlane() } const ON_Plane ON_Plane::NanPlane(Internal_ON_Plane_NanPlane()); -// ON_SubDDisplayParameters statics before ON_MeshParamters statics +// ON_SubDDisplayParameters statics before ON_MeshParameters statics const ON_SubDDisplayParameters ON_SubDDisplayParameters::Empty; const ON_SubDDisplayParameters ON_SubDDisplayParameters::ExtraCoarse = ON_SubDDisplayParameters::CreateFromDisplayDensity(ON_SubDDisplayParameters::ExtraCoarseDensity); const ON_SubDDisplayParameters ON_SubDDisplayParameters::Coarse = ON_SubDDisplayParameters::CreateFromDisplayDensity(ON_SubDDisplayParameters::CoarseDensity); @@ -1079,13 +1079,13 @@ static ON_MeshParameters Internal_ON_MeshParameters_Constants( // If you change any parameter values, put your name, the date, and the reasons for // the change in a comment by the changed value. Include the previous value in - // your comment. This is crtically important so we can keep track of what we are + // your comment. This is critically important so we can keep track of what we are // trying to accomplish. // // You must also update the mesh parameters file reading code so that settings with old defaults // are replaced with setting that have the new defaults AND old defaults get saved in earlier version // 3dm files. This requires somebody with a solid understanding of how ON_MeshParameters::Read()/Write() - // works, how saving earlier versions of 3dm fiels works, and how reading old version files works. + // works, how saving earlier versions of 3dm files works, and how reading old version files works. switch (selector) { @@ -1442,7 +1442,7 @@ ON_Font::ON_GetGlyphOutlineFuncType ON_Font::Internal_CustomGetGlyphOutlineFunc //ON_Font::ON_GetFontMetricsFuncType ON_Font::Internal_CustomGetFontMetricsFunc = ON_FreeTypeGetFontMetrics; //ON_Font::ON_GetGlyphOutlineFuncType ON_Font::Internal_CustomGetGlyphOutlineFunc = ON_FreeTypeGetGlyphOutline; -//// Used to test WIndows DWrite +//// Used to test Windows DWrite //#include "opennurbs_internal_glyph.h" //ON_Font::ON_GetGlyphMetricsFuncType ON_Font::Internal_CustomGetGlyphMetricsFunc = ON_WindowsDWriteGetGlyphMetrics; //ON_Font::ON_GetFontMetricsFuncType ON_Font::Internal_CustomGetFontMetricsFunc = ON_WindowsDWriteGetFontMetrics; @@ -2811,7 +2811,7 @@ void ON_SubD::SetAutomaticMeshToSubD( bool bAutomaticallyCreateSubD ) { - // remove possiblity of hacks to use this as a char value + // remove possibility of hacks to use this as a char value bAutomaticallyCreateSubD = bAutomaticallyCreateSubD ? true : false; switch (context) diff --git a/opennurbs_std_string.h b/opennurbs_std_string.h index 7ac1ea44..0336a340 100644 --- a/opennurbs_std_string.h +++ b/opennurbs_std_string.h @@ -118,7 +118,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -249,7 +249,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -366,7 +366,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -488,7 +488,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -623,7 +623,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -746,7 +746,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -882,7 +882,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1004,7 +1004,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1126,7 +1126,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1262,7 +1262,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point diff --git a/opennurbs_string.cpp b/opennurbs_string.cpp index b9f1e1ed..f3391c77 100644 --- a/opennurbs_string.cpp +++ b/opennurbs_string.cpp @@ -104,7 +104,7 @@ bool ON_String::IsValid( return true; for (;;) { - // These checks attempt to detect cases when the memory used for the header informtion + // These checks attempt to detect cases when the memory used for the header information // no longer contains valid settings. const char* s = m_s; if (nullptr == s) @@ -165,7 +165,7 @@ bool ON_String::IsValid( { // Because the ON_wString m_s[] array can have internal null elements, // the length test has to be enabled in situations where it is certain - // that we are in the common situation where m_s[] is a single null teminated + // that we are in the common situation where m_s[] is a single null terminated // sting and hdr->string_length is the m_s[] index of the null terminator. while (s < s1 && 0 != *s) s++; @@ -551,7 +551,7 @@ ON_String::ON_String( char c, int repeat_count ) return; } - if ( repeat_count > 0 ) + if ( repeat_count > 0 && c != 0) { ReserveArray(repeat_count); memset( m_s, c, repeat_count*sizeof(*m_s) ); @@ -586,7 +586,7 @@ ON_String::ON_String( unsigned char c, int repeat_count ) ON_ERROR("Requested size > ON_String::MaximumStringLength"); return; } - if ( repeat_count > 0 ) + if ( repeat_count > 0 && c != 0) { ReserveArray(repeat_count); memset( m_s, c, repeat_count*sizeof(*m_s) ); @@ -1487,7 +1487,7 @@ char* ON_String::Reverse( continue; } - // code points with multi char element encodeings need to be handled + // code points with multi char element encodings need to be handled ON_String_ReverseUTF8(string+i,j-i+1); break; } @@ -2331,7 +2331,7 @@ bool ON::IsDirectory( const char* utf8pathname ) rc = true; } #else - // this works on Apple and gcc implentations. + // this works on Apple and gcc implementations. struct stat buf; memset(&buf,0,sizeof(buf)); int stat_errno = stat( utf8pathname, &buf ); diff --git a/opennurbs_string.h b/opennurbs_string.h index 8423b2f9..1924d265 100644 --- a/opennurbs_string.h +++ b/opennurbs_string.h @@ -1036,7 +1036,7 @@ public: to a UTF encoded wide character string. Parameters: windows_code_page - [in] - WIndows code page. For example, big5 = 950. + Windows code page. For example, big5 = 950. Returns: A UTF encoded wide character string. See Also: @@ -1840,7 +1840,7 @@ public: is the standard format specification are supported. Avoid using %S (capital S). See the Remarks for details. ... - [in] - arguments for replacable items in the format string. + arguments for replaceable items in the format string. Returns: True if successful. False if the string is too long or the format string is not valid. @@ -3062,11 +3062,11 @@ public: ON_wString operator+(const unsigned char* sUTF8) const; // concatenate with a UTF-8 string ON_wString operator+(const wchar_t*) const; - // Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate + // Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically appropriate //ON_DEPRECATED // deprecation in progress int Compare( const wchar_t* ) const; - // Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate + // Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically appropriate // ON_DEPRECATED // deprecation in progress int CompareNoCase( const wchar_t* ) const; @@ -4333,7 +4333,7 @@ public: is the standard format specification are supported. Avoid using %S (capital S). See the Remarks for details. ... - [in] - arguments for replacable items in the format string. + arguments for replaceable items in the format string. Returns: True if successful. False if the string is too long or the format string is not valid. @@ -4596,7 +4596,7 @@ public: /* Description: Parses buffer to extract a number. - Sperscript and supscript numbers are supported. + Superscript and subscript numbers are supported. Returns: not zero: pointer to the first character that was not scanned @@ -4986,7 +4986,7 @@ class ON_CLASS ON_NameHash { public: /* - Default conststruction creates ON_NameHash::UnsetNameHash. + Default construction creates ON_NameHash::UnsetNameHash. */ ON_NameHash() = default; ~ON_NameHash() = default; diff --git a/opennurbs_string_compare.cpp b/opennurbs_string_compare.cpp index a6b74dbb..4de723f7 100644 --- a/opennurbs_string_compare.cpp +++ b/opennurbs_string_compare.cpp @@ -60,7 +60,7 @@ static ON__UINT32 MapCodePointOrdinal( ) { // Converts ordinal "char" and "wchar_t" element values in the - // range 0x00 to maximum_singleton_value to "ingore case" ordinal equivalents. + // range 0x00 to maximum_singleton_value to "ignore case" ordinal equivalents. // The returned value is always <= input value. // // This is NOT linguistic and NOT culture invariant. @@ -492,7 +492,7 @@ static unsigned int OrdinalUnsignedToIgnoreCase( { // RH-41224 // map A -> a, ..., Z -> z so underbar is before any "letter". - // The preserves the behavoir of Rhino component name sorting + // The preserves the behavior of Rhino component name sorting // that used "ancient" C runtime ASCII sorts. const ON_StringMapOrdinalType map_type = ( c <= 0x7A && c >= 0x41 && maximum_singleton_value >= 0x7A ) diff --git a/opennurbs_string_format.cpp b/opennurbs_string_format.cpp index 549ac0df..710cd1e7 100644 --- a/opennurbs_string_format.cpp +++ b/opennurbs_string_format.cpp @@ -231,7 +231,7 @@ const ON_String ON_String::ApproximateFromNumber( // thate are 300 digits long when a 1e300 comes by. if (ON_String::FormatIntoBuffer(buffer, sizeof(buffer) / sizeof(buffer[0]), "%f", d) > 0) return ON_String(buffer); - // It may be that 64 elements were not enought for %f format if the "reasonable range" + // It may be that 64 elements were not enough for %f format if the "reasonable range" // test is not good enough. We try again with "%g". } if (ON_String::FormatIntoBuffer(buffer, sizeof(buffer) / sizeof(buffer[0]), "%g", d) > 0) diff --git a/opennurbs_string_values.cpp b/opennurbs_string_values.cpp index 20b0e569..41064a94 100644 --- a/opennurbs_string_values.cpp +++ b/opennurbs_string_values.cpp @@ -207,7 +207,7 @@ double ON_CleanValueTolerance( if (clean_value_tolerance > 1.0 / 512.0) clean_value_tolerance = 1.0 / 512.0; const double a = fabs(value); - // The relative tolerance 256.0*ON_EPSILON*a is reqired in order for all (1+/- ON_EPSILON)*value where + // The relative tolerance 256.0*ON_EPSILON*a is required in order for all (1+/- ON_EPSILON)*value where // value is one of the rational numbers with denominators // 2,3,4,8,10,16,32,64,128 and numerators from 1 to 2*denominator to be "cleaned up} // to numerator/denominator. diff --git a/opennurbs_subd.cpp b/opennurbs_subd.cpp index 45db3ebc..769bb160 100644 --- a/opennurbs_subd.cpp +++ b/opennurbs_subd.cpp @@ -1319,6 +1319,37 @@ const ON_3dPoint ON_SubDComponentPtr::ControlNetCenterPoint() const return ON_3dPoint::NanPoint; } +const ON_3dPoint ON_SubDComponentPtr::SubdivisionPoint() const +{ + switch (ON_SUBD_COMPONENT_TYPE_MASK & m_ptr) + { + case ON_SUBD_COMPONENT_TYPE_VERTEX: + { + const ON_SubDVertex* v = Vertex(); + if (nullptr != v) + return v->SubdivisionPoint(); + } + break; + case ON_SUBD_COMPONENT_TYPE_EDGE: + { + const ON_SubDEdge* e = Edge(); + if (nullptr != e) + return e->SubdivisionPoint(); + } + break; + case ON_SUBD_COMPONENT_TYPE_FACE: + { + const ON_SubDFace* f = Face(); + if (nullptr != f) + return f->SubdivisionPoint(); + } + break; + } + return ON_3dPoint::NanPoint; +} + + + const ON_BoundingBox ON_SubDComponentPtr::ControlNetBoundingBox() const { switch (ON_SUBD_COMPONENT_TYPE_MASK & m_ptr) @@ -1740,7 +1771,7 @@ void ON_SubDComponentId::Internal_SetType(ON_SubDComponentPtr::Type type) void ON_SubDComponentId::Internal_SetDir(unsigned dir) { - // invalid dir is treaded as 0 + // invalid dir is treated as 0 if (1 == dir) m_type_and_dir |= ((unsigned char)ON_SubDComponentId::bits_dir_mask); else @@ -2315,7 +2346,7 @@ class ON_SubDComponentBase* ON_SubDComponentPtr::ComponentBase() const // This is in a controlled setting inside functions like ON_SubDArchiveIdMap::ConvertArchiveIdToRuntimeSymmetrySetNextPtr(). // All public level SDK code can safely assume the returned value is a true pointer. // It does mean that you cannot "validate" the value returned here - // using some contraint on what you feel is a reasonable true pointer value. + // using some constraint on what you feel is a reasonable true pointer value. return ((class ON_SubDComponentBase*)ON_SUBD_COMPONENT_POINTER(m_ptr)); break; } @@ -2930,7 +2961,7 @@ const ON_SubDComponentPoint ON_SubDComponentPoint::BestPickPoint( ) { // If you're working on a bug where somebody isn't able to pick the SubD component - // they thinked they clicked on, then you're in the right place. + // they thought they clicked on, then you're in the right place. // Mikko has done lots of work in this area and be sure to retest RH-52172 and RH-52173 (fixed 3 May 2019). // Also, retest RH-59666 (fixed August 2020). // @@ -2963,7 +2994,7 @@ const ON_SubDComponentPoint ON_SubDComponentPoint::BestPickPoint( && ((type_bias >= 0) ? Internal_FirstIsPartOfSecond(A, B) : Internal_FirstIsPartOfSecond(B, A)) ) { - // A point pick is occuring and best is a vertex on an edge/face or best is an edge on a face. + // A point pick is occurring and best is a vertex on an edge/face or best is an edge on a face. // Bias towards the vertex/edge. // Users can pick the middle of an edge/face if they want the "bigger" component. ON_SubDComponentPoint best = (type_bias >= 0) ? A : B; @@ -4889,6 +4920,9 @@ double ON_SubDEdgeSharpness::Sanitize( const ON_SubDEdgeSharpness ON_SubDEdgeSharpness::Subdivided(int end_index) const { + if (this->IsCrease()) + return ON_SubDEdgeSharpness::Crease; + if (end_index >= 0 && end_index <= 1) { const double s[2] = { @@ -4978,7 +5012,7 @@ double ON_SubDEdgeSharpness::VertexSharpness( ) { // NOTE WELL: - // For edge chains with a contant sharpness, this agrees with DKT SIGGRAPH 1998. + // For edge chains with a constant sharpness, this agrees with DKT SIGGRAPH 1998. // For edge chains with variable sharpness, having a sharpness interval on the // edge with end values matching at shared vertices gives nicer looking results // than assigning a constant sharpness to edges and Chaikin's subdivision rule @@ -5251,7 +5285,7 @@ void ON_SubDVertex::Internal_SetInteriorCreaseVertexSharpnessForExperts( { // This is a 2 sector crease vertex and is exactly // the case where m_crease_sector_vertex_sharpness is useful. - // If the sectors have different maximum edge end shaprnesses at this + // If the sectors have different maximum edge end sharpnesses at this // vertex, then this value is critical. The sector with the smaller // maximum edge end sharpness must use this value when the // vertex subdivision point is calculated so the subdivision @@ -5282,10 +5316,10 @@ void ON_SubDVertex::Internal_SetInteriorCreaseVertexSharpnessForExperts( // during low level evaluation where a copy of 1 side of a 2 sector crease // is being created so limit surface information can be calculated. // - // Each case is separated out so it's posible to surgically debug with simple breakpoints. + // Each case is separated out so it's possible to surgically debug with simple breakpoints. if (bOneSector) { - // One sector of a level 0 bertex is being copied and the expert caller + // One sector of a level 0 vertex is being copied and the expert caller // set bSkipEdgeCountTest=true to inform us this is a special case. // One place this happens is in // ON_SubDVertexQuadSector::Initialize(ON_SubDVertexTag center_vertex_tag, double center_vertex_sharpness, ...). @@ -5293,7 +5327,7 @@ void ON_SubDVertex::Internal_SetInteriorCreaseVertexSharpnessForExperts( } else if (0 == m_edge_count && 0 == m_face_count) { - // A vertex is being bopied, the edges and faces have not been attached yet, + // A vertex is being copied, the edges and faces have not been attached yet, // and the expert caller set bSkipEdgeCountTest=true to inform us this is a // special case. // One place this happens is in @@ -5329,13 +5363,13 @@ void ON_SubDVertex::Internal_ClearInteriorCreaseVertexSharpnessForExperts() cons static double Internal_VertexSharpnessCalculationHelper( const ON_SubDVertex* v, // caller insures v is not nullptr unsigned int sharp_edge_count, // caller insures sharp_edge_count is valid - double max_end_sharpeness // caller insures max_end_sharpeness is valid + double max_end_sharpeness // caller insures max_end_sharpness is valid ) { - // In low level evluation code, interior crease vertices - // only have informtion from one sector and we need the value + // In low level evaluation code, interior crease vertices + // only have information from one sector and we need the value // calculated from both sectors. In all other cases, the - // value of max_end_sharpeness calculated above is the + // value of max_end_sharpness calculated above is the // correct value to use. const bool bIsOneSectorCrease = v->IsOneSectorCrease(); const double two_sector_crease_vertex_sharpness @@ -5410,7 +5444,7 @@ double ON_SubDVertex::VertexSharpness() const } - // DEBUG TEST to make sure the condtion descried in the comment above is satisfied. + // DEBUG TEST to make sure the condition descried in the comment above is satisfied. // DO NOT COMMIT THIS CODE - IT IS FOR TESTING WHILE DEVELOPING // ON_3dPoint sharp_subdivision_point; // const double check = GetSharpSubdivisionPoint(sharp_subdivision_point); @@ -5441,7 +5475,7 @@ double ON_SubDVertex::GetSharpSubdivisionPoint(ON_3dPoint& sharp_subdivision_poi case 2: sharp_subdivision_point = c[0] * v[0]->ControlNetPoint() - + c[1]*v[1]->ControlNetPoint(); + + c[1] * v[1]->ControlNetPoint(); break; case 3: sharp_subdivision_point @@ -5473,7 +5507,7 @@ double ON_SubDVertex::GetSharpSubdivisionPoint( // and a nonzero sharpness at the end attached to this vertex. // This definition of vertex sharpness is from DeRose, Kass, Truong 1998. // - If the vertex is smooth and adjacent to zero or one sharp edges, - // then the ordindary vertex subdivision rule is used, + // then the ordinary vertex subdivision rule is used, // sharp_subdivision_point is set to NanPoint, // and 0.0 is returned. // - If the vertex is adjacent to 3 or more sharp edges and crease edges, @@ -5484,7 +5518,7 @@ double ON_SubDVertex::GetSharpSubdivisionPoint( // then sharp_subdivision_point = crease vertex subdivision point, // and the average of the edge sharpnesses is returned. // - // The returned vertex sharpenss is awasy >= 0. + // The returned vertex sharpens is always >= 0. // When the returned vertex sharpness is > 0, the vertex subdivision point // (1-s)*(ordinary subdivision point) + s*sharp_subdivision_point, // where s = min(returned vertex sharpness, 1). @@ -5492,7 +5526,7 @@ double ON_SubDVertex::GetSharpSubdivisionPoint( // NOTE WELL: // The double returned by ON_SubDVertex::VertexSharpness() must - // always be identical to the double returned by this funciton. + // always be identical to the double returned by this function. // // ALWAYS CHANGE THE CODE IN ON_SubDVertex::GetSharpSubdivisionPoint() first // and then update ON_SubDVertex::VertexSharpness() as needed. @@ -6096,7 +6130,7 @@ bool ON_SubDVertex::IsStandard() const return false; } - // The standard subdivison matrix will correctly calculate + // The standard subdivision matrix will correctly calculate // the subdivision location for this vertex. return true; } @@ -7637,7 +7671,7 @@ ON_SubDVertexTag ON_SubDVertex::SuggestedVertexTag( return ON_SubDVertexTag::Smooth; if (bReturnBestGuessWhenInvalid) { - // can occure when there is a nullptr edge + // can occur when there is a nullptr edge best_guess_tag = ON_SubDVertexTag::Smooth; } break; @@ -8124,7 +8158,7 @@ const ON_SubDHash ON_SubDimple::SubDHash( if (0 == vertex_count) return ON_SubDHash::Empty; - // m_subd_toplologyX_hash, m_subd_toplology_and_edge_crease_hash, and m_subd_geometry_hash + // m_subd_topologyX_hash, m_subd_topology_and_edge_crease_hash, and m_subd_geometry_hash // are mutable and use lazy evaluation to stay updated. // subd.GeometryContentSerialNumber() is used to detect stale values. ON_SubDHash* h; @@ -8162,7 +8196,7 @@ const ON_SubDHash ON_SubDimple::SubDHash( && face_count == h->FaceCount() ) { - // The chache hash values are up to date (or should be). + // The cache hash values are up to date (or should be). // If h is out of date, something somewhere modified the SubD components and // failed to change the GeometryContentSerialNumber(). // All C++ SDK opennurbs code changes gsn after modifying SubD geometry (or it's a bug that should be fixed). @@ -9062,7 +9096,7 @@ bool ON_SubDimple::IsValidLevel( if ( e_id_range[1] > MaximumEdgeId() ) return ON_SubDIsNotValid(bSilentError); - // As of NOvember 12, 2019 + // As of November 12, 2019 // Wire edges are permitted. THey exist in subds being edited. ////// currently, wire edges are not permitted ////if (wire_edge_count > 0) @@ -9508,7 +9542,7 @@ unsigned int ON_SubD::DumpTopology( subd_texture_settings_hash.Dump(text_log); text_log.PrintNewLine(); - // runtime settings most recentltly used to set fragmant texture coordinates. + // runtime settings most recently used to set fragment texture coordinates. const ON_SHA1_Hash frament_texture_settings_hash = this->FragmentTextureCoordinatesTextureSettingsHash(); text_log.Print(L"FragmentTextureCoordinatesTextureSettingsHash() = "); if (subd_texture_settings_hash == frament_texture_settings_hash) @@ -11900,6 +11934,22 @@ class ON_SubDLevel* ON_SubD::ActiveLevelPointer() return (nullptr != subdimple) ? subdimple->ActiveLevelPointer() : nullptr; } +const class ON_SubDLevel& ON_SubD::LevelForExperts(unsigned int level_index) const +{ + for (;;) + { + ON_SubDimple* subdimple = m_subdimple_sp.get(); + if (nullptr == subdimple) + break; + ON_SubDLevelIterator lit = subdimple->LevelIterator(); + for (ON_SubDLevel* level = lit.First(); nullptr != level; level = lit.Next()) + { + if (level_index == level->m_level_index) + return *level; + } + } + return ON_SubDLevel::Empty; +} ON_SubDimple* ON_SubD::SubDimple(bool bCreateIfNeeded) { @@ -13288,6 +13338,13 @@ const ON_3dPoint ON_SubDFace::SubdivisionPoint() const return (GetSubdivisionPoint(&S.x) && S.IsValid()) ? S : ON_3dPoint::NanPoint; } +const ON_3dPoint ON_SubDFacePtr::SubdivisionPoint() const +{ + const ON_SubDFace* f = this->Face(); + return (nullptr != f) ? f->SubdivisionPoint() : ON_3dPoint::NanPoint; +} + + bool ON_SubDFace::GetSubdivisionPoint( double subdivision_point[3] ) const @@ -13326,7 +13383,7 @@ bool ON_SubDFace::EvaluateCatmullClarkSubdivisionPoint(double subdivision_point[ // Use faster code for the case when the face is a quad. // Since this is a Catmull-Clark subdivision scheme, this // case is the most common by far and code that gives quads - // special treatment will run noticably faster. + // special treatment will run noticeably faster. e_ptr = edge_ptr[0].m_ptr; e = ON_SUBD_EDGE_POINTER(e_ptr); if ( nullptr == e || nullptr == e->m_vertex[0] || nullptr == e->m_vertex[1] ) @@ -14366,6 +14423,7 @@ const ON_3dPoint ON_SubDEdge::SubdivisionPoint() const return (GetSubdivisionPoint(&S.x) && S.IsValid()) ? S : ON_3dPoint::NanPoint; } + bool ON_SubDEdge::GetSubdivisionPoint( double subdivision_point[3] ) const @@ -15188,6 +15246,8 @@ const ON_3dPoint ON_SubDVertex::SubdivisionPoint() const return (GetSubdivisionPoint(&S.x) && S.IsValid()) ? S : ON_3dPoint::NanPoint; } + + bool ON_SubDVertex::GetSubdivisionPoint( double subdivision_point[3] ) const @@ -15545,7 +15605,7 @@ bool ON_SubDimple::LocalSubdivide( ON_SimpleArray faces(face_count); ON_SimpleArray face_points(face_count); - // this subd is being modifed. + // this subd is being modified. ChangeGeometryContentSerialNumber( false); for (const ON_SubDFace* f0 = level0.m_face[0]; nullptr != f0; f0 = f0->m_next_face) @@ -15605,7 +15665,7 @@ bool ON_SubDimple::LocalSubdivide( // as opposed to a global subdivision level operation. It will be common // for the input to include some but not all sharp edges. // Dale Lear's best guess on Nov 9, 2022 is that - // reusing the orginal sharpness is the best way to maximize overall + // reusing the original sharpness is the best way to maximize overall // user happiness. This makes some sense because the level of the edges // is not changing in a LOCAL subdivide. // It is a near certainty that some users will not like this in some cases. @@ -15917,11 +15977,11 @@ static bool Internal_SubdivideFacePacking( // those rectangle are assigned the original pack id. This works because neighboring // quad faces that belong to the same pack will also be subdivided into 4 quads // and the requirement that multi-face pack MUST be a set of quads that form a - // rectangular topological grid will be satisified in the globally subdivided SubD. + // rectangular topological grid will be satisfied in the globally subdivided SubD. // // When f0 is a triangle, f0 necessarily is the on face with its pack id (because it cannot // possibly be grouped with other quads - see NOTE WELL above). - // In addition, for tiranglular faces, packed textures are assigned to the trianglular face + // In addition, for triangular faces, packed textures are assigned to the triangular face // in a way that the first two sub quads can become a single two quad pack and can reuse the f0->PackId(). // The third subquad gets a new pack id. @@ -16192,7 +16252,7 @@ unsigned int ON_SubDimple::Internal_GlobalQuadSubdivideFace( // sub_quads != nullptr if and only if f0 has texture packing information // that needs to be subdivided. // - // The existing pack rect needs to be subdivided and assinged to the subdivided faces + // The existing pack rect needs to be subdivided and assigned to the subdivided faces if (f0_edge_count == f1_count) Internal_SubdivideFacePacking(f0, f0_edge_count, f0_pack_id, next_pack_id, sub_quads ); @@ -16535,14 +16595,14 @@ static bool Internal_EdgesAreConsecutive( const double miniscule_distance_tolerance = ON_ZERO_TOLERANCE; if (h <= miniscule_distance_tolerance && !(distance_tolerance >= 0.0 && distance_tolerance < miniscule_distance_tolerance)) { - // skip parameter tests for miniscule h. + // skip parameter tests for minuscule h. return true; } const double miniscule_maximum_aspect = 1e-4; if (h <= miniscule_maximum_aspect * d && !(maximum_aspect >= 0.0 && maximum_aspect < miniscule_maximum_aspect)) { - // skip parameter tests for miniscule h/d. + // skip parameter tests for minuscule h/d. return true; } @@ -17515,7 +17575,7 @@ const ON_SubDEdge* ON_SubDimple::SplitFace( new_edge_count[0] = fvi0 - fvi1 + 1; new_edge_count[1] = (edge_count + 2) - new_edge_count[0]; } - // make sure each side is at least a triangle and no overflows occured + // make sure each side is at least a triangle and no overflows occurred if (new_edge_count[0] < 3 || new_edge_count[0] >= edge_count) return ON_SUBD_RETURN_ERROR(nullptr); if (new_edge_count[1] < 3 || new_edge_count[1] >= edge_count) @@ -18687,7 +18747,7 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const const unsigned src_level_index = src.m_level_index; // It is critical to use the this_vit/src_vit iterators so we got through the vertices in id order. - // When a copy of an editied subd is made, it is frequently the case that the vertex linked lists + // When a copy of an edited subd is made, it is frequently the case that the vertex linked lists // are in different order. ON_SubDVertexIdIterator this_vit; ON_SubDVertexIdIterator src_vit; @@ -18744,7 +18804,7 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const return ON_SUBD_RETURN_ERROR(false); // It is critical to use the this_eit/src_eit iterators so we got through the edges in id order. - // When a copy of an editied subd is made, it is frequently the case that the edge linked lists + // When a copy of an edited subd is made, it is frequently the case that the edge linked lists // are in different order. ON_SubDEdgeIdIterator this_eit; ON_SubDEdgeIdIterator src_eit; @@ -18807,7 +18867,7 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const return ON_SUBD_RETURN_ERROR(false); // It is critical to use the this_fit/src_fit iterators so we got through the faces in id order. - // When a copy of an editied subd is made, it is frequently the case that the face linked lists + // When a copy of an edited subd is made, it is frequently the case that the face linked lists // are in different order. ON_SubDFaceIdIterator this_fit; ON_SubDFaceIdIterator src_fit; @@ -18857,13 +18917,13 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const if (false == bCopyVertexCache && false == bCopyEdgeCache && false == bCopyFaceCache) return false; - // this and src subd have identical geometry - copy evluation cache + // this and src subd have identical geometry - copy evaluation cache double subdivision_point[3]; if (bCopyVertexCache) { // It is critical to use the this_vit/src_vit iterators so we got through the vertices in id order. - // When a copy of an editied subd is made, it is frequently the case that the vertex linked lists + // When a copy of an edited subd is made, it is frequently the case that the vertex linked lists // are in different order. ON_SubDSectorSurfacePoint this_limit_point; for ( @@ -18900,7 +18960,7 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const if (bCopyEdgeCache) { // It is critical to use the this_eit/src_eit iterators so we got through the edges in id order. - // When a copy of an editied subd is made, it is frequently the case that the edge linked lists + // When a copy of an edited subd is made, it is frequently the case that the edge linked lists // are in different order. ON_SimpleArray edge_curve_cvs(ON_SubDEdgeSurfaceCurve::MaximumControlPointCapacity); for ( @@ -18921,7 +18981,7 @@ bool ON_SubDLevel::CopyEvaluationCacheForExperts( ON_SubDHeap& this_heap, const if (bCopyFaceCache) { // It is critical to use the this_fit/src_fit iterators so we got through the faces in id order. - // When a copy of an editied subd is made, it is frequently the case that the face linked lists + // When a copy of an edited subd is made, it is frequently the case that the face linked lists // are in different order. for ( this_face = const_cast(this_fit.FirstFaceOnLevel(this_level_index)), src_face = src_fit.FirstFaceOnLevel(src_level_index); @@ -19103,7 +19163,7 @@ bool ON_SubD::DeleteComponentsForExperts( cptr.ClearStates(ON_ComponentStatus::Damaged); } - // Set the status of every compoent in cptr_list[] to ON_ComponentStatus::AllSet. + // Set the status of every component in cptr_list[] to ON_ComponentStatus::AllSet. // If that component is a vertex, set the status of every edge and face that // touch the vertex to ON_ComponentStatus::AllSet. // If that component is an edge, set the status of every face that @@ -21672,11 +21732,11 @@ static unsigned int Internal_MarkExtrudeComponents( list_face_count ); - // It appears the best "hurestic" is to require the user to pick edges and faces. + // It appears the best "heuristic" is to require the user to pick edges and faces. // isolated vertices will be ignored and no attempts to guess if a user wants to // extrude the boundary of a face (all its edges) or the face itself. - // lots of delete "hurestic" code here :) + // lots of delete "heuristic" code here :) return marked_vertex_count; } @@ -22762,7 +22822,7 @@ static bool Internal_SetSideGroupIds(ON_SimpleArray& n if (false == new_sides[i].SetSideGroupId(side_group_id)) continue; - // propogate side_group_id through all touching components + // propagate side_group_id through all touching components unsigned j0 = i + 1; for (bool bContinue = true; bContinue; /*empty iterator*/) { @@ -23008,7 +23068,7 @@ unsigned int ON_SubD::Internal_ExtrudeComponents( } // Partially setting the topology connections here reduces the number of binary searches by about half. - // The scecond paramter is false because the sorting of extruded_vertices[] will change the memory + // The second parameter is false because the sorting of extruded_vertices[] will change the memory // location where extruded_vertex is stored. if (false == extruded_vertex.AddExtrudedEdgeReference(&extruded_edge, false)) return 0; @@ -23150,7 +23210,7 @@ unsigned int ON_SubD::Internal_ExtrudeComponents( } } - // For the original boundary vertrex, move unmarked edges to use the new vertex. + // For the original boundary vertex, move unmarked edges to use the new vertex. for (unsigned int i = 0; i < extruded_vertices.UnsignedCount(); i++) Internal_SetEdgeVertices(*this, extruded_vertices[i]); @@ -23377,7 +23437,7 @@ unsigned int ON_SubD::SetVertexTags( } else { - // dont' attempt change - further refinement may be needed here + // don't attempt change - further refinement may be needed here continue; } } @@ -23426,7 +23486,7 @@ unsigned int ON_SubD::SetVertexTags( // This for loop is used when new vertex_tag is ON_SubDVertexTag::Crease. for (int pass = 0; pass < 2 && false == bUpdateTags; pass++) { - // More careful analysis is neeeded to accurately mark smooth edges that will become creases + // More careful analysis is needed to accurately mark smooth edges that will become creases ON_SubDEdgeIterator eit(*this); for (const ON_SubDEdge* edge = eit.FirstEdge(); nullptr != edge; edge = eit.NextEdge()) { @@ -24391,7 +24451,7 @@ bool ON_SubDEdgeChain::GetSideComponents( ) { // rearrange side_components[] so it begins with first_side_components_eptr. - // This elimnates the complexity of having to begin/end a SubD fillet + // This eliminates the complexity of having to begin/end a SubD fillet // at a ... f,v,f ... location. const ON_SubDFace* f = side_components[0].Face(); if (nullptr == f) @@ -25509,9 +25569,9 @@ static unsigned Internal_MuchImprovedSortEdgesIntoChains( if (nullptr == seed_edge || 1 != seed_edge->MarkBits()) continue; // seed_edge is invalid or already assigned to an edge chain - // this edge pointer direcion will be reversed when the for loop evi = 1. + // this edge pointer direction will be reversed when the for loop evi = 1. chain.SetCount(0); - chain.Append(ON_SubDEdgePtr::Create(seed_edge, 1)); // dir=1 is correct. The direcion will be reversed in the for loop below when evi = 1. + chain.Append(ON_SubDEdgePtr::Create(seed_edge, 1)); // dir=1 is correct. The direction will be reversed in the for loop below when evi = 1. seed_edge->ClearMarkBits(); // seed_edge is now in a chain for (unsigned evi = 0; evi < 2; ++evi) @@ -26290,7 +26350,7 @@ bool ON_SubDEdgeChain::IsSingleEdgeChain( ); if (1U != chain_count) - break; // edges[] is not a contiguouse set of edges or it self intersects. + break; // edges[] is not a contiguous set of edges or it self intersects. if (count + 1U != sorted_edges.UnsignedCount()) break; // edges[] contained null edges @@ -26299,7 +26359,7 @@ bool ON_SubDEdgeChain::IsSingleEdgeChain( bIsClosed = true; // Determine edges[] is was already sorted. - // Note that this test does not detect self interections and that's + // Note that this test does not detect self intersections and that's // why ON_SubDEdgeChain::SortEdgesIntoEdgeChains() is called above. const ON_SubDVertex* v0 = edges[0].RelativeVertex(0); if (nullptr != v0) @@ -26824,7 +26884,7 @@ unsigned int ON_SubDEdgeChain::SortEdgesIntoEdgeChains( ); } - // Sort links[] by m_index valut to restore links[] to its original order. + // Sort links[] by m_index value to restore links[] to its original order. links.QuickSort(ON_SubDEdgePtrLink::CompareIndex); ON_SubDEdgePtrLink* links_array = links.Array(); @@ -28002,7 +28062,7 @@ ON_SubDFace* ON_SubD::FindOrAddFace( return ON_SUBD_RETURN_ERROR(nullptr); - // Mkae sure v[] has vertex_count unique non-null vertices. + // Make sure v[] has vertex_count unique non-null vertices. for (unsigned i = 0; i < vertex_count; ++i) { if (nullptr == face_vertices[i]) diff --git a/opennurbs_subd.h b/opennurbs_subd.h index aa64b732..38086708 100644 --- a/opennurbs_subd.h +++ b/opennurbs_subd.h @@ -96,7 +96,7 @@ enum class ON_SubDTextureCoordinateType : unsigned char /// /// ON_SubDVertexTag identifies the type of subdivision vertex. Different tags use /// different subdivision algorithms to determine where the subdivision point and -/// limit point are located. There are toplological constraints that restrict which +/// limit point are located. There are topological constraints that restrict which /// tags can be assigned. /// enum class ON_SubDVertexTag : unsigned char @@ -340,7 +340,7 @@ public: /// /// ON_SubDEdgeSharpness::SmoothValue = 0.0. /// Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. - /// Smooth edges have a sharpeness property of ON_SubDEdgeSharpness::Smooth. + /// Smooth edges have a sharpness property of ON_SubDEdgeSharpness::Smooth. /// static const double SmoothValue; @@ -349,7 +349,7 @@ public: /// Valid SubD edge sharpness values are <= ON_SubDEdgeSharpness::MaximumValue. /// This value is used when it is convenient to use and ON_SubDEdgeSharpness to /// indicate an edge has a crease tag. Edges with crease tags always have a - /// sharpeness property of ON_SubDEdgeSharpness::Smooth. + /// sharpness property of ON_SubDEdgeSharpness::Smooth. /// static const double CreaseValue; @@ -361,13 +361,13 @@ public: static const double Tolerance; /// - /// An edge sharpness with contant value 0.0. + /// An edge sharpness with constant value 0.0. /// static const ON_SubDEdgeSharpness Smooth; /// - /// An edge sharpness with contant value ON_SubDEdgeSharpness::MaximumValue. + /// An edge sharpness with constant value ON_SubDEdgeSharpness::MaximumValue. /// This is the maximum sharpness that can be applied to an edge. /// static const ON_SubDEdgeSharpness Maximum; @@ -376,7 +376,7 @@ public: /// An edge sharpness with both end values = ON_SubDEdgeSharpness::CreaseValue. /// This value is not a valid sharpness value for a sharp edge /// (A sharp edge a smooth edge with nonzero sharpness). - /// When working with edges, it is sometimes convienient to have + /// When working with edges, it is sometimes convenient to have /// an ON_SubDEdgeSharpness value that indicated the edge is a crease. /// ON_SubDEdgeSharpness::Crease is used for this purpose. /// @@ -404,8 +404,8 @@ public: /// /// Create a text string describing the sharpness as a percentage. - /// This is useful in user interface code that experesses sharpness in percentages. - /// If 0 <= sharpenss <= ON_SubDEdgeSharpness::MaximumValue, + /// This is useful in user interface code that expresses sharpness in percentages. + /// If 0 <= sharpness <= ON_SubDEdgeSharpness::MaximumValue, /// valid, a number followed by a percent sign is returned. /// If sharpness = ON_SubDEdgeSharpness::CreaseValue, "crease" is returned. /// If the sharpness is not valid, a warning sign is returned. @@ -2087,6 +2087,8 @@ public: /// Catmull-Clark edge subdivision point. const ON_3dPoint SubdivisionPoint() const; + + void ClearSavedSubdivisionPoints() const; /* @@ -2390,6 +2392,12 @@ public: bool bClearNeighborhood ) const; + /// + /// The SubD face Catmull-Clark subdivision point. + /// + const ON_3dPoint SubdivisionPoint() const; + + }; ON_DECL @@ -2574,6 +2582,7 @@ public: const ON_3dPoint ControlNetCenterPoint() const; const ON_BoundingBox ControlNetBoundingBox() const; + const ON_3dPoint SubdivisionPoint() const; /* Returns: @@ -9308,6 +9317,19 @@ public: ON_DEPRECATED_MSG("Use ON_SubD::SetColorsMappingTag()") void SetFragmentColorsMappingTag(const class ON_MappingTag&) const; +public: + const class ON_SubDLevel& ActiveLevel() const; + + /// + /// If a level exists, get it + /// + /// + /// + /// If the specified level exists, it is returned. + /// Otherwise ON_SubDLevel::Empty is returned. + /// + const class ON_SubDLevel& LevelForExperts(unsigned int level_index) const; + public: /* Description: @@ -9322,7 +9344,6 @@ public: ON_SubDimple* pointer, then your code will crash unpredictably. */ const class ON_SubDimple* SubDimple() const; - const class ON_SubDLevel& ActiveLevel() const; unsigned int SubDimpleUseCount() const; void ShareDimple(const ON_SubD&); @@ -14715,6 +14736,7 @@ public: /// const ON_3dPoint SubdivisionPoint() const; + /* Description: Evaluates the Catmull-Clark subdivision point ignoring all cached information. @@ -15823,6 +15845,7 @@ public: /// Catmull-Clark edge subdivision point. const ON_3dPoint SubdivisionPoint() const; + /* Description: Evaluates the Catmull-Clark subdivision point ignoring all cached information. @@ -16997,6 +17020,7 @@ public: /// The SubD face Catmull-Clark subdivision point. /// const ON_3dPoint SubdivisionPoint() const; + /* Description: @@ -17284,7 +17308,17 @@ public: // ON_SubDVertexIterator vit = subd.VertexIterator(); ON_SubDVertexIterator( const class ON_SubD& subd - ); + ); + + /// + /// An expert tool to iteratate over existing vertices on a specified level. + /// + /// + /// + ON_SubDVertexIterator( + const class ON_SubD& subd, + unsigned level_index + ); // The best way to get an ON_SubDVertexIterator is so use the ON_SubD member function // ON_SubDVertexIterator vit = subd.VertexIterator(); @@ -17549,6 +17583,16 @@ public: const class ON_SubD& subd ); + /// + /// An expert tool to iteratate over existing edges on a specified level. + /// + /// + /// + ON_SubDEdgeIterator( + const class ON_SubD& subd, + unsigned level_index + ); + // The best way to get an ON_SubDEdgeIterator is so use the ON_SubD member function // ON_SubDEdgeIterator eit = subd.EdgeIterator(); ON_SubDEdgeIterator( @@ -17812,6 +17856,16 @@ public: const class ON_SubD& subd ); + /// + /// An expert tool to iteratate over existing faces on a specified level. + /// + /// + /// + ON_SubDFaceIterator( + const class ON_SubD& subd, + unsigned level_index + ); + // The best way to get an ON_SubDFaceIterator is so use the ON_SubD member function // ON_SubDFaceIterator fit = subd.FaceIterator(); ON_SubDFaceIterator( diff --git a/opennurbs_subd_archive.cpp b/opennurbs_subd_archive.cpp index 7728b108..9f3ea9a1 100644 --- a/opennurbs_subd_archive.cpp +++ b/opennurbs_subd_archive.cpp @@ -1054,7 +1054,7 @@ bool ON_SubDFace::Write( break; } - // Custom texture coordintes + // Custom texture coordinates const bool bTexturePoints = this->TexturePointsAreSet(); if (false == Internal_WriteComponentAdditionSize(bTexturePoints, archive, 4)) break; @@ -1125,7 +1125,7 @@ bool ON_SubDFace::Read( break; ON_SubDFace* f = subdimple->AllocateFace( - base.m_id, // serialzation must preserve ON_SubDFace.m_id + base.m_id, // serialization must preserve ON_SubDFace.m_id base.SubdivisionLevel(), edge_count ); @@ -1225,7 +1225,7 @@ bool ON_SubDFace::Read( } - // Custom texture coordintes + // Custom texture coordinates sz = 0; if (false == Internal_ReadComponentAdditionSize(archive, 4, &sz)) break; @@ -1247,7 +1247,7 @@ bool ON_SubDFace::Read( ON_3dPoint a[10]; bool bContinue = true; - // Even if allocaion fails, we need to read the points so we can get get + // Even if allocation fails, we need to read the points so we can get get // future information that is after the points out of the archive. subdimple->AllocateFaceTexturePoints(f); ON_3dPoint* tp = f->m_texture_points; @@ -1345,7 +1345,7 @@ unsigned int ON_SubDLevel::SetArchiveId( for (clink = clink->m_next; nullptr != clink; clink = clink->m_next) ++linked_list_count; - // Now iteratate the fixed size pool (which always iterates in increasing id order), + // Now iterate the fixed size pool (which always iterates in increasing id order), // skip components not on this level, and set archive id of the ones on this level. unsigned int cidit_level_count = 0; archive_id = archive_id_partition[listdex]; @@ -1358,7 +1358,7 @@ unsigned int ON_SubDLevel::SetArchiveId( if (prev_id >= c->m_id) { // This is a serious error! - // Contine because this allows us to save something do the disk in these bad cases. + // Continue because this allows us to save something do the disk in these bad cases. ON_SUBD_ERROR("The m_id values of the active components in the fixed size pool are corrupt."); } else @@ -1373,7 +1373,7 @@ unsigned int ON_SubDLevel::SetArchiveId( if (cidit_level_count != linked_list_count) { // This is a serious error! - // Contine because this allows us to save something do the disk in these bad cases. + // Continue because this allows us to save something do the disk in these bad cases. ON_SUBD_ERROR("The m_level values of the active components in the fixed size pool are corrupt."); } break; @@ -1726,7 +1726,7 @@ bool ON_SubDimple::Write( break; } - // minor version = 1 addtions + // minor version = 1 additions const unsigned char obsolete_texture_domain_type = ON_SubD::ObsoleteTextureDomainTypeFromTextureCoordinateType(TextureCoordinateType()); if (false == archive.WriteChar(obsolete_texture_domain_type)) break; @@ -1734,16 +1734,16 @@ bool ON_SubDimple::Write( if (false == m_texture_mapping_tag.Write(archive)) break; - // minor version = 2 addtions + // minor version = 2 additions if (false == m_symmetry.Write(archive)) break; - // minor version = 3 addtions + // minor version = 3 additions // runtime content number used to compare with the one from the saved on m_symmetry // Dale Lear Sep 2020 - Turns out saving the runtime GeometryContentSerialNumber() // was a bad idea. Doing it the way I came up with today while adding // m_face_packing_topology_hash is much better because all decisions get - // made at save time when we have the most reliable infomration. + // made at save time when we have the most reliable information. // I've added bSyncSymmetricContentSerialNumber below, but saving gsn has to stay // so pre-today Rhino can read files saved from post today Rhino. const ON__UINT64 gsn = GeometryContentSerialNumber(); @@ -1943,7 +1943,7 @@ bool ON_SubDimple::Read( // // No changes to "this SubD" below here. // - // The rest is updating infomation that is used to determine if this SubD + // The rest is updating information that is used to determine if this SubD // is the same SubD that existed when symmetry and texture information // was saved. It's ok if this is not the same subd. If and when appropriate // something downstream will update either the SubD or the symmetry/texture diff --git a/opennurbs_subd_data.cpp b/opennurbs_subd_data.cpp index 011a8353..72e84749 100644 --- a/opennurbs_subd_data.cpp +++ b/opennurbs_subd_data.cpp @@ -411,7 +411,7 @@ void ON_SubDAggregates::UpdateTopologicalAttributes( break; } R -= B; - // ON_TripleProduct(P, Q, R) = 6x signed volume of tetrahedron with trangle base (P,Q,R) and apex B. + // ON_TripleProduct(P, Q, R) = 6x signed volume of tetrahedron with triangle base (P,Q,R) and apex B. vol += ON_TripleProduct(P, Q, R); } } @@ -664,7 +664,7 @@ bool ON_SubDVertex::Transform( // and the corner sector(s) contains interior smooth edges, // and the transformation changes the angle between a corner sector's crease boundary, // then the sector's interior smooth edge's m_sector_coefficient[] could change - // and invalidate the subdivison points and limit points. + // and invalidate the subdivision points and limit points. // This is only possible for uncommon (in practice) transformations // and corner sectors and will require a fair bit of testing for // now it's easier to simply set bTransformationSavedSubdivisionPoint to false @@ -704,7 +704,7 @@ bool ON_SubDVertex::Transform( // and the corner sector(s) contains interior smooth edges, // and the transformation changes the angle between a corner sector's crease boundary, // then the sector's interior smooth edge's m_sector_coefficient[] could change - // and invalidate the subdivison points and limit points. + // and invalidate the subdivision points and limit points. // This is only possible for uncommon (in practice) transformations // and corner sectors and will require a fair bit of testing for // now it's easier to simply set bTransformationSavedSubdivisionPoint to false @@ -730,7 +730,7 @@ void ON_SubDVertex::UnsetControlNetPoint() m_P[2] = ON_DBL_QNAN; ClearSavedSubdivisionPoints(); // With a nan control net point, there is no need for an expensive unset - // of the neighborhod because the caller will either later pass + // of the neighborhood because the caller will either later pass // bClearNeighborhoodCache=true to ON_SubDVertex::SetControlNetPoint(...,bClearNeighborhoodCache) // or deal with cleaning up the cached evaluations in some other way. } @@ -890,11 +890,16 @@ bool ON_SubDFace::Transform( ) { ON_Xform xformNormals{ ON_Xform::IdentityTransformation }; - const double det{ xform.GetSurfaceNormalXform(xformNormals) }; + const double det{ xform.GetSurfaceNormalXformKeepLengthAndOrientation(xformNormals) }; ON_Xform xformCurvatures{ ON_Xform::IdentityTransformation }; - if (abs(det) > ON_EPSILON) { - xformNormals = xformNormals * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); - xformCurvatures = xformCurvatures * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); + if (abs(det) > 0) { + if (abs(abs(det) - 1) > ON_SQRT_EPSILON) + { + xformCurvatures = ON_Xform::DiagonalTransformation(pow(det, -1. / 3.)); + } + } + else { + return ON_SUBD_RETURN_ERROR(false); } const bool bKeepCurvatures{ xform.IsSimilarity() != 0 }; const bool bKeepTextures{ true }; @@ -949,11 +954,13 @@ bool ON_SubDLevel::Transform( { bool rc = true; ON_Xform xformNormals{ ON_Xform::IdentityTransformation }; - const double det{ xform.GetSurfaceNormalXform(xformNormals) }; + const double det{ xform.GetSurfaceNormalXformKeepLengthAndOrientation(xformNormals) }; ON_Xform xformCurvatures{ ON_Xform::IdentityTransformation }; - if (abs(det) > ON_EPSILON) { - xformNormals = xformNormals * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); - xformCurvatures = xformCurvatures * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); + if (abs(det) > 0) { + if (abs(abs(det) - 1) > ON_SQRT_EPSILON) + { + xformCurvatures = ON_Xform::DiagonalTransformation(pow(det, -1. / 3.)); + } } else { rc = false; @@ -1158,7 +1165,7 @@ bool ON_SubDimple::Transform( } else { - // object moved with respect to symmetry contstraints + // object moved with respect to symmetry constraints // DO NOTHING HERE - the serial number and hashes on m_symmetry will inform downstream processes // that the object no longer has the symmetry property specified by m_symmetry. // It will get updated when appropriate - typically in replace object. @@ -1198,11 +1205,13 @@ bool ON_SubDMeshFragment::Transform( ) { ON_Xform xformNormals{ON_Xform::IdentityTransformation}; - const double det{xform.GetSurfaceNormalXform(xformNormals)}; + const double det{ xform.GetSurfaceNormalXformKeepLengthAndOrientation(xformNormals) }; ON_Xform xformCurvatures{ON_Xform::IdentityTransformation}; - if (abs(det) > ON_EPSILON) { - xformNormals = xformNormals * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); - xformCurvatures = xformCurvatures * ON_Xform::ScaleTransformation(ON_3dPoint::Origin, 1. / det); + if (abs(det) > 0) { + if (abs(abs(det) - 1) > ON_SQRT_EPSILON) + { + xformCurvatures = ON_Xform::DiagonalTransformation(pow(det, -1. / 3.)); + } } else { return ON_SUBD_RETURN_ERROR(false); diff --git a/opennurbs_subd_eval.cpp b/opennurbs_subd_eval.cpp index 1b2ec6ea..afd0d6cc 100644 --- a/opennurbs_subd_eval.cpp +++ b/opennurbs_subd_eval.cpp @@ -985,7 +985,7 @@ bool ON_SubDVertex::SetSavedSurfacePoint( // first limit point location wins ON_SubDMeshFragment::SealPoints(true, m_limit_point.m_limitP, lp->m_limitP); - // it is expected that the limit normal and tangents will be substantually different. + // it is expected that the limit normal and tangents will be substantially different. lp->m_next_sector_limit_point = nullptr; // append the point to the vertex's linked list. @@ -1128,8 +1128,8 @@ const ON_SubDMeshFragment * ON_SubDFace::MeshFragments() const { // NOTE: // Clearing the ON_SubDComponentBase::SavedPointsFlags::SurfacePointBit bit - // on m_saved_points_flags is used to mark mesh fragmants as dirty. - // They need to be regerated before being used. + // on m_saved_points_flags is used to mark mesh fragments as dirty. + // They need to be regenerated before being used. return (0 != ON_SUBD_CACHE_LIMITLOC_FLAG(m_saved_points_flags)) ? m_mesh_fragments : nullptr; } @@ -1253,7 +1253,7 @@ const ON_3dVector ON_SubDFace::ControlNetCenterNormal() const { A = B; B = ControlNetPoint(fvi) - C; - N += ON_CrossProduct(A, B); // do not untize this and then the code works for non-convex faces too. + N += ON_CrossProduct(A, B); // do not unitize this and then the code works for non-convex faces too. } return N.UnitVector(); diff --git a/opennurbs_subd_fragment.cpp b/opennurbs_subd_fragment.cpp index 460cedbb..7c0a6c75 100644 --- a/opennurbs_subd_fragment.cpp +++ b/opennurbs_subd_fragment.cpp @@ -119,7 +119,7 @@ void ON_SubDMeshFragment::Internal_LayoutArrays( ? (bInterlaced ? (ON_SubDMeshFragment::DoublesPerVertex * sizeof(double)) / sizeof(m_K[0]) : 1) : 0; - // offset_K = offset bewteen m_K and m_C + // offset_K = offset between m_K and m_C const size_t offset_K = (nullptr != PNTKC_array) ? (bInterlaced ? 1 : vertex_capacity) @@ -698,7 +698,7 @@ bool ON_SubD::HasFragmentColors() const if (0 == frag->ColorCount()) return false; // NOTE WELL: - // All fragments need to be tested as lasy updates of the + // All fragments need to be tested as lazy updates of the // surface mesh cache result in the update fragments having // no colors while the preexisting fragments have colors. bHasColors = true; // fragments with colors exist @@ -1387,7 +1387,7 @@ void ON_SubDManagedMeshFragment::CopyHelper(const ON_SubDMeshFragment& src) size_t src_k_stride; if (K_count > 0) { - // copy curvarure + // copy curvature src_k = src.m_K; src_k_stride = src.m_K_stride; SetCurvaturesExistForExperts(true); @@ -2272,7 +2272,7 @@ unsigned int ON_SubDMeshFragmentGrid::SidePointCount() const unsigned int ON_SubDMeshFragmentGrid::GridFaceCount() const { - // TODO: Suport tri fragments + // TODO: Support tri fragments unsigned int side_segment_count = SideSegmentCount(); return side_segment_count * side_segment_count; } @@ -2280,7 +2280,7 @@ unsigned int ON_SubDMeshFragmentGrid::GridFaceCount() const unsigned int ON_SubDMeshFragmentGrid::GridPointCount() const { - // TODO: Suport tri fragments + // TODO: Support tri fragments unsigned int side_segment_count = SideSegmentCount(); return (side_segment_count > 0U) ? ((side_segment_count + 1U)*(side_segment_count + 1U)) : 0U; } @@ -2525,7 +2525,7 @@ ON_SubDMeshFragmentGrid ON_SubDMeshFragmentGrid::QuadGridFromDisplayDensity( } // Do not initialize grid_cache[i] until entire linked list is ready to be used. - // This way if the lock is stolen for some unforseen reason, we risk leaking memory + // This way if the lock is stolen for some unforeseen reason, we risk leaking memory // but we will not crash. grid_cache[i] = first_lod; } @@ -3166,7 +3166,7 @@ public: m_bits |= (0==edge_dir) ? Bits::FirstHalf : Bits::SecondHalf; else { - // this is an inteior edge of a partial fragment and it + // this is an interior edge of a partial fragment and it // is always sealed with its neighbor when it is created. break; } @@ -3210,7 +3210,7 @@ public: // Critical to ignore the EdgeDir bit because we need // the identical sections of edges to be sorted together. // When an edge has 2 N-gons (N != 4) attached, we need - // the pairs for the first half and 2nd half sorted toether + // the pairs for the first half and 2nd half sorted together const unsigned char lhs_bits = (lhs->m_bits & ON_SubDLimitMeshSealEdgeInfo::Bits::IgnoreEdgeDirMask); const unsigned char rhs_bits = (rhs->m_bits & ON_SubDLimitMeshSealEdgeInfo::Bits::IgnoreEdgeDirMask); if (lhs_bits < rhs_bits) @@ -3293,12 +3293,12 @@ bool ON_SubDLimitMeshSealEdgeInfo::Seal( // only copy half of src_fragment side if (0 == src_dir) { - i1 -= dst_side_segment_count; // copy first half of src_framgent side + i1 -= dst_side_segment_count; // copy first half of src_fragment side ////vid[1] = 0; } else { - i0 += dst_side_segment_count; // copy 2nd half of src_framgent side + i0 += dst_side_segment_count; // copy 2nd half of src_fragment side ////vid[0] = 0; } } @@ -3307,12 +3307,12 @@ bool ON_SubDLimitMeshSealEdgeInfo::Seal( // only copy half of src_fragment side if (0 == src_dir) { - i0 += dst_side_segment_count; // copy 2nd half of src_framgent side + i0 += dst_side_segment_count; // copy 2nd half of src_fragment side ////vid[0] = 0; } else { - i1 -= dst_side_segment_count; // copy first half of src_framgent side + i1 -= dst_side_segment_count; // copy first half of src_fragment side ////vid[1] = 0; } } @@ -3846,7 +3846,7 @@ unsigned int ON_SubDDisplayParameters::AbsoluteDisplayDensityFromSubDFaceCount( // NURBS curve forms of SubD edge curves in that begin/end at an // extraordinary vertex. This is done in // ON_SubDEdge::GetEdgeSurfaceCurveControlPoints(). - // When there is a better way to get NURBS approsimations of edges that end + // When there is a better way to get NURBS approximations of edges that end // at extraordinary vertices, we can reduce min_display_density to 1. // // 2022-06-08. Pierre, RH-62025. I have no idea why this is set to 1 when diff --git a/opennurbs_subd_frommesh.cpp b/opennurbs_subd_frommesh.cpp index e9bb16ef..374b79f7 100644 --- a/opennurbs_subd_frommesh.cpp +++ b/opennurbs_subd_frommesh.cpp @@ -79,7 +79,7 @@ public: } - unsigned int m_sud_face_id; // likely ON_SubDFace.m_id value (unless invlalid input causes some to be skipped) + unsigned int m_sud_face_id; // likely ON_SubDFace.m_id value (unless invalid input causes some to be skipped) unsigned int m_mesh_Vi; // ON_Mesh vertex index unsigned int m_mesh_Vj; // ON_Mesh vertex index @@ -87,7 +87,7 @@ private: unsigned char m_u_status; // 0 = u is unset, 1 = m_u.mesh_edge_topology_id is set, 2 = m_u.subd_edgeptr is set union { - ON_2udex mesh_edge_topology_id; // uniquely identifies mesh edge toplogically - independent of vertex order + ON_2udex mesh_edge_topology_id; // uniquely identifies mesh edge topologically - independent of vertex order ON_SubDEdgePtr subd_edgeptr; } m_u; @@ -384,7 +384,7 @@ class ON_NgonBoundaryChecker { public: /* - Parametes: + Parameters: ngon - [in] ngon to test mesh [in] @@ -481,7 +481,7 @@ static double Internal_FaceCornerAngleRadians(const ON_SubDVertex* v, const ON_S if (false == f->IsConvex()) break; - // We could remove the f->IsConvex() test, but it might make make a bad situaton worse. + // We could remove the f->IsConvex() test, but it might make make a bad situation worse. // As of May 2020, nobody has complained about this approach. // the code below assumes the face is convex @@ -788,7 +788,7 @@ ON_SubD* ON_SubD::Internal_CreateFromMeshWithValidNgons( // // mesh_edge_map[] is used to sort the sort mesh_edges[] into groups that correspond to the same SubD edge. - // The order of mesh_edges[] cannot be changed because the current order is neede to efficiently create the SubD faces. + // The order of mesh_edges[] cannot be changed because the current order is needed to efficiently create the SubD faces. unsigned int* mesh_edge_map = (unsigned int*)ws.GetMemory(mesh_edges.UnsignedCount() * sizeof(mesh_edge_map[0])); ON_Sort( ON::sort_algorithm::quick_sort, diff --git a/opennurbs_subd_heap.cpp b/opennurbs_subd_heap.cpp index a3ffb859..ad13d439 100644 --- a/opennurbs_subd_heap.cpp +++ b/opennurbs_subd_heap.cpp @@ -956,7 +956,7 @@ class ON_SubDComponentBase* ON_SubDHeap::Internal_AllocateComponentAndSetId( // In order for m_fspv.ElementFromId(), m_fspe.ElementFromId() , m_fspf.ElementFromId() // to work, it is critical that once a vertex/edge/face is allocated from m_fspv/mfspe/mfspf - // the value of m_id never changes. This is imporant because the value of m_id must persist + // the value of m_id never changes. This is important because the value of m_id must persist // in binary archives in order for ON_COMPONENT_INDEX values to persist in binary archives. ON_SubDComponentBaseLink* c; @@ -964,7 +964,7 @@ class ON_SubDComponentBase* ON_SubDHeap::Internal_AllocateComponentAndSetId( { // Requests for a candidate_id value above 3 billion are ignored to insure // there is plenty of room for ids. - // It's almost certainly a bug if candidate_id > several millon or so. + // It's almost certainly a bug if candidate_id > several million or so. candidate_id = 0; } @@ -994,7 +994,7 @@ class ON_SubDComponentBase* ON_SubDHeap::Internal_AllocateComponentAndSetId( } else { - // Return element at the head of the unusued list. + // Return element at the head of the unused list. c = static_cast(unused_list); unused_list = const_cast(c->m_next); } @@ -2075,7 +2075,7 @@ ON_SubDMeshFragment* ON_SubDHeap::AllocateMeshFragment( // It is used when an unusual small fragment is allocated from a pool // providing large fragments (fsp.SizeofElement() > sizeof_fragment). // If fsp.SizeofElement() is not an even multiple of sizeof_fragment, - // then some memory is wasted. Beause this situation is uncommon, + // then some memory is wasted. Because this situation is uncommon, // the waste doesn't matter in the big scheme of things. ON_FixedSizePoolElement* ele = (ON_FixedSizePoolElement*)p; ele->m_next = m_unused_fragments[density]; diff --git a/opennurbs_subd_iter.cpp b/opennurbs_subd_iter.cpp index bf81174f..8fc37f3a 100644 --- a/opennurbs_subd_iter.cpp +++ b/opennurbs_subd_iter.cpp @@ -523,6 +523,24 @@ ON_SubDVertexIterator::ON_SubDVertexIterator( ); } + +ON_SubDVertexIterator::ON_SubDVertexIterator( + const class ON_SubD& subd, + unsigned level_index + +) +{ + const ON_SubDLevel& level = subd.LevelForExperts(level_index); + Internal_Init( + ON_SubDRef::CreateReferenceForExperts(subd), + level.m_vertex_count, + level.m_vertex[0], + level.m_vertex[1], + ON_SubDComponentPtr::Null + ); +} + + ON_SubDVertexIterator::ON_SubDVertexIterator( const class ON_SubDRef& subd_ref ) @@ -690,6 +708,21 @@ ON_SubDEdgeIterator::ON_SubDEdgeIterator( ); } +ON_SubDEdgeIterator::ON_SubDEdgeIterator( + const class ON_SubD& subd, + unsigned level_index +) +{ + const ON_SubDLevel& level = subd.LevelForExperts(level_index); + Internal_Init( + ON_SubDRef::CreateReferenceForExperts(subd), + level.m_edge_count, + level.m_edge[0], + level.m_edge[1], + ON_SubDComponentPtr::Null + ); +} + ON_SubDEdgeIterator::ON_SubDEdgeIterator( const class ON_SubDRef& subd_ref ) @@ -861,6 +894,22 @@ ON_SubDFaceIterator::ON_SubDFaceIterator( ); } +ON_SubDFaceIterator::ON_SubDFaceIterator( + const class ON_SubD& subd, + unsigned level_index + +) +{ + const ON_SubDLevel& level = subd.LevelForExperts(level_index); + Internal_Init( + ON_SubDRef::CreateReferenceForExperts(subd), + level.m_face_count, + level.m_face[0], + level.m_face[1], + ON_SubDComponentPtr::Null + ); +} + ON_SubDFaceIterator::ON_SubDFaceIterator( const ON_SubDRef& subd_ref ) @@ -1770,7 +1819,7 @@ const ON_SubDFace* ON_SubDSectorIterator::IncrementFace( if (edge != ON_SUBD_EDGE_POINTER(face1_edges->m_ptr)) continue; - // At this point, face1->Edges(fei) is the edge I just hopped accross + // At this point, face1->Edges(fei) is the edge I just hopped across // to get from the old current face to face 1. Update current face // information and return. m_current_face = face1; diff --git a/opennurbs_subd_limit.cpp b/opennurbs_subd_limit.cpp index bba69cac..164f6271 100644 --- a/opennurbs_subd_limit.cpp +++ b/opennurbs_subd_limit.cpp @@ -472,7 +472,7 @@ static bool IsOrdinarySmoothQuadCornerVertex( return false; // If we get this far, then this edge has - // the standared smooth edge Catmull Clark subdivision point. + // the standard smooth edge Catmull Clark subdivision point. } return true; } @@ -2091,7 +2091,7 @@ bool ON_SubDQuadNeighborhood::Subdivide( if (N < ON_SubDSectorType::MinimumSectorEdgeCount(qv0->m_vertex_tag)) return ON_SUBD_RETURN_ERROR(false); - // When qv0 is a valence 2 vertex with trianglar faces, we need to use find or allocate. + // When qv0 is a valence 2 vertex with triangular faces, we need to use find or allocate. const bool bUseFindOrAllocate = (2 == N && 3 == qv0->MinimumFaceEdgeCount()); ON_SubDSectorIterator sit; @@ -2137,7 +2137,7 @@ bool ON_SubDQuadNeighborhood::Subdivide( if (edgep1.IsNull()) return ON_SUBD_RETURN_ERROR(false); - // prepare to rotate coutnerclockwise around qv0, + // prepare to rotate counterclockwise around qv0, // subdividing edges and adding new faces const ON_SubDEdge* e0[2] = {nullptr, edge0}; ON_SubDEdgePtr e1[2] = {ON_SubDEdgePtr::Null, edgep1}; @@ -2309,7 +2309,7 @@ bool ON_SubDQuadNeighborhood::Subdivide( // Add the 7 remaining elements to vertex_grid1[][] if (false == bBoundaryCrease1[0]) { - // When the level 0 vertex is valence 2 and the neignboring faces are triangles, + // When the level 0 vertex is valence 2 and the neighbouring faces are triangles, // this vertex needs to be added to the hash table vertex_grid1[3][0] = fsh.AllocateEdgeSubdivisionVertex(bUseFindOrAllocate, m_edge_grid[q0fvi][1]); if ( nullptr == vertex_grid1[3][0]) @@ -2882,9 +2882,9 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( ON_SubDVertex* vertex1 = nullptr; ON_SubDEdgePtr edge1 = ON_SubDEdgePtr::Null; - // Calculate 2*N subdivison vertices on the boundary of input "face" - // and N subdivision edge that radiate from center_vertex1 to the input face edge's subdivison points. - // This loop also vertifies that all input vertex and edge pointers are not null and have the + // Calculate 2*N subdivision vertices on the boundary of input "face" + // and N subdivision edge that radiate from center_vertex1 to the input face edge's subdivision points. + // This loop also verifies that all input vertex and edge pointers are not null and have the // expected properties so the rest of this function can dispense with checking. const ON_SubDEdgePtr* face_m_edges = face->m_edge4; for (unsigned int i = 0; i < N; i++, face_m_edges++) @@ -2904,10 +2904,10 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( if (vertex0->m_edge_count < 2) return ON_SUBD_RETURN_ERROR(false); - // One of the main reasons for creating a ON_SubDFaceNeighborhood is to calcualte the + // One of the main reasons for creating a ON_SubDFaceNeighborhood is to calculate the // limit mesh and limit cubic surfaces when the original face is not a quad. // For these calculations, we need to calculate and save the limit point for extraordinary - // verticies while enough information is available to calculate it. Doing the calculation + // vertices while enough information is available to calculate it. Doing the calculation // before calling m_fsh.AllocateVertex(), insures the information will be copied to vertex1. if ( false == vertex0->GetSurfacePoint(face,limit_point) ) return ON_SUBD_RETURN_ERROR(false); @@ -2936,7 +2936,7 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( center_vertex1, ON_SubDSectorType::IgnoredSectorCoefficient, vertex1, - at_crease2_weight // ingored unless vertex1 is tagged as a crease + at_crease2_weight // ignored unless vertex1 is tagged as a crease ); if ( edge1.IsNull() ) return ON_SUBD_RETURN_ERROR(false); @@ -2947,7 +2947,7 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( return ON_SUBD_RETURN_ERROR(false); } - // ring_vertex1 and last_ring_vertex1 are used to repeatedly iterate through subdivsion vertices on the boundary + // ring_vertex1 and last_ring_vertex1 are used to repeatedly iterate through subdivision vertices on the boundary // of the original face. // i = "corner" index (= <= i < N. // ring_vertex1[3] = last vertex in the boundary and is used for initialization when i = 0. @@ -2956,7 +2956,7 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( // ring_vertex1[2] = subdivision vertex on input face->Edge(i) ON_SubDVertex* ring_vertex1[4] = { nullptr, nullptr, nullptr, vertex1 }; - // Calculate the 2*N subdivison edges on the boundary of input "face" + // Calculate the 2*N subdivision edges on the boundary of input "face" // and N subdivision faces. ON_SubDFace* face1 = nullptr; ON_SubDEdgePtr face1_eptrs[4] = {ON_SubDEdgePtr::Null,ON_SubDEdgePtr::Null,ON_SubDEdgePtr::Null,edge1.Reversed()}; @@ -3092,7 +3092,7 @@ bool ON_SubDFaceNeighborhood::QuadSubdivideHelper( return ON_SUBD_RETURN_ERROR(false); edge1 = m_fsh.AllocateEdge( ring_vertex1[2], - at_crease2_weight, // ingored unless ring_vertex1[0] is tagged as a crease + at_crease2_weight, // ignored unless ring_vertex1[0] is tagged as a crease vertex1, ON_SubDSectorType::IgnoredSectorCoefficient ); diff --git a/opennurbs_subd_matrix.cpp b/opennurbs_subd_matrix.cpp index d1c61ec1..85948591 100644 --- a/opennurbs_subd_matrix.cpp +++ b/opennurbs_subd_matrix.cpp @@ -963,7 +963,7 @@ unsigned int ON_SubDSectorType::GetSubdivisionMatrix( // S[4][4] = {{3./4, 1./8, 0, 1./8}, {1./2, 1./2, 0, 0}, {1./4, 1./4, 1./4, 1./4}, {1./2, 0, 0, 1./2}}; // eigenvalues[4] = {1, 1./2, 1./4, 1./4}; // eigenvectors[3][4] = {{1, 1, 1, 1}, {0, -1, 0, 1}, {0, 0, 1, 0}}; - // (eigenvalue 1/4 has algebraic multiplicity = 2 and geometryic multiplicity = 1) + // (eigenvalue 1/4 has algebraic multiplicity = 2 and geometric multiplicity = 1) if (N < 2 || R < 4) return ON_SUBD_RETURN_ERROR(0); @@ -2071,7 +2071,7 @@ unsigned int ON_SubDSectorType::GetSurfaceEvaluationCoefficients( if (1 == F) { // This is the special where IsCatmullClarkCreaseOneFaceCase() returns true. - // Catmull-Clark subdivison, + // Catmull-Clark subdivision, // center vertex is a crease vertex, // one face and two crease edges. L2[0] = -2.0; // center point coefficients @@ -2198,7 +2198,7 @@ static bool Internal_GetAlterateTangent( { if ( 4 == subd_matrix.m_R && ON_SubDVertexTag::Crease == subd_matrix.m_sector_type.VertexTag() ) { - // valence 2 crease case when crease edges are colinear + // valence 2 crease case when crease edges are collinear // F = face point, C = crease vertex point. // Default tangents: // L[1] = ON_3dPoint(point_ring + point_ring_stride) - ON_3dPoint(point_ring + 3 * point_ring_stride); @@ -2233,7 +2233,7 @@ static bool Internal_GetAlterateNormal( if ( 4 == subd_matrix.m_R && ON_SubDVertexTag::Crease == subd_matrix.m_sector_type.VertexTag() ) { - // valence 2 crease case when crease edges are colinear + // valence 2 crease case when crease edges are collinear // F = face point, C = crease vertex point. ON_3dVector N(ON_3dVector::ZeroVector); if (false == bHaveAlternateL[2]) @@ -2742,7 +2742,7 @@ double ON_SubDMatrix::TestMatrix() const } // A smooth sector with 2 faces is degenerate and does not have nice eigenvalues and eigenvectors - // that give a well defined surface normal. In this case we use a hueristic for the normal. + // that give a well defined surface normal. In this case we use a heuristic for the normal. // When bSmoothTwoFaceCase E1 = {0,0,0,0,0}, lengthE1 = 0, lengthE1 = 0. const bool bSmoothTwoFaceCase = (m_sector_type.IsSmoothSector() || m_sector_type.IsDartSector()) @@ -2869,7 +2869,7 @@ double ON_SubDMatrix::TestMatrix() const if (!(rc >= 0.0)) break; - // E1 and E2 should be ortogonal to LP which means + // E1 and E2 should be orthogonal to LP which means // E0oLP and E1oLP should be zero // // Why? @@ -2884,7 +2884,7 @@ double ON_SubDMatrix::TestMatrix() const // = Transpose(LP) * (lambda E) // = lambda * (Transpose(LP) * E ) // = lambda * LPoE - // If LPoE != 0, then lamba = 1, which is not the case. + // If LPoE != 0, then lambda = 1, which is not the case. rc = bSmoothOrDartTwoFaceCase ? 0.0 : TestMatrixReturnValue(fabs(E1oLP) / lengthE1, rc); if (!(rc >= 0.0)) break; @@ -2904,7 +2904,7 @@ double ON_SubDMatrix::TestMatrix() const break; } - // See if L1 and L2 can produce a reasonable normal in the simplist possible case + // See if L1 and L2 can produce a reasonable normal in the simplest possible case double z = m_sector_type.SurfaceNormalSign(); if (!(z > 0.0)) return ON_SUBD_RETURN_ERROR(ON_UNSET_VALUE); @@ -3049,7 +3049,7 @@ double ON_SubDMatrix::TestEvaluation( if (SM.m_R > 0) { - // Print evauation coefficients. + // Print evaluation coefficients. const ON_TextLogIndent indent1(*text_log); text_log->Print("Limit suface evaluation coefficients:\n"); const ON_TextLogIndent indent2(*text_log); @@ -3333,7 +3333,7 @@ double ON_SubDMatrix::TestEvaluation( { if (point_ring0[0].x == v1->m_P[0] && point_ring0[0].y == v1->m_P[1] && point_ring0[0].z == v1->m_P[2]) { - // subdivision was reqiured to get initial point ring. + // subdivision was required to get initial point ring. v0 = v1; v1 = ON_SubD::SubdivideSector( v0, element, component_ring_count, fsh[recursion_level % 2]); if (nullptr == v1 || N != v1->m_edge_count || F != v1->m_face_count) diff --git a/opennurbs_subd_ref.cpp b/opennurbs_subd_ref.cpp index b9bc539b..248cd34b 100644 --- a/opennurbs_subd_ref.cpp +++ b/opennurbs_subd_ref.cpp @@ -454,7 +454,7 @@ bool ON_SubDComponentRef::GetBBox( switch (m_component_location) { case ON_SubDComponentLocation::Surface: - // public opennubs does not provide limit mesh tools. + // public opennurbs does not provide limit mesh tools. case ON_SubDComponentLocation::ControlNet: bbox = vertex->ControlNetBoundingBox(); break; @@ -472,7 +472,7 @@ bool ON_SubDComponentRef::GetBBox( switch (m_component_location) { case ON_SubDComponentLocation::Surface: - // public opennubs does not provide limit mesh tools. + // public opennurbs does not provide limit mesh tools. case ON_SubDComponentLocation::ControlNet: bbox = edge->ControlNetBoundingBox(); break; @@ -489,7 +489,7 @@ bool ON_SubDComponentRef::GetBBox( switch (m_component_location) { case ON_SubDComponentLocation::Surface: - // public opennubs does not provide limit mesh tools. + // public opennurbs does not provide limit mesh tools. case ON_SubDComponentLocation::ControlNet: bbox = face->ControlNetBoundingBox(); break; diff --git a/opennurbs_subd_ring.cpp b/opennurbs_subd_ring.cpp index 1395cbf8..4af4ffbf 100644 --- a/opennurbs_subd_ring.cpp +++ b/opennurbs_subd_ring.cpp @@ -119,7 +119,7 @@ unsigned int ON_SubD::GetQuadSectorPointRing( if (ON_SubDEdgeTag::SmoothX == etag) { - // one subdivision is reqired to handle SmoothX edges + // one subdivision is required to handle SmoothX edges target_subdivision_count = 1u; } else @@ -129,7 +129,7 @@ unsigned int ON_SubD::GetQuadSectorPointRing( return ON_SUBD_RETURN_ERROR(0); if (v1->IsDartOrCreaseOrCorner() && 0.5 != e->m_sector_coefficient[1u - end0]) { - // one subdivision is reqired to handle extraordinary sector coeffient at v1. + // one subdivision is required to handle extraordinary sector coefficient at v1. target_subdivision_count = 1u; } } @@ -146,16 +146,16 @@ unsigned int ON_SubD::GetQuadSectorPointRing( // When a crease vertex has more than one sector the tagging rules imply // it must have exactly two crease edges and exactly two sectors separated by // those edges. Call the two sectors sector A and sector B. - // Set a = masimum ens sharpness at vertex0 of sector A - // and set b = masimum ens sharpness at vertex0 of sector B. - // If (a != b) and thre is an integer n so that max(a,b) >= n and min(a,b) <= n, + // Set a = maximum ens sharpness at vertex0 of sector A + // and set b = maximum ens sharpness at vertex0 of sector B. + // If (a != b) and there is an integer n so that max(a,b) >= n and min(a,b) <= n, // then we need to sudivide the sector with the smallest sharpness - // enough times to insure the vertex has no sharpness in eithe sector. + // enough times to insure the vertex has no sharpness in either sector. // Since the code below only has access to the edges from the current sector, // we need the overall vertex sharpness here. // This situation cannot occur with smooth or dart vertices because they - // always have a single sector. It doesnt matter with corner vertices - // because their subdivision points and limit piont are simple the + // always have a single sector. It doesn't matter with corner vertices + // because their subdivision points and limit point are simple the // level 0 control net point. vertex0_sharpness = vertex0->VertexSharpness(); if (vertex0_sharpness > 1.0) @@ -739,7 +739,7 @@ const ON_SubDVertex* ON_SubD::SubdivideSector( if ( nullptr == vertex1) return ON_SUBD_RETURN_ERROR(nullptr); - // at_crease weight is used when the cooresponding vertex is a crease. + // at_crease weight is used when the corresponding vertex is a crease. // Otherwise, fsh.AllocateEdge() ignores at_crease_weight. ON_SubDEdgeTag edge1_tag = (ON_SubDEdgeTag::SmoothX == edge0_tag) ? ON_SubDEdgeTag::Smooth : edge0_tag; const double at_crease_weight diff --git a/opennurbs_subd_texture.cpp b/opennurbs_subd_texture.cpp index 78b6dcb5..4198ada8 100644 --- a/opennurbs_subd_texture.cpp +++ b/opennurbs_subd_texture.cpp @@ -34,13 +34,13 @@ unsigned char ON_SubD::ObsoleteTextureDomainTypeFromTextureCoordinateType(ON_Sub Unset = 0, /// - /// Each face texture domain is a unique rectangle of normlized texture space. + /// Each face texture domain is a unique rectangle of normalized texture space. /// PerFace = 1, /// - /// Each face texture domain is a unique rectangle of normlized texture space. - /// When possible, faces are partitioned into quad groups. Adjactent members + /// Each face texture domain is a unique rectangle of normalized texture space. + /// When possible, faces are partitioned into quad groups. Adjacent members /// of the group are assigned adjacent rectangles in texture space. /// Packed = 2, @@ -111,13 +111,13 @@ ON_SubDTextureCoordinateType ON_SubD::TextureCoordinateTypeFromObsoleteTextureDo Unset = 0, /// - /// Each face texture domain is a unique rectangle of normlized texture space. + /// Each face texture domain is a unique rectangle of normalized texture space. /// PerFace = 1, /// - /// Each face texture domain is a unique rectangle of normlized texture space. - /// When possible, faces are partitioned into quad groups. Adjactent members + /// Each face texture domain is a unique rectangle of normalized texture space. + /// When possible, faces are partitioned into quad groups. Adjacent members /// of the group are assigned adjacent rectangles in texture space. /// Packed = 2, @@ -447,7 +447,7 @@ const ON_2udex ON_SubDFace::GetNgonSubPackRectSizeAndDelta( // it is critical that TextureImageSuggestedMinimumSize be a // constant and context independent value. // - // The portion of the image assgned to the ngon face pack rect + // The portion of the image assigned to the ngon face pack rect // is rect_image_width X rect_image_height pixels. // All variables ending in "size" have pixels as units. const double subd_image_size = ON_SubD::TextureImageSuggestedMinimumSize; @@ -1278,7 +1278,7 @@ void ON_SubDMeshFragment::SetQuadOr3gonFaceFragmentTextureCoordinateCorners( } else { - // n-gon with n >= 5 or ininitialized m_face_fragment_count. + // n-gon with n >= 5 or initialized m_face_fragment_count. // If m_face_fragment_count >= 5, then you should be calling SetNgonFaceFragmentTextureCoordinateCorners(). ON_SUBD_ERROR("Invalid m_face_fragment_count value"); fragment_corners[0] = ON_3dPoint::NanPoint; @@ -1545,7 +1545,7 @@ void ON_SubDMeshFragment::SetQuadOr3gonFaceFragmentPackRectCorners( } else { - // n-gon with n >= 5 or ininitialized m_face_fragment_count. + // n-gon with n >= 5 or initialized m_face_fragment_count. // If m_face_fragment_count >= 5, then you should be calling SetNgonFaceFragmentPackRectCorners(). ON_SUBD_ERROR("Invalid m_face_fragment_count value"); fragment_corners[0] = ON_2dPoint::NanPoint; diff --git a/opennurbs_sumsurface.h b/opennurbs_sumsurface.h index 995db3e6..6a08a97e 100644 --- a/opennurbs_sumsurface.h +++ b/opennurbs_sumsurface.h @@ -251,12 +251,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -384,7 +384,7 @@ public: int GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 @@ -398,7 +398,7 @@ public: int HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 diff --git a/opennurbs_sun.cpp b/opennurbs_sun.cpp index 8143a776..84fb8c19 100644 --- a/opennurbs_sun.cpp +++ b/opennurbs_sun.cpp @@ -553,7 +553,7 @@ void ON_SunEngine::ConvertSolarVectorToHorizonCoords(const double* dVector, doub dAzimuth += 360.0; } -void ON_SunEngine::GetCurrentLocalDateTime(int& y, int& m, int& d, double& h) +static tm CurrentLocalTimeAsStructTM(void) { const time_t time = ON_SecondsSinceJanOne1970UTC(); @@ -565,12 +565,27 @@ void ON_SunEngine::GetCurrentLocalDateTime(int& y, int& m, int& d, double& h) ttm = *localtime(&time); #endif + return ttm; +} + +void ON_SunEngine::GetCurrentLocalDateTime(int& y, int& m, int& d, double& h) +{ + const tm ttm = CurrentLocalTimeAsStructTM(); y = ttm.tm_year + 1900; m = ttm.tm_mon + 1; d = ttm.tm_mday; h = ttm.tm_hour + (ttm.tm_min / 60.0) + (ttm.tm_sec / 3600.0); } +void ON_SunEngine::GetDefaultLocalDateTime(int& y, int& m, int& d, double& h) +{ + const tm ttm = CurrentLocalTimeAsStructTM(); + y = ttm.tm_year + 1900; + m = 3; + d = 21; + h = 12.0; +} + class ON_Sun::CImpl : public ON_InternalXMLImpl { public: @@ -811,14 +826,14 @@ void ON_Sun::CImpl::SetDaylightSavingMinutes(int minutes) void ON_Sun::CImpl::LocalDateTime(int& year, int& month, int& day, double& hours) const { - int cy = 0, cm = 0, cd = 0; double ch = 0.0; - ON_SunEngine::GetCurrentLocalDateTime(cy, cm, cd, ch); + int dy = 0, dm = 0, dd = 0; double dh = 0.0; + ON_SunEngine::GetDefaultLocalDateTime(dy, dm, dd, dh); const wchar_t* s = XMLPath_Sun(); - year = GetParameter(s, ON_RDK_SUN_DATE_YEAR, cy); - month = GetParameter(s, ON_RDK_SUN_DATE_MONTH, cm); - day = GetParameter(s, ON_RDK_SUN_DATE_DAY, cd); - hours = GetParameter(s, ON_RDK_SUN_TIME_HOURS, ch); + year = GetParameter(s, ON_RDK_SUN_DATE_YEAR, dy); + month = GetParameter(s, ON_RDK_SUN_DATE_MONTH, dm); + day = GetParameter(s, ON_RDK_SUN_DATE_DAY, dd); + hours = GetParameter(s, ON_RDK_SUN_TIME_HOURS, dh); } bool ON_Sun::CImpl::SetLocalDateTime(int year, int month, int day, double hours) @@ -1343,13 +1358,13 @@ void ON_Sun::LoadFromXMLNode(const ON_XMLNode& node) { ON_XMLParameters p(node); - int cy = 0, cm = 0, cd = 0; double ch = 0.0; - ON_SunEngine::GetCurrentLocalDateTime(cy, cm, cd, ch); + int dy = 0, dm = 0, dd = 0; double dh = 0.0; + ON_SunEngine::GetDefaultLocalDateTime(dy, dm, dd, dh); - const auto y = p.GetParam(ON_RDK_SUN_DATE_YEAR, cy).AsInteger(); - const auto m = p.GetParam(ON_RDK_SUN_DATE_MONTH, cm).AsInteger(); - const auto d = p.GetParam(ON_RDK_SUN_DATE_DAY, cd).AsInteger(); - const auto h = p.GetParam(ON_RDK_SUN_TIME_HOURS, ch).AsDouble(); + const auto y = p.GetParam(ON_RDK_SUN_DATE_YEAR, dy).AsInteger(); + const auto m = p.GetParam(ON_RDK_SUN_DATE_MONTH, dm).AsInteger(); + const auto d = p.GetParam(ON_RDK_SUN_DATE_DAY, dd).AsInteger(); + const auto h = p.GetParam(ON_RDK_SUN_TIME_HOURS, dh).AsDouble(); SetLocalDateTime(y, m, d, h); SetEnableAllowed (p.GetParam(ON_RDK_SUN_ENABLE_ALLOWED, false)); @@ -1595,3 +1610,64 @@ bool ON_Sun::ReadFromArchive(ON_BinaryArchive& archive) return true; } + +static void _DecimalHoursToHMS(double hours, int& hour, int& minute, int& second) +{ + while (hours >= 24.0) + hours -= 24.0; + + while (hours < 0.0) + hours += 24.0; + + hour = int(hours); + + const double min = (hours - hour) * 60.0; + minute = int(min); + + const double sec = (min - minute) * 60.0; + second = int(sec + 0.5); // 'second' could now be 60. +} + +void ON_DecimalHoursToHMS(double hours, int& hour, int& minute, int& second) +{ + _DecimalHoursToHMS(hours, hour, minute, second); + + if (second > 59) + second = 59; +} + +void ON_DecimalHoursToHMS(double hours, int& hour, int& minute, int& second, int& year, int& month, int& day) +{ + _DecimalHoursToHMS(hours, hour, minute, second); + + if (second > 59) + { + second = 0; + + if (++minute > 59) + { + minute = 0; + + if (++hour > 23) + { + hour = 0; + + if (++day > int(ON_DaysInMonthOfGregorianYear(year, month))) + { + day = 1; + + if (++month > 12) + { + month = 1; + year++; + } + } + } + } + } +} + +double ON_DecimalHoursFromHMS(int hour, int minute, int second) +{ + return hour + (minute / 60.0) + (second / 3600.0); +} diff --git a/opennurbs_sun.h b/opennurbs_sun.h index 5fd1997b..cb0775c4 100644 --- a/opennurbs_sun.h +++ b/opennurbs_sun.h @@ -104,6 +104,10 @@ public: // Helper function; gets the current local date and time. static void GetCurrentLocalDateTime(int& y, int& m, int& d, double& h); + // Helper function; gets the default local date and time. + // This is March 21st of the current year at 12:00 noon local time. + static void GetDefaultLocalDateTime(int& y, int& m, int& d, double& h); + private: class CImpl; CImpl* _impl; @@ -321,4 +325,51 @@ private: CImpl* _impl; }; +/* +Description: + Converts a time specified as hour, minute and second to a decimal hours value. + Example: hour=9, minute=30, second=0 -> result is 9.5 +Parameters: + hour - [in] The hour value of the time. + minute - [in] The minute value of the time. + second - [in] The second value of the time. +Returns: + The decimal hours value corresponding to the hour, minute and second. +*/ +ON_DECL double ON_DecimalHoursFromHMS(int hour, int minute, int second); + +/* +Description: + Converts a time specified as decimal hours to hour, minute and second. + Guaranteed to produce a valid hour, minute and second result. + Example: hours=9.5 -> result is hour=9, minute=30, second=0. + +Parameters: + hours - [in] The decimal hours value of the time. If not in range 0..23 it will be 'unwound' to be in range. + hour - [out] The hour value of the time specified by 'hours'. + minute - [out] The minute value of the time specified by 'hours'. + second - [out] The second value of the time specified by 'hours'. +*/ +ON_DECL void ON_DecimalHoursToHMS(double hours, int& hour, int& minute, int& second); + +/* +Description: + Converts a time specified as decimal hours to hour, minute and second. + Guaranteed to produce a valid hour, minute and second result. + Example: hours=9.5 -> result is hour=9, minute=30, second=0. + Because of rounding, a value such as 23.99999 will come out as midnight the next day. + Therefore, the year, month and day are also passed in so that they can be adjusted if necessary. + Example: hours=23.99999 -> result is hour=0, minute=0, second=0 and date is incremented by one day. + +Parameters: + hours - [in] The decimal hours value of the time. If not in range 0..23 it will be 'unwound' to be in range. + hour - [out] The hour value of the time specified by 'hours'. + minute - [out] The minute value of the time specified by 'hours'. + second - [out] The second value of the time specified by 'hours'. + year - [in/out] The year value of the date, adjusted if necessary. + month - [in/out] The month value of the date, adjusted if necessary. + day - [in/out] The day value of the date, adjusted if necessary. +*/ +ON_DECL void ON_DecimalHoursToHMS(double hours, int& hour, int& minute, int& second, int& year, int& month, int& day); + #endif diff --git a/opennurbs_surface.cpp b/opennurbs_surface.cpp index fa0b0fdb..84d51be2 100644 --- a/opennurbs_surface.cpp +++ b/opennurbs_surface.cpp @@ -104,7 +104,7 @@ bool ON_Surface::SetDomain( double, double ) { - // TODO make this pure virutual when all the source code is available + // TODO make this pure virtual when all the source code is available return false; } @@ -442,7 +442,7 @@ bool ON_Surface::GetNextDiscontinuity( { // 20 March 2003 Dale Lear: // Have to look for locus discontinuities at ends. - // Must test both ends becuase t0 > t1 is valid input. + // Must test both ends because t0 > t1 is valid input. // In particular, for ON_CurveProxy::GetNextDiscontinuity() // to work correctly on reversed "real" curves, the // t0 > t1 must work right. diff --git a/opennurbs_surface.h b/opennurbs_surface.h index 16242d59..412217bb 100644 --- a/opennurbs_surface.h +++ b/opennurbs_surface.h @@ -422,12 +422,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -524,7 +524,7 @@ public: ) const; virtual - bool Reverse( // reverse parameterizatrion, Domain changes from [a,b] to [-b,-a] + bool Reverse( // reverse parameterization, Domain changes from [a,b] to [-b,-a] int // dir 0 = "s", 1 = "t" ) = 0; @@ -765,7 +765,7 @@ public: 0 unable to create NURBS representation with desired accuracy. 1 success - returned NURBS parameterization - matches the surface's to wthe desired accuracy + matches the surface's to the desired accuracy 2 success - returned NURBS point locus matches the surface's to the desired accuracy and the domain of the NURBS surface is correct. On @@ -773,7 +773,7 @@ public: the NURBS surface parameterization may not match to the desired accuracy. This situation happens when getting NURBS representations of - surfaces that have a transendental parameterization + surfaces that have a transcendental parameterization like spheres, cylinders, and cones. Remarks: This is a low-level virtual function. If you do not need @@ -805,7 +805,7 @@ public: the NURBS surface parameterization may not match. This situation happens when getting NURBS representations of - surfaces that have a transendental parameterization + surfaces that have a transcendental parameterization like spheres, cylinders, and cones. Remarks: This is a low-level virtual function. diff --git a/opennurbs_surfaceproxy.cpp b/opennurbs_surfaceproxy.cpp index 10a29ac3..b62765e9 100644 --- a/opennurbs_surfaceproxy.cpp +++ b/opennurbs_surfaceproxy.cpp @@ -251,7 +251,7 @@ ON_SurfaceProxy::IsIsoparametric( // returns isoparametric status of 2d curve const ON_Interval* subdomain ) const { - // this is a virtual overide of an ON_Surface::IsIsoparametric + // this is a virtual override of an ON_Surface::IsIsoparametric const ON_Curve* pC = &crv; ON_Curve* pTranC = nullptr; @@ -301,7 +301,7 @@ ON_SurfaceProxy::IsIsoparametric( // returns isoparametric status based on bound const ON_BoundingBox& box ) const { - // this is a virtual overide of an ON_Surface::IsIsoparametric + // this is a virtual override of an ON_Surface::IsIsoparametric const ON_BoundingBox* pbox = &box; ON_BoundingBox Tbox( ON_3dPoint( box.m_min[1],box.m_min[0],0.0), ON_3dPoint( box.m_max[1],box.m_max[0],0.0) ); @@ -502,7 +502,7 @@ ON_Curve* ON_SurfaceProxy::IsoCurve( int ON_SurfaceProxy::GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 @@ -525,7 +525,7 @@ int ON_SurfaceProxy::HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 diff --git a/opennurbs_surfaceproxy.h b/opennurbs_surfaceproxy.h index 6912d2b7..72bc8418 100644 --- a/opennurbs_surfaceproxy.h +++ b/opennurbs_surfaceproxy.h @@ -182,12 +182,12 @@ public: /* Description: - Search for a derivatitive, tangent, or curvature + Search for a derivative, tangent, or curvature discontinuity. Parameters: dir - [in] If 0, then "u" parameter is checked. If 1, then the "v" parameter is checked. - c - [in] type of continity to test for. + c - [in] type of continuity to test for. t0 - [in] Search begins at t0. If there is a discontinuity at t0, it will be ignored. This makes it possible to repeatedly call GetNextDiscontinuity @@ -283,7 +283,7 @@ public: double curvature_tolerance=ON_SQRT_EPSILON ) const override; - bool Reverse( // reverse parameterizatrion, Domain changes from [a,b] to [-b,-a] + bool Reverse( // reverse parameterization, Domain changes from [a,b] to [-b,-a] int // dir 0 = "s", 1 = "t" ) override; @@ -315,7 +315,7 @@ public: int GetNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 @@ -329,7 +329,7 @@ public: int HasNurbForm( // returns 0: unable to create NURBS representation // with desired accuracy. // 1: success - returned NURBS parameterization - // matches the surface's to wthe desired accuracy + // matches the surface's to the 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 diff --git a/opennurbs_symmetry.cpp b/opennurbs_symmetry.cpp index c4f0f11b..c7acfe93 100644 --- a/opennurbs_symmetry.cpp +++ b/opennurbs_symmetry.cpp @@ -226,7 +226,7 @@ ON_Symmetry::Region ON_Symmetry::PointRegion(ON_3dPoint point, bool bUseCleanupT break; } - // When the point is not valid, the symmetry is not set, or an evaluaton produces nans, then return ON_Symmetry::Region::Unset. + // When the point is not valid, the symmetry is not set, or an evaluation produces nans, then return ON_Symmetry::Region::Unset. return ON_Symmetry::Region::Unset; } @@ -509,7 +509,7 @@ bool ON_Symmetry::IsMotifBoundarySubDVertex(const class ON_SubDVertex* v, bool b break; case ON_Symmetry::Type::Rotate: - // All boundary vertices must be eligable for joining. + // All boundary vertices must be eligible for joining. // The pinwheel motifs in RH-63376 shows why. return true; break; @@ -933,7 +933,7 @@ bool ON_Symmetry::Read(ON_BinaryArchive& archive) if (false == archive.ReadUuid(symmetry_id)) break; - // Before June 1, 2021: Chunk verson 2 for rotations that had a rotation plane. + // Before June 1, 2021: Chunk version 2 for rotations that had a rotation plane. // June 1, 2021: Chunk version 3 for symmetry_type=113 prototyping rotations with no rotation plane // Future: Chunk version 4 for final rotations not using a rotation plane. int inner_chunk_version = 0; @@ -1289,7 +1289,7 @@ static bool Internal_SameRotation(const ON_Symmetry* lhs, const ON_Symmetry* rhs const double rhs_a = ((lhs_t * rhs_t < 0.0) ? -1.0 : 1.0) * rhs->RotationAngleRadians(); if (fabs(lhs_a - rhs_a) <= zero_tolerance) { - // a point 1 unit from the common axis will rotate within zero tolrance + // a point 1 unit from the common axis will rotate within zero tolerance return true; } } @@ -2223,7 +2223,7 @@ double ON_Symmetry::CleanupTolerance() const { // The default constructor sets m_cleanup_tolerance = 0.0. // Handling m_cleanup_tolerance this way insures that ON_Symmetry::CleanupTolerance() - // will always return ON_Symmetry::ZeroTolerance (which may chnage), even with class definitions + // will always return ON_Symmetry::ZeroTolerance (which may change), even with class definitions // read from old archives. return (m_cleanup_tolerance >= ON_Symmetry::ZeroTolerance) ? m_cleanup_tolerance : ON_Symmetry::ZeroTolerance; } diff --git a/opennurbs_symmetry.h b/opennurbs_symmetry.h index 82843b3d..d87c410a 100644 --- a/opennurbs_symmetry.h +++ b/opennurbs_symmetry.h @@ -74,7 +74,7 @@ public: Inversion = 4, /// - /// General case cyclic symmtry (order >= 2) + /// General case cyclic symmetry (order >= 2) /// (cyclic transformation)^N = identity. /// When N is 2 or odd, Det(cyclic transformation) = 1. /// When N is even and greater than 2, Det(cyclic transformation) = 1 or -1. @@ -439,7 +439,7 @@ private: object or world. Remarks: If inversion_transform is a reflection, consider using CreateReflectSymmetry() instead. - When Det(transformation) = 1 and transformtion^2 = identity, use CreateCyclicSymmetry() instead. + When Det(transformation) = 1 and transformation^2 = identity, use CreateCyclicSymmetry() instead. */ static const ON_Symmetry Internal_CreateInversionSymmetry( ON_UUID symmetry_id, @@ -553,7 +553,7 @@ public: /* Returns: - True if SymmetryType() is ON_Symmetry::Type::ReflectAndRotage + True if SymmetryType() is ON_Symmetry::Type::ReflectAndRotate */ bool IsReflectAndRotate() const; @@ -576,13 +576,13 @@ public: void Clear(); /* - Rturns: + Returns: True if this instance is set to a symmetry. */ bool IsSet() const; /* - Rturns: + Returns: True if this instance is not set. */ bool IsUnset() const; @@ -609,7 +609,7 @@ public: Returns: 0: unset symmetry 1: the cyclic transformation is the identity. - N >= 2: CyclicTransformation()^N = idenity and CyclicTransform()^i != idenity when 0 < i < N. + N >= 2: CyclicTransformation()^N = identity and CyclicTransform()^i != identity when 0 < i < N. Remarks: In common cases, CyclicTransformation() is either the identity or a rotation. */ @@ -635,7 +635,7 @@ public: Parameters: bIncludeIdentity - [in] If true, then motif_transformations[0] = identity and MotifCount() transformations are returned. - Otherwise, motif_transformations[0] = MotifeTransformation(1) and (MotifCount() -1) transformations are returned. + Otherwise, motif_transformations[0] = MotifTransformation(1) and (MotifCount() -1) transformations are returned. motif_transformations[] - out motif transformations are returned here. Returns: @@ -655,7 +655,7 @@ public: Remarks: NOTE: A symmetry with SymmetryOrder() = 2 and transformation S can be represented as either InversionTransformation() = S and CyclicTransformation() = identity or - or CyclicTransformation() = S and InversionTransformation() = idenity. + or CyclicTransformation() = S and InversionTransformation() = identity. The convention is to use the cyclic transforms when S is a 180 rotations and inversion transforms otherwise. */ @@ -670,7 +670,7 @@ public: Remarks: NOTE: A symmetry with SymmetryOrder() = 2 and transformation S can be represented as either InversionTransformation() = S and CyclicTransformation() = identity or - or CyclicTransformation() = S and InversionTransformation() = idenity. + or CyclicTransformation() = S and InversionTransformation() = identity. The convention is to use the cyclic transforms when S is a 180 rotations and inversion transforms otherwise. */ @@ -932,7 +932,7 @@ public: /* Description: Cleanup tolerance is a 3d world unt length used to preprocess input when creating - symmetric objects. For example, in a relfect symmetry, cleanup tolerance would be + symmetric objects. For example, in a reflect symmetry, cleanup tolerance would be used to move vertices near the reflection plane to be on the reflection plane. This tolerance is context sensitive. In the same model it could vary between two different input objects. The value is saved with the symmetry so calculations driven @@ -949,7 +949,7 @@ public: /* Description: Cleanup tolerance is a 3d world unt length used to preprocess input when creating - symmetric objects. For example, in a relfect symmetry, cleanup tolerance would be + symmetric objects. For example, in a reflect symmetry, cleanup tolerance would be used to move vertices near the reflection plane to be on the reflection plane. This tolerance is context sensitive. In the same model it could vary between two different input objects. The value is saved with the symmetry so calculations driven diff --git a/opennurbs_system_compiler.h b/opennurbs_system_compiler.h index 5984bc75..9fcfde2a 100644 --- a/opennurbs_system_compiler.h +++ b/opennurbs_system_compiler.h @@ -265,7 +265,7 @@ /* // The __clang__ test must come before the gnu tests because Apple's clang -// uncoditionally defines __GNUC__ +// unconditionally defines __GNUC__ */ #if !defined(ON_COMPILER_CLANG) #define ON_COMPILER_CLANG diff --git a/opennurbs_text.cpp b/opennurbs_text.cpp index b01a8be2..f3a862d9 100644 --- a/opennurbs_text.cpp +++ b/opennurbs_text.cpp @@ -2071,7 +2071,7 @@ bool ON_TextContent::MeasureTextRunArray( line_height = run->TextHeight(); // Increase height if this is highest run so far in this line double lfh = ON_TextContent::GetLinefeedHeight(*run); if (line_start || lfh > linefeed_height) - linefeed_height = lfh; // Increase linefeed height if this is the higest so far in this line + linefeed_height = lfh; // Increase linefeed height if this is the highest so far in this line line_start = false; line_end = false; last_text_run = run; diff --git a/opennurbs_text.h b/opennurbs_text.h index 331ebbbb..e0bccd0a 100644 --- a/opennurbs_text.h +++ b/opennurbs_text.h @@ -500,7 +500,7 @@ public: Evaluates the field instructions in the run and puts the results in run->m_display_string. Parameters: - [in/out] ON_TextRun& run - Run to evsluste. Modified to store results + [in/out] ON_TextRun& run - Run to evaluate. Modified to store results Returns: true = Success false = Failure diff --git a/opennurbs_textglyph.cpp b/opennurbs_textglyph.cpp index fbac0cd7..77c302fa 100644 --- a/opennurbs_textglyph.cpp +++ b/opennurbs_textglyph.cpp @@ -311,7 +311,7 @@ int ON_FontGlyph::GetGlyphList textlength, code_points.Array(), textlength, - nullptr, // error status - ingnored + nullptr, // error status - ignored 0xFFFFFFFF, // mask as many errors as possible ON_UnicodeCodePoint::ON_ReplacementCharacter, // unicode error mark when string is incorrectly encoded nullptr // pointer to end of parsed text is ignored @@ -1469,7 +1469,7 @@ bool ON_TextRun::GetGlyphContours( run.DisplayString(), run_font, bSingleStrokeFont, - 0.0, // text_height = 0.0 means get glyphs in openurbs normalized font size + 0.0, // text_height = 0.0 means get glyphs in opennurbs normalized font size 0.0, // small_caps_scale, run_contours ); diff --git a/opennurbs_textiterator.cpp b/opennurbs_textiterator.cpp index 552fb66b..fbe23ed4 100644 --- a/opennurbs_textiterator.cpp +++ b/opennurbs_textiterator.cpp @@ -93,7 +93,7 @@ static const wchar_t* tagField = L"field"; static const wchar_t* tagUniCpCount = L"uc"; // #bytes used following \uN for codepage code of equivalenet char -static const wchar_t* tagUniCharDec = L"u"; // UNOCODE UTF-16 encoded value as a signed short (0x8...) will be -.... +static const wchar_t* tagUniCharDec = L"u"; // UNICODE UTF-16 encoded value as a signed short (0x8...) will be -.... // NOTE WELL: When a single UNICODE code point requires a UTF-16 // surrogate pair encoding, there will be TWO \uXXXX? values for that code point. // For example, the single UNICODE code point @@ -102,7 +102,7 @@ static const wchar_t* tagUniCharDec = L"u"; // UNOCODE UTF-16 enco // value in RTF looks like ...{\ltrch \u-10179?\u-8751?}... // -10179 as a signed 2 byte short has the same bits as unsigned short 0xD83D. // -8751 as a signed 2 byte short has the same bits as unsigned short 0xDDD1. - // Many "emoji glyphs" UNOCODE code points require UTF-16 surrogate pair encodings. + // Many "emoji glyphs" UNICODE code points require UTF-16 surrogate pair encodings. static const wchar_t* tagUniTwoDest = L"upr"; // two embedded unicode destinations @@ -484,7 +484,7 @@ void ON_TextBuilder::CharSet(const wchar_t* value) // \fcharsetN if(ReadingFontDefinition()) { // This is a charset specification in a font definition in the font table - // the value is convertable to a codepage to use for interpreting the text chars + // the value is convertible to a codepage to use for interpreting the text chars // using this font into unicode points m_current_props.SetCharSet(charset, true); } @@ -2559,13 +2559,6 @@ ON_RtfParser::ON_RtfParser(ON_TextIterator& iter, ON_TextBuilder& builder) { } - -ON_Color ParseColor(const wchar_t* value) -{ - ON_Color color; - return color; -} - bool ON_RtfParser::ProcessTag(const wchar_t* name, const wchar_t* value, bool optional) { ON_wString tagname(name); @@ -2684,7 +2677,7 @@ rc = false; // '\\tagname ... ;' follows optional tag. // optional tags can be skipped, and terminate with ';' // the first tagname following '\\*\\' is the name of the optional tag and -// additional tags and tokens can follow, up to a terminiating ';' +// additional tags and tokens can follow, up to a terminating ';' // tags can contain up to 32 chars in the name optionally followed by a number bool ON_RtfParser::ReadOptionalTag() { @@ -2850,7 +2843,7 @@ bool ON_RtfParser::Parse() break; case '\'': - // This case sould never occur - it is handled by + // This case should never occur - it is handled by // Internal_ParseMBCSString at the beginning of this while statement. ON_ERROR("Bug in RTF parsing code."); break; @@ -2882,7 +2875,7 @@ bool ON_RtfParser::Parse() // Tag names are always low ascii alphabetic m_ti.Back(); ReadTag(false); - //// Breaks reading unocode text like A<\u26085?\u26412?\u12398?\u12469?\u12452?> + //// Breaks reading unicode text like A<\u26085?\u26412?\u12398?\u12469?\u12452?> //// m_builder.m_current_codepoints.Empty(); optional_tag = false; } @@ -3046,7 +3039,7 @@ static bool GetRunText(ON_TextRun* run, ON_wString& text_out, bool& foundunicode if (code_point > 0x80 || 1 != utf16_count || code_point != (ON__UINT32)utf16[0]) { - // When we write RTF, we do not specify what encodding is used for values in the range 0x80 - 0xFF. + // When we write RTF, we do not specify what encoding is used for values in the range 0x80 - 0xFF. // // The ON_wString temp should to have UTF-16 encoding on Windows platforms // and UTF-32 encoding on Apple platforms. @@ -3055,19 +3048,19 @@ static bool GetRunText(ON_TextRun* run, ON_wString& text_out, bool& foundunicode // and UNICODE maps the value to a control that typically has no printable glyph. // These "tricky values" are all in the range 0x80 ... 0x9F. // An example is the Euro sign (Windows-1252 0x80 = Euro sign, UNICODE U+0080 = xxx control, - // UNOCODE U+20AC = Euro sign). + // UNICODE U+20AC = Euro sign). // // The RTF we get from Windows controls, like the "Text" command dialog box, // typically specifies it is using Windows-1252 and encodes the Euro sign as \`80. // So, if we have one of these "euro like" values, we will explicitly write it as a UNICODE value - // to avoid the possiblity of something defaulting to using Windows-1252. + // to avoid the possibility of something defaulting to using Windows-1252. // https://mcneel.myjetbrains.com/youtrack/issue/RH-38205 // // See ON_DecodeWindowsCodePage1252Value() for more details. // - // UNOCODE code points that require UTF-16 surrogate pair encodings have + // UNICODE code points that require UTF-16 surrogate pair encodings have // two RTF values TWO \uN?\uN? values. - // For example, UNOCODE code point U+1F5D1 has UTF-16 encodeing (0xD83D, 0xDDD1) + // For example, UNICODE code point U+1F5D1 has UTF-16 encodeing (0xD83D, 0xDDD1) // and the RTF looks like ...{\ltrch \u-10179?\u-8751?}. for (int utf16i = 0; utf16i < utf16_count; utf16i++) { diff --git a/opennurbs_textlog.h b/opennurbs_textlog.h index b24c754d..56fd9562 100644 --- a/opennurbs_textlog.h +++ b/opennurbs_textlog.h @@ -195,7 +195,7 @@ public: /* Description: - Print a formatted INICODE string of up to 2000 characters. + Print a formatted UNICODE string of up to 2000 characters. Parameters: format - [in] nullptr terminated format control string Remarks: @@ -315,7 +315,7 @@ public: int, // count int, // stride const double*, // point[] array - const char* = nullptr // optional preabmle + const char* = nullptr // optional preamble ); void PrintPointGrid( @@ -324,7 +324,7 @@ public: int, int, // point_count0, point_count1 int, int, // point_stride0, point_stride1 const double*, // point[] array - const char* = nullptr // optional preabmle + const char* = nullptr // optional preamble ); void PrintKnotVector( diff --git a/opennurbs_textrun.h b/opennurbs_textrun.h index a1d43dd2..2f54178e 100644 --- a/opennurbs_textrun.h +++ b/opennurbs_textrun.h @@ -193,7 +193,7 @@ public: void SetStackedOff(); // Set or get the WCS model unit height of the text - // not including any annotatition scaling + // not including any annotation scaling double TextHeight() const; void SetTextHeight(double h); diff --git a/opennurbs_texture.h b/opennurbs_texture.h index c12cef23..0d2f06b7 100644 --- a/opennurbs_texture.h +++ b/opennurbs_texture.h @@ -339,7 +339,7 @@ public: bitmap_texture = 1U, // "standard" image texture. // Deprecated. Use Diffuse. diffuse_texture = 1U, // ideally albedo. bump_texture = 2U, // bump map - see m_bump_scale comment - transparency_texture = 3U, // value = alpha (see m_tranparancy_id) Deprecated. Use Opacity. No change needed to functionality - transparency in Rhino has always meant opacity. + transparency_texture = 3U, // value = alpha (see m_transparency_id) Deprecated. Use Opacity. No change needed to functionality - transparency in Rhino has always meant opacity. opacity_texture = 3U, // value = alpha. // The following textures are only for PBR materials @@ -479,10 +479,10 @@ public: // texture in the ON_Material.m_textures[] array that has // type m_transparency_texture. The runtime bitmap_texture's // alpha is set to (255-max(R,G,B)) (the "value" in the hue, - // saturation,value sense) of the correspondeing + // saturation,value sense) of the corresponding // transparency_texture pixel. // - // For example, if you had a bitmap texuture that was green + // For example, if you had a bitmap texture that was green // with purple dots saved in a RGB .bmp file and you wanted // the purple dots to be semi-transparent, you could create // another bitmap that was black, where the original was green, diff --git a/opennurbs_topology.cpp b/opennurbs_topology.cpp index 66bb5b0e..a237f154 100644 --- a/opennurbs_topology.cpp +++ b/opennurbs_topology.cpp @@ -52,7 +52,7 @@ bool ON_ComponentAttributes::EdgeIsEligible( const unsigned int masks[] = { // open/closed test - // open = edge has distict start/end vertices (they might be located at the same location) + // open = edge has distinct start/end vertices (they might be located at the same location) // closed = edge has identical start/end vertices. ON_ComponentAttributes::EdgeAttributes::Open | ON_ComponentAttributes::EdgeAttributes::Closed, diff --git a/opennurbs_topology.h b/opennurbs_topology.h index e243b562..874071a5 100644 --- a/opennurbs_topology.h +++ b/opennurbs_topology.h @@ -44,7 +44,7 @@ public: /// /// The Open bit is set when an edge has distinct start and end vertices. /// Open and Closed are mutually exclusive edge attributes. - /// Note that an open edge can have zero length when two distict vertices + /// Note that an open edge can have zero length when two distinct vertices /// have identical locations and the edge's geometry is a zero length curve. /// Open = 1, diff --git a/opennurbs_torus.h b/opennurbs_torus.h index 9211fc42..10be6451 100644 --- a/opennurbs_torus.h +++ b/opennurbs_torus.h @@ -49,7 +49,7 @@ public: Description: Get the circle that is the isocurve on the torus at a specified minor angle. - Parameteters: + Parameters: minor_angle_radians - [in] Returns: A circle with normal major_circle.plane.zaxis that starts @@ -66,7 +66,7 @@ public: Description: Get the circle that is the isocurve on the torus at a specified minor angle. - Parameteters: + Parameters: minor_angle_degrees - [in] Returns: A circle with normal major_circle.plane.zaxis that starts @@ -83,7 +83,7 @@ public: Description: Get the minor circle that is the isocurve on the torus at a specified major angle. - Parameteters: + Parameters: major_angle_radians - [in] Returns: A circle with radius = minor_radis, @@ -101,7 +101,7 @@ public: Description: Get the minor circle that is the isocurve on the torus at a specified major angle. - Parameteters: + Parameters: major_angle_degrees - [in] Returns: A circle with radius = minor_radis, @@ -174,7 +174,7 @@ public: bool Transform( const ON_Xform& ); - // parameterization of NURBS surface does not match torus's transcendental paramaterization + // parameterization of NURBS surface does not match torus's transcendental parameterization int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success /* diff --git a/opennurbs_unicode.cpp b/opennurbs_unicode.cpp index 84f8b301..ced8c3be 100644 --- a/opennurbs_unicode.cpp +++ b/opennurbs_unicode.cpp @@ -849,7 +849,7 @@ int ON_DecodeUTF8( i0 = 1; if ( ON_IsValidUnicodeCodePoint(e->m_error_code_point) ) { - // skip to next UTF-8 start elemement + // skip to next UTF-8 start element for ( /*empty for initializer*/; i0 < sUTF8_count; i0++ ) { // Search for the next element of sUTF8[] that is the @@ -918,7 +918,7 @@ int ON_DecodeUTF8( int ON_EncodeUTF16( ON__UINT32 unicode_code_point, ON__UINT16 sUTF16[2] ) { - // put the most comman case first + // put the most common case first if ( unicode_code_point < 0xD800 ) { // code point values U+0000 ... U+D7FF @@ -2028,7 +2028,7 @@ int ON_DecodeUTF32( } *unicode_code_point = e->m_error_code_point; - return 1; // error masked and e->m_error_code_point returnred. + return 1; // error masked and e->m_error_code_point returned. } int ON_DecodeSwapByteUTF32( @@ -3583,7 +3583,7 @@ unsigned ON_UnicodeSuperscriptFromCodePoint( 0x1D3A, // N 0x1D3C, // O 0x1D3E, // P - 0, // Q NOT AVIALABLE + 0, // Q NOT AVAILABLE 0x1D3F, // R 0, // S NOT AVAILABLE 0x1D40, // T @@ -3619,7 +3619,7 @@ unsigned ON_UnicodeSuperscriptFromCodePoint( } } - // either cp is already a superscript or none is avilable. + // either cp is already a superscript or none is available. return no_superscript_cp; } @@ -3696,7 +3696,7 @@ unsigned ON_UnicodeSubcriptFromCodePoint( } } - // either cp is already a subscript or none is avilable. + // either cp is already a subscript or none is available. return cp; } @@ -4262,13 +4262,13 @@ const ON_SimpleArray< ON_Big5UnicodePair >& ON_Big5UnicodePair::Big5ToUnicode() { // The pair[][2] array was created by combining information from // http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT, retrieved: May 17, 2021, - // and WIndows 10 MultiByteToWideChar() using code page 950. + // and Windows 10 MultiByteToWideChar() using code page 950. // // pairs[][2] = {...{BIG5 code point, Unicode code point}...} // sorted by BIG5 code point. All Unicode code points must be valid and < 0xFFFF. // // The primary use of this code is to convert legacy BIG5 encoded information into - // Unicode encoded information and modificiations to the original sources + // Unicode encoded information and modifications to the original sources // (marked with [MODyyymmdd]) were made to make thos conversions as robust as possible. // @@ -4601,7 +4601,7 @@ const ON_SimpleArray< ON_Big5UnicodePair >& ON_Big5UnicodePair::Big5ToUnicode() {0xA34B,0x0398}, // GREEK CAPITAL LETTER THETA {0xA34C,0x0399}, // GREEK CAPITAL LETTER IOTA {0xA34D,0x039a}, // GREEK CAPITAL LETTER KAPPA - {0xA34E,0x039b}, // GREEK CAPITAL LETTER LAMDA + {0xA34E,0x039b}, // GREEK CAPITAL LETTER LAMBDA {0xA34F,0x039c}, // GREEK CAPITAL LETTER MU {0xA350,0x039d}, // GREEK CAPITAL LETTER NU {0xA351,0x039e}, // GREEK CAPITAL LETTER XI @@ -4625,7 +4625,7 @@ const ON_SimpleArray< ON_Big5UnicodePair >& ON_Big5UnicodePair::Big5ToUnicode() {0xA363,0x03b8}, // GREEK SMALL LETTER THETA {0xA364,0x03b9}, // GREEK SMALL LETTER IOTA {0xA365,0x03ba}, // GREEK SMALL LETTER KAPPA - {0xA366,0x03bb}, // GREEK SMALL LETTER LAMDA + {0xA366,0x03bb}, // GREEK SMALL LETTER LAMBDA {0xA367,0x03bc}, // GREEK SMALL LETTER MU {0xA368,0x03bd}, // GREEK SMALL LETTER NU {0xA369,0x03be}, // GREEK SMALL LETTER XI @@ -18079,7 +18079,7 @@ const ON_SimpleArray< ON_Big5UnicodePair >& ON_Big5UnicodePair::UnicodeToBig5() unicode_to_big5.Reserve(count0 + ((int)(sizeof(u_big5_pair_add)/sizeof(u_big5_pair_add[0])))); unicode_to_big5.Append(count0, big5_to_unicode.Array()); - // Dictionary sort unicode_to_big5[] by Uniocode then BIG5 code point. + // Dictionary sort unicode_to_big5[] by Unicode then BIG5 code point. // (There are typically duplicate Unicode code points.) unicode_to_big5.QuickSortAndRemoveDuplicates(ON_Big5UnicodePair::CompareUnicodeAndBig5CodePoints); if (count0 != unicode_to_big5.Count()) diff --git a/opennurbs_unicode.h b/opennurbs_unicode.h index d5bea797..f2dfb2d0 100644 --- a/opennurbs_unicode.h +++ b/opennurbs_unicode.h @@ -346,8 +346,8 @@ enum ON_UnicodeCodePoint /// /// WASTEBASKET U+1F5D1 (🗑) /// The wastebasket is a good code point to test glyph rendering and UTF-16 surrogate pair encodings. - /// UTF-8 encodeing = (0xF0, 0x9F, 0x97, 0x91) - /// UTF-16 encodeing = ( 0xD83D, 0xDDD1 ) (UTF-16surrogate pair) + /// UTF-8 encoding = (0xF0, 0x9F, 0x97, 0x91) + /// UTF-16 encoding = ( 0xD83D, 0xDDD1 ) (UTF-16surrogate pair) /// ON_Wastebasket = 0x1F5D1, @@ -525,7 +525,7 @@ Parameters: w1 - [in] w2 - in] error_code_point - [in] - Value returned when (w1,w2) is not a valud UTF-16 surrogate pair. + Value returned when (w1,w2) is not a value UTF-16 surrogate pair. Depending on what you are doing, good choices are 0, ON_UnicodeCodePoint::ON_ReplacementCharacter, and @@ -665,7 +665,7 @@ struct ON_CLASS ON_UnicodeErrorParameters is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). @@ -897,7 +897,7 @@ Description: Convert valid unicode code point values to its UTF-8 form and use the same encoding calculation for other integers with values <= 0x7FFFFFFF. When strict UTF-8 encoding is desired, the caller is responsible for - insuring the value of u is a valid uncode codepoint. + insuring the value of u is a valid unicode codepoint. Parameters: u - [in] Integer in the CPU's native byte order in the interval [0,2147483647]. @@ -909,7 +909,7 @@ Returns: 0: u is too large (>=2^31) to be encode. No changes are made to the sUTF8[] values. 1: the UTF-8 form of u is 1 byte returned in sUTF8[0]. - 2: the UTF-8 form of u is 2 byts returned in sUTF8[0],sUTF8[1]. + 2: the UTF-8 form of u is 2 bytes returned in sUTF8[0],sUTF8[1]. 3: the UTF-8 form of u is 3 bytes returned in sUTF8[0],sUTF8[1],sUTF8[2]. 4: the UTF-8 form of u is 4 bytes returned in sUTF8[0],sUTF8[1],sUTF8[2],sUTF8[3]. Note: The maximum valid unicode codepoint is 0x10FFFF. Values of u > 0x10FFFF @@ -1033,7 +1033,7 @@ Returns: as a valid UTF-16 surrogate pair. See e for masked errors. n >= 3: - sUTF16[0],..,sUTF16[n-1] did not forma valid UTF-16 encoding + sUTF16[0],..,sUTF16[n-1] did not form a valid UTF-16 encoding and were parsed as reasonably as possible. See e for masked errors. */ @@ -1084,7 +1084,7 @@ Returns: as a valid UTF-16 surrogate pair. See e for masked errors. n >= 3: - sUTF16[0],..,sUTF16[n-1] did not forma valid UTF-16 encoding + sUTF16[0],..,sUTF16[n-1] did not form a valid UTF-16 encoding and were parsed as reasonably as possible. See e for masked errors. */ @@ -1135,7 +1135,7 @@ Returns: as a valid UTF-16 surrogate pair. See e for masked errors. n >= 3: - sUTF16[0],..,sUTF16[n-1] did not forma valid UTF-16 encoding + sUTF16[0],..,sUTF16[n-1] did not form a valid UTF-16 encoding and were parsed as reasonably as possible. See e for masked errors. */ @@ -1490,7 +1490,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1628,7 +1628,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1765,7 +1765,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -1915,7 +1915,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2055,7 +2055,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2206,7 +2206,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2356,7 +2356,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2506,7 +2506,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2662,7 +2662,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2813,7 +2813,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -2960,7 +2960,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -3108,7 +3108,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -3256,7 +3256,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -3404,7 +3404,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -3552,7 +3552,7 @@ Parameters: decoded, the value of the resulting unicode code point is used, and parsing continues. 8: An overlong UTF-8 encoding sequence was encountered and - the value of the overlong sUTF-8 equence was a valid + the value of the overlong sUTF-8 sequence was a valid unicode code point. This error is masked if 0 != (8 & m_error_mask). If the error is masked, then the unicode code point @@ -3621,7 +3621,7 @@ Description: rich text RTF in ON_TextContent, strings from outside sources with known MBCS encodings, and some user interface code. - Opennnurbs assumes all other char strings are UTF-8 encoded. + Opennurbs assumes all other char strings are UTF-8 encoded. If 1 = sizeof(wchar_t), then UTF-8 encoding is used for the output string. @@ -3709,7 +3709,7 @@ Description: This function is designed to be used to create strings that will be used write files that require non-UTF encoded char strings. - Opennnurbs assumes all other char strings are UTF-8 encoded. + Opennurbs assumes all other char strings are UTF-8 encoded. If 1 = sizeof(wchar_t), then sWideChar must be UTF-8 encoded. @@ -4054,7 +4054,7 @@ public: /// /// Value to return if the code point value is 0xFFFE. /// - /// True if the code point value is a valud Unicode code point. + /// True if the code point value is a valid Unicode code point. bool IsValid(bool bNullIsValid, bool bByteOrderMarkIsValid) const; /// @@ -4230,7 +4230,7 @@ public: /// /// Value to return if the code point value is an ASCII code point (<= 0x7F). /// - /// True if the code point value is a valud BIG5 code point. + /// True if the code point value is a valid BIG5 code point. bool IsValid(bool bNullIsValid, bool bASCIICodePointIsValid) const; /// diff --git a/opennurbs_units.cpp b/opennurbs_units.cpp index d04a34c2..e2387805 100644 --- a/opennurbs_units.cpp +++ b/opennurbs_units.cpp @@ -34,8 +34,8 @@ #define ON_UNICODE_DEGREE_SYMBOL 0x00B0 #define ON_WCHAR_DEGREE_SYMBOL L"\x00B0" -// The unicode masuline ordinal indicator (Spanish) -// is often mistakenlyused as a degrees symbol. +// The unicode masculine ordinal indicator (Spanish) +// is often mistakenly used as a degrees symbol. #define ON_UNICODE_MASCULINE_ORDINAL_INDICATOR 0x00BA #define ON_WCHAR_MASCULINE_ORDINAL_INDICATOR L"\x00BA" @@ -104,10 +104,10 @@ public: Parses m_name and sets the m_utf32_name[] and m_utf32_name_count fields. Returns: - Number of elments of m_name that were parsed; 0 indicates failure. + Number of elements of m_name that were parsed; 0 indicates failure. Remarks: m_name must contain a character that terminates unit system name parsing. - This can be a null, digit, punctuation, aritmetic operator, or a + This can be a null, digit, punctuation, arithmetic operator, or a unicode code point <= 0x0020 (0x0020 = space = 32 decimal). */ int SetSimplifiedName(); @@ -379,8 +379,8 @@ static ON_UnitName en_US_customary_length_units[] = static ON_UnitName angle_no_units[] = { // These entries prevent parsing the strings unless an - // entry for a locale explicitly inludes the string and - // the parsing prefered local id matches exactly. + // entry for a locale explicitly includes the string and + // the parsing preferred local id matches exactly. // The purpose is to prevent incorrectly parsing strings // the define different unit systems in different // locales. @@ -907,8 +907,8 @@ static ON__UINT32 ON_ToLower( ON__UINT32 c ) // unicode capital latin letter code points to the corresponding // unicode latin small letter code points. It is designed to be // used in code that has to quickly parse common unit names - // in English, Spanish, French, German, Protuguese and Czech. - // If other languages need to be supported, this funcition + // in English, Spanish, French, German, Portuguese and Czech. + // If other languages need to be supported, this function // may need to be enhanced. // // In many situations, "to lower" requires more context than a single @@ -920,7 +920,7 @@ static ON__UINT32 ON_ToLower( ON__UINT32 c ) // that works on Microsoft's, Apple's, Google's or Gnu's // compilers. There are solutions, but many depend on other // app state variables that define an app/machine locale. - // This meeans the result is not "predictably consistent". + // This means the result is not "predictably consistent". if ( c < 'A' ) return c; @@ -982,7 +982,7 @@ static ON__UINT32 ON_ToLower( ON__UINT32 c ) // NOTE: // This skips some "obvious" to lower conversions, but none // of these conversions are needed for common unit - // names in English, Spanish, French, German, Protuguese + // names in English, Spanish, French, German, Portuguese // or Czech. return c; } @@ -1009,8 +1009,8 @@ static ON__UINT32 ON_ToLatinAtoZ( ON__UINT32 c ) // It also converts sharp s (eszett) to latin letter S and // greek tau to to latin letter T. // - // This code is designed to be used efficently parse common unit - // names in English, Spanish, French, German, Protuguese and Czech. + // This code is designed to be used efficiently parse common unit + // names in English, Spanish, French, German, Portuguese and Czech. // If other languages need to be supported, this function will need // to be enhanced, redone, or removed. The unit names being parsed // by this code are often input on devices, like English language @@ -1164,7 +1164,7 @@ Parameters: unit name or abbreviation in Czech, English, French, German, Italian, Portuguese or Spanish. utf32_small_simple_name - [out] - A buffer where a null termintated UTF-32 encoded + A buffer where a null terminated UTF-32 encoded simplified small letter version of the input unit name is returned. utf32_small_simple_name_capacity - [in] @@ -1177,7 +1177,7 @@ Returns: Remarks: This code is used to quickly parse optional embedded unit - names, abreviations in input streams that specify angles, + names, abbreviations in input streams that specify angles, lengths, points in cartesian coordinates, and points in polar coordinates. @@ -1216,7 +1216,7 @@ unsigned int ON_GetSmallSimpleUnitsName( switch(name[0]) { case ON_UNICODE_QUOTATION_MARK: // quote (inches, arc seconds) - case ON_UNICODE_APOSTROPHE: // apostophe (feet, arc minutes) + case ON_UNICODE_APOSTROPHE: // apostrophe (feet, arc minutes) case ON_UNICODE_DEGREE_SYMBOL: // degree symbol (arc degrees) case ON_UNICODE_GREEK_SMALL_LETTER_TAU: // small tau (turns) utf32_small_simple_name[0] = (ON__UINT32)(name[0]); @@ -1229,8 +1229,8 @@ unsigned int ON_GetSmallSimpleUnitsName( utf32_small_simple_name[1] = 0; return 1; case ON_UNICODE_MASCULINE_ORDINAL_INDICATOR: - // The unicode masuline ordinal indicator (Spanish) - // is often mistakenlyused as a degrees symbol. + // The unicode masculine ordinal indicator (Spanish) + // is often mistakenly used as a degrees symbol. utf32_small_simple_name[0] = ON_UNICODE_DEGREE_SYMBOL; utf32_small_simple_name[1] = 0; return 1; @@ -1459,7 +1459,7 @@ static bool GetUnitSystemNameCache( // length_unit_list[].m_utf32_name_count increases. // Use that fact to build an index based on the value of // length_unit_list[].m_utf32_name_count so searches can - // easily be restriced to the region of length_unit_list[] + // easily be restricted to the region of length_unit_list[] // where a possible match exists. for ( i = 0; i < count; i++ ) { @@ -1577,7 +1577,7 @@ static unsigned char UnitSystemEnumValue( return 0; // this string requires an exact locale id match // Check for a language match; i.e., if cache.m_unit_list[] is - // is for locale en-US and the prefered_locale_id is en-UK, + // is for locale en-US and the preferred_locale_id is en-UK, // then use the en-US entry. The "language" part of a locale id // is encoded in the low byte of the locale id. if ( (0xFF & prefered_locale_id) == (0xFF & cache.m_unit_list[k].m_locale_id) ) @@ -2098,8 +2098,8 @@ int ON_ParseAngleUnitName( if ( ON_UNICODE_MASCULINE_ORDINAL_INDICATOR == str[0] ) { - // The unicode masuline ordinal indicator (Spanish) - // is often mistakenlyused as a degrees symbol. + // The unicode masculine ordinal indicator (Spanish) + // is often mistakenly used as a degrees symbol. str_index = 1; x.m_name = str; x.m_unit_system = static_cast(ON::AngleUnitSystem::Degrees); @@ -2458,7 +2458,7 @@ int ON_LengthUnitName::Internal_Compare( i = ON_wString::CompareOrdinal(a.m_name,b.m_name,false); if (i != 0) { - // ignore case order is prefered + // ignore case order is preferred j = ON_wString::CompareOrdinal(a.m_name, b.m_name, true); return (0 != j) ? j : i; } @@ -2691,7 +2691,7 @@ int ON_AngleUnitName::Internal_Compare( i = ON_wString::CompareOrdinal(a.m_name,b.m_name,false); if (i != 0) { - // ignore case order is prefered + // ignore case order is preferred j = ON_wString::CompareOrdinal(a.m_name, b.m_name, true); return (0 != j) ? j : i; } diff --git a/opennurbs_userdata.cpp b/opennurbs_userdata.cpp index 348e7098..fb3b6cfc 100644 --- a/opennurbs_userdata.cpp +++ b/opennurbs_userdata.cpp @@ -541,7 +541,7 @@ ON_UserData* ON_UnknownUserData::Convert() const ON_UserData* ud = nullptr; if ( IsValid() ) { const ON_ClassId* pID = ON_ClassId::ClassId( m_unknownclass_uuid ); - // if pID is nullptr, it means the definiton of the unknown user data + // if pID is nullptr, it means the definition of the unknown user data // is still not available if ( pID ) { // The class definition has been dynamically loaded since the @@ -887,7 +887,7 @@ static int cmp_hash_2dex_ij(const void* a, const void* b) // The "i" values are actually 32 bit hashes of a string // and are often large. The sign of (ai[0] - bi[0]) cannot // be used to compare ai[0] and bi[0] because integer - // overflow occures with values that are large. + // overflow occurs with values that are large. // ////// NO! //////if ( 0 == (rc = ai[0] - bi[0]) ) diff --git a/opennurbs_userdata.h b/opennurbs_userdata.h index 64299f01..c16dc67d 100644 --- a/opennurbs_userdata.h +++ b/opennurbs_userdata.h @@ -124,7 +124,7 @@ public: Parameters: archive - [in] The archive being written to. Typically, you will test - archive.Archive3dmVersion() to deterime if your userdata + archive.Archive3dmVersion() to determine if your userdata should be saved. parent_object - [in] The object managing this userdata. @@ -346,7 +346,7 @@ public: }; // Do not export this class -// It is used internally to read and write 3dm achives with versions < 60. +// It is used internally to read and write 3dm archives with versions < 60. class ON_RdkMaterialInstanceIdObsoleteUserData : public ON_ObsoleteUserData { // NO ON_OBJECT_DECLARE() for classes derived from ON_ObsoleteUserData diff --git a/opennurbs_userdata_obsolete.cpp b/opennurbs_userdata_obsolete.cpp index 1ef08392..c0e8eca1 100644 --- a/opennurbs_userdata_obsolete.cpp +++ b/opennurbs_userdata_obsolete.cpp @@ -37,7 +37,7 @@ static bool ON_Internal_ReadObsoleteUserDataAnonymouseChunk(ON_BinaryArchive& ar { // If the obsolete user data's Write()/Read() function wrapped all the contents in // an anonymous chunk (which is the suggested best practice), then - // this skip over everthing in the chunk and not generate any file read warnings or errors. + // this skip over everything in the chunk and not generate any file read warnings or errors. int major_version = 0; int minor_version = 0; bool rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&major_version,&minor_version); diff --git a/opennurbs_uuid.cpp b/opennurbs_uuid.cpp index 97b9aece..02dc2556 100644 --- a/opennurbs_uuid.cpp +++ b/opennurbs_uuid.cpp @@ -77,9 +77,9 @@ static const ON_UUID ON_Internal_CreateNotUniqueSequentialId( // // It is based on the MAC address of a network card that // was destroyed circa 2000. The Time portion of the UUID is generated - // from index_64_bit and will generall be well before the current time. + // from index_64_bit and will generally be well before the current time. // The reason for using this complicated approach is to insure - // data structures usisg these i values will pass validty checking + // data structures using these i values will pass validty checking // that tests to see if the UUID has a valid format. if (0 == index_64_bit) diff --git a/opennurbs_uuid.h b/opennurbs_uuid.h index baded6d3..dfbf1cef 100644 --- a/opennurbs_uuid.h +++ b/opennurbs_uuid.h @@ -64,7 +64,7 @@ extern ON_EXTERN_DECL const ON_UUID ON_rhino7_id; extern ON_EXTERN_DECL const ON_UUID ON_rhino8_id; extern ON_EXTERN_DECL const ON_UUID ON_rhino_id; -// Application ids for usedata written by versions +// Application ids for userdata written by versions // of opennurbs before userdata had application ids. extern ON_EXTERN_DECL const ON_UUID ON_v2_userdata_id; extern ON_EXTERN_DECL const ON_UUID ON_v3_userdata_id; @@ -487,7 +487,7 @@ ON_UUID ON_UuidFromString( const wchar_t* s ); /* Description: - Converts a uuid to a null termintated ASCII string like + Converts a uuid to a null terminated ASCII string like "85a08515-f383-11d3-bfe7-0010830122f0". Parameters: uuid - [in] @@ -503,7 +503,7 @@ char* ON_UuidToString( const ON_UUID& uuid, char* s ); /* Description: - Converts a uuid to a null termintated UNICODE string like + Converts a uuid to a null terminated UNICODE string like "85a08515-f383-11d3-bfe7-0010830122f0". Parameters: uuid - [in] @@ -544,7 +544,7 @@ class ON_String; /* Description: - Converts a uuid to a null termintated string like + Converts a uuid to a null terminated string like "85a08515-f383-11d3-bfe7-0010830122f0". Parameters: uuid - [in] @@ -559,7 +559,7 @@ class ON_wString; /* Description: - Converts a uuid to a null termintated string like + Converts a uuid to a null terminated string like "85a08515-f383-11d3-bfe7-0010830122f0". Parameters: uuid - [in] diff --git a/opennurbs_version_number.cpp b/opennurbs_version_number.cpp index 7ca9e81c..280a66c1 100644 --- a/opennurbs_version_number.cpp +++ b/opennurbs_version_number.cpp @@ -160,7 +160,7 @@ bool ON_VersionNumberIsYearMonthDateFormat( { // Note: // When new versions of opennurbs save V2,V3,V4 or V5 files, - // they have to write old yyyymmddn verison numbers so the + // they have to write old yyyymmddn version numbers so the // old code will read the file. In this case, n = 6,7,8,9. // (n=9 meant debug prior to 2014); // diff --git a/opennurbs_version_number.h b/opennurbs_version_number.h index 21d58d61..a0639745 100644 --- a/opennurbs_version_number.h +++ b/opennurbs_version_number.h @@ -204,7 +204,7 @@ Returns: true Input parameters are valid and testing internal version number utilities passed. false - Inpute parameters are not valid or a bug was detected in internal version number utilities. + Input parameters are not valid or a bug was detected in internal version number utilities. */ ON_DECL bool ON_TestVersionNumber( diff --git a/opennurbs_viewport.cpp b/opennurbs_viewport.cpp index c9bb2df2..2784a098 100644 --- a/opennurbs_viewport.cpp +++ b/opennurbs_viewport.cpp @@ -1088,7 +1088,7 @@ bool ON_Viewport::SetCameraFrame() if ( !CamX.Unitize() ) return false; // happens when up and dir are temporaily parallel. - // Gaurd against garbage resulting from nearly parallel + // Guard against garbage resulting from nearly parallel // and/or ultra short short dir and up. if ( !ON__IsCameraFrameUnitVectorHelper(CamX) ) return Internal_SetCameraFameFailed(); @@ -2188,7 +2188,7 @@ INPUT: // // target, angle1, angle2, angle3, viewsize, and cameradist. // - // The width, height and zbuffer_depth arguments are used to determing the + // The width, height and zbuffer_depth arguments are used to determine the // clipping to screen transformation. ON_Xform R1, R2, R3, RhinoRot; @@ -2241,7 +2241,7 @@ INPUT: // Rhino 1.0 didn't have a far clipping plane in wire frame (which explains // why you can get perspective views reversed through the origin by using // the SetCameraTarget() command. It's near clipping plane is set to - // a miniscule value. For mesh rendering, it must come up with some + // a minuscule value. For mesh rendering, it must come up with some // sort of reasonable near and far clipping planes because the zbuffer // is used correctly. When time permits, I'll dig through the rendering // code and determine what values are being used. @@ -2758,7 +2758,7 @@ bool ON_Viewport::SetFrustumNearFar( bool ON_Viewport::SetFrustumNearFar( double n, double f ) { // This is a bare bones setter. - // Except for the 0 < n < f < ON_NONSENSE_WORLD_COORDINATE_VALU + // Except for the 0 < n < f < ON_NONSENSE_WORLD_COORDINATE_VALUE // requirement, do not add checking here. // // Use the ON_Viewport::SetFrustumNearFar( near_dist, @@ -2815,10 +2815,10 @@ bool ON_Viewport::ChangeToSymmetricFrustum( ) { if ( bLeftRightSymmetric && m_frus_left == -m_frus_right ) - bLeftRightSymmetric = false; // no left/right chnages required. + bLeftRightSymmetric = false; // no left/right changes required. if ( bTopBottomSymmetric && m_frus_bottom == -m_frus_top ) - bTopBottomSymmetric = false; // no top/bottom chagnes required. + bTopBottomSymmetric = false; // no top/bottom changes required. if ( !bLeftRightSymmetric && !bTopBottomSymmetric ) return true; // no changes required @@ -3500,7 +3500,7 @@ int ON_Viewport::GetBoundingBoxDepth( Pin |= k; if ( (1|2|4|8|16) == k ) { - // C[i] is inside the infinte frustum + // C[i] is inside the infinite frustum P[Pcount++] = C[i]; } } @@ -3508,7 +3508,7 @@ int ON_Viewport::GetBoundingBoxDepth( if ( Pcount < 8 ) { bTrimmed = true; - // some portion of bbox is outside the infinte frustum + // some portion of bbox is outside the infinite frustum if ( (1|2|4|8|16) != Pin ) { // bbox does not intersect the infinite frustum. @@ -3648,7 +3648,7 @@ int ON_Viewport::GetBoundingBoxDepth( break; } - // 0 = out, 1 = partially in infinte frustum, 2 = all in infinte frustum + // 0 = out, 1 = partially in infinite frustum, 2 = all in infinite frustum return (rc) ? (bTrimmed ? 1 : 2) : 0; } @@ -4117,7 +4117,7 @@ bool ON_Viewport::SetFrustumNearFar( bool rc = SetFrustumNearFar( near_dist, far_dist ); // if depth bias will be applied, then make an attempt - // to adust the frustum's near plane to prevent + // to adjust the frustum's near plane to prevent // clipping biased objects. This post-adjustment // fixes display bugs like # 87514. if ( rc @@ -4165,7 +4165,7 @@ bool ON_Viewport::SetFrustumNearFar( else { // call this function again with relative_depth_bias = 0.0 - // to get cameral location positioned correctly when near1 + // to get camera location positioned correctly when near1 // is too small or negative. rc = SetFrustumNearFar( near1, far0, @@ -4457,7 +4457,7 @@ bool ON_Viewport::SetViewScale( double x, double y, double z) // frustum left/right top/bottom but I was stupid and added a clipmodxform // that is more trouble than it is worth. // Someday I will fix this. In the mean time, I want all scaling requests - // to flow through SetViewScale/GetViewScale so I can easly find and fix + // to flow through SetViewScale/GetViewScale so I can easily find and fix // things when I have time to do it right. // 04 November 2011 S. Baer (RR93636) // This function is used for printer calibration and it is commonly possible @@ -4865,7 +4865,7 @@ bool ON_IntersectViewFrustumPlane( } // sort points by the angle (ppt_list[i].m_Q = ppt_list[0].m_Q) makes - // with the positve x axis. This is the same as sorting them by + // with the positive x axis. This is the same as sorting them by // -cot(angle) = -deltax/deltay. ppt_list[0].m_negcotangle = -ON_DBL_MAX; // -cot(0) = - infinity for ( i = 1; i < ppt_count; i++ ) @@ -4951,7 +4951,7 @@ void ON_Viewport::GetPerspectiveClippingPlaneConstraints( // generating clipping artifacts in the perspective // view in bug report 88216. Changing to // to the code below gets rid of those - // artifacts at the risk of having a meaninless + // artifacts at the risk of having a meaningless // view to clip transform if the transformation is // calculated with single precision numbers. // If these values require further tuning, please @@ -5081,7 +5081,7 @@ bool ON_DollyExtents( else dy = dx / aspect; - // Pad depths a bit so clippling plane are not coplanar with displayed geometry + // Pad depths a bit so clipping plane are not coplanar with displayed geometry // zmax is on frustum near and zmin is on frustum far double zmin = camcoord_bbox.m_min.z; double zmax = camcoord_bbox.m_max.z; diff --git a/opennurbs_viewport.h b/opennurbs_viewport.h index c2956d48..22a2a21b 100644 --- a/opennurbs_viewport.h +++ b/opennurbs_viewport.h @@ -209,7 +209,7 @@ public: projection - [in] See Also: ON_Viewport::SetParallelProjection - ON_Viewport::SetPerpectiveProjection + ON_Viewport::SetPerspectiveProjection ON_Viewport::SetTwoPointPerspectiveProjection */ bool SetProjection( ON::view_projection projection ); @@ -217,7 +217,7 @@ public: /* Description: Use this function to change projections of valid viewports - from persective to parallel. It will make common additional + from perspective to parallel. It will make common additional adjustments to the frustum so the resulting views are similar. The camera location and direction will not be changed. Parameters: @@ -385,7 +385,7 @@ public: bool GetCameraExtents( // returns bounding box in camera coordinates - this is useful information - // for setting view frustrums to include the point list + // for setting view frustums to include the point list int, // count = number of 3d points int, // stride = number of doubles to skip between points (>=3) const double*, // 3d points in world coordinates @@ -395,7 +395,7 @@ public: bool GetCameraExtents( // returns bounding box in camera coordinates - this is useful information - // for setting view frustrums to include the point list + // for setting view frustums to include the point list const ON_BoundingBox&, // world coordinate bounding box ON_BoundingBox& cambbox, // bounding box in camera coordinates int bGrowBox = false // set to true if you want to enlarge an existing camera coordinate box @@ -403,7 +403,7 @@ public: bool GetCameraExtents( // returns bounding box in camera coordinates - this is useful information - // for setting view frustrums to include the point list + // for setting view frustums to include the point list ON_3dPoint&, // world coordinate bounding sphere center double, // world coordinate bounding sphere radius ON_BoundingBox& cambox, // bounding box in camera coordinates @@ -554,7 +554,7 @@ public: Returns: True if the point is ing the view frustum and near_dist/far_dist were set. - False if the bounding box does not intesect the + False if the bounding box does not intersect the view frustum. */ bool GetPointDepth( @@ -579,7 +579,7 @@ public: Returns: True if the point is ing the view frustum and near_dist/far_dist were set. - False if the bounding box does not intesect the + False if the bounding box does not intersect the view frustum. */ bool GetPointDepth( @@ -608,14 +608,14 @@ public: Returns: True if the bounding box intersects the view frustum and near_dist/far_dist were set. - False if the bounding box does not intesect the view frustum. + False if the bounding box does not intersect the view frustum. Remarks: This function ignores the current value of the viewport's near and far settings. If the viewport is a perspective projection, the it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel - projection, it instersects the infinite view region with the + projection, it intersects the infinite view region with the bounding box and returns the near and far distances of the projection. */ @@ -649,7 +649,7 @@ public: are not ON_UNSET_VALUE, the near_dist and far_dist are enlarged to include bbox. Returns: - 0: The bounding box does not intersectthe view frustum. + 0: The bounding box does not intersect the view frustum. 1: A proper subset of the bounding box is inside the view frustum and near_dist/far_dist were set. 2: The entire bounding box is inside the view frustum @@ -660,7 +660,7 @@ public: projection, the it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel - projection, it instersects the infinite view region with the + projection, it intersects the infinite view region with the bounding box and returns the near and far distances of the projection. */ @@ -725,7 +725,7 @@ public: Returns: True if the sphere intersects the view frustum and near_dist/far_dist were set. - False if the sphere does not intesect the view frustum. + False if the sphere does not intersect the view frustum. */ bool GetSphereDepth( ON_Sphere sphere, @@ -834,7 +834,7 @@ public: Positive distances are in front of the camera and negative distances are behind the camera. A value of FrustumNear() will return the frustum's - near plane and a valud of FrustumFar() will return + near plane and a valid of FrustumFar() will return the frustum's far plane. view_plane - [out] View plane @@ -862,7 +862,7 @@ public: frustum left side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, - otherwise the origin isthe point on the plane that is + otherwise the origin is the point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set. @@ -883,7 +883,7 @@ public: frustum right side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, - otherwise the origin isthe point on the plane that is + otherwise the origin is the point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set. @@ -904,7 +904,7 @@ public: frustum bottom side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, - otherwise the origin isthe point on the plane that is + otherwise the origin is the point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set. @@ -924,7 +924,7 @@ public: frustum top side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, - otherwise the origin isthe point on the plane that is + otherwise the origin is the point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set. @@ -984,7 +984,7 @@ public: Positive distances are in front of the camera and negative distances are behind the camera. A value of FrustumNear() will return the frustum's - near rectangle and a valud of FrustumFar() will return + near rectangle and a value of FrustumFar() will return the frustum's far rectangle. left_bottom - [out] right_bottom - [out] @@ -1088,7 +1088,7 @@ public: // is not 36/24. (35mm film is 36mm wide and 24mm high.) // // The SetCamera35mmLensLength() preserves camera location, - // changes the frustum, but maintains the frsutrum's aspect. + // changes the frustum, but maintains the frustum's aspect. bool GetCamera35mmLensLength( double* lens_length ) const; @@ -1188,7 +1188,7 @@ public: ) const; // Use Extents() as a quick way to set a viewport to so that bounding - // volume is inside of a viewports frusmtrum. + // volume is inside of a viewports frustum. // The view angle is used to determine the position of the camera. bool Extents( double half_view_angle, // 1/2 smallest subtended view angle @@ -1297,7 +1297,7 @@ public: point to the camera plane will be target_distance. Note that if the frustum is not symmetric, the distance from the returned point to the camera location will be larger than - target_distanct. + target_distance. If target_distance == ON_UNSET_VALUE and the frustum is valid with near > 0.0, then 0.5*(near + far) will be used as the target_distance. @@ -1401,7 +1401,7 @@ public: For perspective views, this bias is largest in the vicinity of the frustum's near clipping plane and smallest in the vicinity of the frustum's far clipping plane. - For orthographic projectsions, this bias is constant. + For orthographic projections, this bias is constant. */ double ClipCoordDepthBias( double relative_depth_bias, @@ -1434,7 +1434,7 @@ public: Returns: True if the function worked. False if the frustum settings - are not valild, in which cate the identity matrix is returned. + are not valid, in which cate the identity matrix is returned. Remarks: The inverse of the transformations returned by @@ -1694,7 +1694,7 @@ protected: // The location of this point has no impact on the // view projection. It is simply a suggestion for a // fixed point when views are rotated or the isometric - // depth when perpsective views are dollied. The default + // depth when perspective views are dollied. The default // is ON_3dPoint::UnsetPoint. ON_3dPoint m_target_point = ON_3dPoint::UnsetPoint; diff --git a/opennurbs_wstring.cpp b/opennurbs_wstring.cpp index b5889e59..c4528987 100644 --- a/opennurbs_wstring.cpp +++ b/opennurbs_wstring.cpp @@ -232,7 +232,7 @@ bool ON_wString::IsValid( return true; for (;;) { - // These checks attempt to detect cases when the memory used for the header informtion + // These checks attempt to detect cases when the memory used for the header information // no longer contains valid settings. const wchar_t* s = m_s; if (nullptr == s) @@ -307,7 +307,7 @@ bool ON_wString::IsValid( // prevent imminent and unpredictable crash // // The empty string is used (as opposed to something like "YIKES - CALL TECH SUPPORT") - // becuase anything besides the empty string introduces using heap in a class that + // because anything besides the empty string introduces using heap in a class that // has been corrupted by some earlier operation. const_cast(this)->m_s = (wchar_t*)pEmptywString; // Devs @@ -703,7 +703,7 @@ ON_wString::ON_wString( const char* s, int length ) ON_wString::ON_wString( char c, int repeat_count ) { Create(); - if ( repeat_count > 0 ) { + if ( repeat_count > 0 && c != 0) { char* s = (char*)onmalloc((repeat_count+1)*sizeof(*s)); s[repeat_count] = 0; memset( s, c, repeat_count*sizeof(*s) ); @@ -733,7 +733,7 @@ ON_wString::ON_wString( const unsigned char* s, int length ) ON_wString::ON_wString( unsigned char c, int repeat_count ) { Create(); - if ( repeat_count > 0 ) { + if ( repeat_count > 0 && c != 0) { char* s = (char*)onmalloc((repeat_count+1)*sizeof(*s)); s[repeat_count] = 0; memset( s, c, repeat_count*sizeof(*s) ); @@ -769,7 +769,7 @@ ON_wString::ON_wString( wchar_t c, int repeat_count ) ON_ERROR("Requested size > ON_wString::MaximumStringLength"); return; } - if ( repeat_count > 0 ) + if ( repeat_count > 0 && c != 0) { ReserveArray(repeat_count); for (int i=0;i= 0 && 0 != (c = m_s[i]); i--) { - // All postive code points in ON_IsUnicodeSpaceOrControlCodePoint() - // are UTF-16 singltons so it's ok to cast c as a Unicode code point. + // All positive code points in ON_IsUnicodeSpaceOrControlCodePoint() + // are UTF-16 singletons so it's ok to cast c as a Unicode code point. if ( c < 0 || 0 == ON_IsUnicodeSpaceOrControlCodePoint((ON__UINT32)c) ) break; } diff --git a/opennurbs_xform.cpp b/opennurbs_xform.cpp index 710d8a0e..55c001d3 100644 --- a/opennurbs_xform.cpp +++ b/opennurbs_xform.cpp @@ -1256,11 +1256,11 @@ int ON_Xform::IsSimilarity() const int ON_Xform::IsSimilarity(double tol) const { - // This function does not construt a similarity transformation, - // ( see ON_Xform::DecomposeSimilarity() for this ). It mearly - // indicates that this transformation is sufficiently close to a similatiry. + // This function does not construct a similarity transformation, + // ( see ON_Xform::DecomposeSimilarity() for this ). It merely + // indicates that this transformation is sufficiently close to a similarity. // However using with a tight tolerance like tol1.0 then find the closest orthogonal matix R. + II. Linear<10*tolerance or tol>1.0 then find the closest orthogonal matrix R. test the final solution to see if |*this-R|1.0 then find the closest orthogonal matix R. + II. Linear~~<10*tolerance or tol>1.0 then find the closest orthogonal matrix R. test the final solution to see if |*this-R|= 1.0 || fabs(pivot) <= ON_EPSILON * fabs(det)) + return 0.; + + ON_3dVector translation{ ON_3dVector::NanVector }; + double scale{ ON_DBL_QNAN }; + ON_Xform rotation{ ON_Xform::Nan }; + const int is_similarity = N_xform.DecomposeSimilarity(translation, scale, rotation, ON_ZERO_TOLERANCE); + // If it's a uniform scale, handle it, otherwise need to get the inverse. + if (is_similarity != 0) + { + N_xform = rotation; + if (det < 0) + { + N_xform = ON_Xform(-1.) * N_xform; + } + return det; + } + + if (!N_xform.Invert()) return 0.; + N_xform.Linearize(); + N_xform.Transpose(); + if (abs(abs(det) - 1) > ON_SQRT_EPSILON) + { + N_xform = ON_Xform(pow(det, -1. / 3.)) * N_xform; + } + + return det; +} + double ON_Xform::GetMappingXforms( ON_Xform& P_xform, ON_Xform& N_xform ) const { double d = 0.0, p = 0.0; @@ -2257,7 +2294,7 @@ bool ON_Xform::GetEulerZYZ(double& alpha, double& beta, double& gamma)const bool ON_Xform::GetKMLOrientationAnglesRadians(double& heading_radians, double& tilt_radians, double& roll_radians ) const { - // NOTE: In KML, postive rotations are CLOCKWISE about the specified axis. + // NOTE: In KML, positive rotations are CLOCKWISE about the specified axis. // This is opposite the conventional "right hand rule." // https://developers.google.com/kml/documentation/kmlreference#orientation heading_radians = ON_DBL_QNAN; @@ -2308,7 +2345,7 @@ bool ON_Xform::GetKMLOrientationAnglesRadians(double& heading_radians, double& t // NOTE WELL: When cos(t) is very near zero, but not equal to zero, // this calculation is unstable. In practice t is typically // a integer number of degrees between 0 and 180, and this - // unstability rarely matters. + // instability rarely matters. // tol = one half an arc second. // Should be way more precise than KML requires. @@ -2326,8 +2363,8 @@ bool ON_Xform::GetKMLOrientationAnglesRadians(double& heading_radians, double& t { // In this case, cos(tilt angle) = 0, clean.m_xform[2][1] = sin(tilt angle) = +1 or -1. // In this case it is impossible to distinguish between the initial rotation around - // the y axis and the final rototation around the z axis - // (tilt is the middle rotation afound the x axis). + // the y axis and the final rotation around the z axis + // (tilt is the middle rotation around the x axis). // I'm choosing to set roll = 0 in this case. h = atan2(clean.m_xform[1][0], clean.m_xform[0][0]); // = atan2(clean.m_xform[0][1], -clean.m_xform[1][2]) if (fabs(h) <= zero_angle_tol) @@ -2372,7 +2409,7 @@ bool ON_Xform::GetKMLOrientationAnglesRadians(double& heading_radians, double& t if (h == h && r == r && t == t) { - // NOTE: In KML, postive rotations are CLOCKWISE about the specified axis. + // NOTE: In KML, positive rotations are CLOCKWISE about the specified axis. // This is opposite the conventional "right hand rule." // https://developers.google.com/kml/documentation/kmlreference#orientation heading_radians = -h; @@ -2431,17 +2468,17 @@ const ON_Xform ON_Xform::RotationTransformationFromKMLAnglesRadians( double roll_radians ) { - // NOTE: In KML, postive rotations are CLOCKWISE looking down the specified axis towards the orgin. + // NOTE: In KML, positive rotations are CLOCKWISE looking down the specified axis towards the origin. // This is opposite the conventional "right hand rule." // https://developers.google.com/kml/documentation/kmlreference#orientation ON_Xform H, R, T; - // Standard trigonometry functons (cosine, sine, ...) follow the right hand rule + // Standard trigonometry functions (cosine, sine, ...) follow the right hand rule // convention, so the input angles must be negated. H.Rotation(-heading_radians, ON_3dVector::ZAxis, ON_3dPoint::Origin); // KML Earth z-axis = up T.Rotation(-tilt_radians, ON_3dVector::XAxis, ON_3dPoint::Origin); // KML Earth x-axis = east R.Rotation(-roll_radians, ON_3dVector::YAxis, ON_3dPoint::Origin); // KML Earth y-axis = north - // KML specifes the rotation order as first R, second T, third H. - // Since openurbs ON_Xform acts on the left of points and vectors, + // KML specifies the rotation order as first R, second T, third H. + // Since opennurbs ON_Xform acts on the left of points and vectors, // H*T*R is the correct order. // Example transformed_point = H*T*R*point (R is first, T is second, H is third). ON_Xform kml_orientation = H * T * R; diff --git a/opennurbs_xform.h b/opennurbs_xform.h index 348c0018..b62ad1d9 100644 --- a/opennurbs_xform.h +++ b/opennurbs_xform.h @@ -253,19 +253,19 @@ public: /* Description: A similarity transformation can be broken into a sequence - of a dialation, translation, rotation, and a reflection. + of a dilation, translation, rotation, and a reflection. Parameters: *this - must be IsAffine(). Translation - [out] Translation vector - dilation - [out] dialation, (dilation <0 iff this is an orientation reversing similarity ) + dilation - [out] dilation, (dilation <0 iff this is an orientation reversing similarity ) Rotation - [out] a proper rotation transformation ie. R*Transpose(R)=I and det(R)=1 Details: If X.DecomposeSimilarity(T, d, R, tol) !=0 then X ~ TranslationTransformation(T)*DiagonalTransformation(d)*R note when d>0 the transformation is orientation preserving. Note: - If dilation<0 then DiagonalTransformation( dilation) is actually a reflection - combined with a "true" dialation, i.e. - DiagonalTransformation( dilation) = DiagonalTransformation(-1) * DiagonalTransformation( |diagonal| ) + If dilation<0 then DiagonalTransformation(dilation) is actually a reflection + combined with a "true" dilation, i.e. + DiagonalTransformation(dilation) = DiagonalTransformation(-1) * DiagonalTransformation( |diagonal| ) Returns: +1: This transformation is an orientation preserving similarity. -1: This transformation is an orientation reversing similarity. @@ -277,7 +277,7 @@ public: /* Description: - NOTE: A better name for this fuction would be IsIsometry(). + NOTE: A better name for this function would be IsIsometry(). An "isometry" transformation is an affine transformation that preserves distances. Isometries include transformation like reflections @@ -378,7 +378,7 @@ public: /* Description: - Replace last row with 0 0 0 1 discarding any perspecive part of this transform + Replace last row with 0 0 0 1 discarding any perspective part of this transform */ void Affineize(); @@ -392,7 +392,7 @@ public: /* Description: Force the linear part of this transformation to be a rotation (or a rotation with reflection). - This is probably best to perform minute tweeks. + This is probably best to perform minute tweaks. Use DecomposeRigid(T,R) to find the nearest rotation */ bool Orthogonalize(double tol); @@ -400,7 +400,7 @@ public: /* Description: A Symmetric linear transformation can be decomposed A = Q * Diag * Q^T where Diag is a diagonal - transformation. Diag[i][i] is an eigenvalue of A and the i-th coulmn of Q is a corresponding + transformation. Diag[i][i] is an eigenvalue of A and the i-th column of Q is a corresponding unit length eigenvector. Parameters: This transformation must be Linear() and Symmetric, that is *this==Transpose(). @@ -483,19 +483,40 @@ public: N_xform - [out] Returns: The determinant of the transformation. - If non-zero, "this" is invertable and N_xform can be calculated. - False if "this" is not invertable, in which case + If non-zero, "this" is invertible and N_xform can be calculated. + False if "this" is not invertible, in which case the returned N_xform = this with the right hand column and bottom row zeroed out. */ double GetSurfaceNormalXform( ON_Xform& N_xform ) const; + /* + Description: + When transforming 3d point and surface or mesh normals + two different transforms must be used. + If P_xform transforms the point, then N_xform, the + transformation that transforms unit-length and oriented normals + of the face to unit-length and oriented normals of the + transformed face is: + + N_xform = (IsOrientationPreserving() >= 0 ? 1 : -1) * pow(Determinant(), -1/3) * Transpose(Inverse(P_xform)) + Parameters: + N_xform - [out] + Returns: + The determinant of the transformation. + If non-zero, "this" is invertible and N_xform can be calculated. + False if "this" is not invertible, in which case + the returned N_xform = this with the right hand column + and bottom row zeroed out. + */ + double GetSurfaceNormalXformKeepLengthAndOrientation(ON_Xform& N_xform) const; + /* Description: If a texture mapping is applied to an object, the object is subsequently transformed by T, and the texture mapping needs to be recalculated, then two transforms are required - to recalcalculate the texture mapping. + to recalculate the texture mapping. Parameters: P_xform - [out] Transform to apply to points before applying the @@ -505,9 +526,9 @@ public: the texture mapping transformation. Returns: The determinant of the "this" transformation. - If non-zero, "this" is invertable and P_xform and N_xform + If non-zero, "this" is invertible and P_xform and N_xform were calculated. - False if "this" is not invertable, in which case + False if "this" is not invertible, in which case the returned P_xform and N_xform are the identity. */ double GetMappingXforms( ON_Xform& P_xform, ON_Xform& N_xform ) const; @@ -1247,7 +1268,7 @@ Notes: int, // count int, // stride const double*, // points - bool bTestZ = true // bTeztZ + bool bTestZ = true // bTestZ ) const; // Description: @@ -1337,7 +1358,7 @@ public: /* Description: Sets the object to clip transformation to - the viewport's workd to clip transformation. + the viewport's world to clip transformation. */ bool SetObjectToClipTransformation( const class ON_Viewport& viewport @@ -1419,7 +1440,7 @@ public: Returns: 0 = No part of the of the convex hull of the tested points is in the view frustum. - 1 = A portion of the convex hull of the otested points may + 1 = A portion of the convex hull of the tested points may be in the view frustum. 2 = The entire convex hull of the tested points is in the view frustum. @@ -1489,7 +1510,7 @@ public: Description: The "visible area" is the intersection of the view frustum, defined by m_xform, and the clipping region, defined by the - m_clip_plane[] array. These functions determing if some + m_clip_plane[] array. These functions determine if some portion of the convex hull of the test points is visible. Parameters: P - [in] point @@ -1534,7 +1555,7 @@ public: 0 when the point is in the visible region. Otherwise the bits are set to indicate which planes clip the input point. - 0x01 left of the view frusturm + 0x01 left of the view frustum 0x02 right of the view frustum 0x04 below the view frustum 0x08 above the view frustum @@ -1571,7 +1592,7 @@ public: 0 when the point is in the visible region. Otherwise the bits are set to indicate which planes clip the input point. - 0x01 left of the view frusturm + 0x01 left of the view frustum 0x02 right of the view frustum 0x04 below the view frustum 0x08 above the view frustum @@ -1652,7 +1673,7 @@ public: /* Description: - Sets point count and aggregate flags falues to zero but does not + Sets point count and aggregate flags values to zero but does not deallocate the memory buffer. When an ON_ClippingRegionPoints will be used multiple times, it is more efficient to call Clear() between uses than calling Destroy(). diff --git a/opennurbs_xml.cpp b/opennurbs_xml.cpp index ee92a202..3652c23d 100644 --- a/opennurbs_xml.cpp +++ b/opennurbs_xml.cpp @@ -4313,12 +4313,12 @@ bool ON_XMLParameters::GetParamNode(const ON_XMLNode& node, ON_XMLVariant& vValu } else if ((sType.CompareNoCase(L"double") == 0) || - (sType.CompareNoCase(L"real") == 0)) // For backward compatibilty with old XML. + (sType.CompareNoCase(L"real") == 0)) // For backward compatibility with old XML. { vValueOut = v.AsDouble(); } else - if (sType.CompareNoCase(L"point") == 0) // For backward compatibilty with old XML. + if (sType.CompareNoCase(L"point") == 0) // For backward compatibility with old XML. { vValueOut = v.AsColor(); } @@ -4532,10 +4532,8 @@ bool ON_XMLParametersV8::GetParam(const wchar_t* wszParamName, ON_XMLVariant& vV #define ON_RDK_UD_MATERIAL L"material" #define ON_RDK_UD_INSTANCE_ID L"instance-id" -static const ON_UUID uuidUniversalRenderEngine = { 0x99999999, 0x9999, 0x9999, { 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99 } }; - -ON_UUID ON_UuidDefaultMaterialInstance = { 0xdefadefa, 0xdefa, 0xdefa, { 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xfa } }; -ON_UUID ON_UuidDefaultEnvironmentInstance = { 0xdefaeeee, 0xdefa, 0xeeee, { 0xde, 0xfa, 0xee, 0xee, 0xde, 0xfa, 0xee, 0xee } }; +ON_UUID ON_UuidDefaultMaterialInstance = ON_RenderContentType_DefaultMaterial; +ON_UUID ON_UuidDefaultEnvironmentInstance = ON_RenderContentType_DefaultEnvironment; ON_OBJECT_IMPLEMENT(ON_RdkUserData, ON_UserData, "AFA82772-1525-43dd-A63C-C84AC5806911"); @@ -4670,7 +4668,7 @@ bool ON_RdkUserData::DeleteAfterRead(const ON_BinaryArchive& archive, ON_Object* // This replaces a hack in CRhinoRead3dmHelper::ReadMaterialTable() which corrected // the plug-in id of V4 materials. These materials were wrongly saved by V4 with the // current render engine id instead of 'universal'. - pOnMaterial->SetMaterialPlugInId(uuidUniversalRenderEngine); // Fixes RH-27240 'V4 RDK materials do not work correctly in V6' + pOnMaterial->SetMaterialPlugInId(ON_UniversalRenderEngineId); // Fixes RH-27240 'V4 RDK materials do not work correctly in V6' // Transfer the instance id from the user data to the new member variable. const auto* wsz = ON_RDK_UD_ROOT ON_XML_SLASH ON_RDK_UD_MATERIAL; @@ -5339,27 +5337,28 @@ void ON_RdkDocumentDefaults::CreateXML(void) p.SetParam(ON_RDK_SUN_DAYLIGHT_SAVING_ON, false); p.SetParam(ON_RDK_SUN_DAYLIGHT_SAVING_MINUTES, 60); - int cy = 0, cm = 0, cd = 0; double ch = 0.0; - ON_SunEngine::GetCurrentLocalDateTime(cy, cm, cd, ch); + int dy = 0, dm = 0, dd = 0; double dh = 0.0; + ON_SunEngine::GetDefaultLocalDateTime(dy, dm, dd, dh); ON_SunEngine engine(ON_SunEngine::Accuracy::Minimum); - engine.SetLocalDateTime(cy, cm, cd, ch); + engine.SetLocalDateTime(dy, dm, dd, dh); int y = 0, m = 0, d = 0; double h = 0.0; engine.LocalDateTime(y, m, d, h); p.SetParam(ON_RDK_SUN_DATE_YEAR, y); p.SetParam(ON_RDK_SUN_DATE_MONTH, m); p.SetParam(ON_RDK_SUN_DATE_DAY, d); p.SetParam(ON_RDK_SUN_TIME_HOURS, h); - p.SetParam(ON_RDK_SUN_AZIMUTH, engine.Azimuth()); - p.SetParam(ON_RDK_SUN_ALTITUDE, engine.Altitude()); - p.SetParam(ON_RDK_SUN_OBSERVER_TIMEZONE, engine.TimeZoneHours()); + p.SetParam(ON_RDK_SUN_AZIMUTH, engine.Azimuth()); + p.SetParam(ON_RDK_SUN_ALTITUDE, engine.Altitude()); p.SetParam(ON_RDK_SUN_SKYLIGHT_ENABLED, (_major_version < 6) ? false : true); p.SetParam(ON_RDK_SUN_SKYLIGHT_SHADOW_INTENSITY, 1.0); p.SetParam(ON_RDK_SUN_SKYLIGHT_ENVIRONMENT_OVERRIDE, (_major_version < 6) ? false : true); p.SetParam(ON_RDK_SUN_SKYLIGHT_ENVIRONMENT_ID, ON_nil_uuid); - // Don't create defaults for North, Latitude or Longitude because they are stored in the earth anchor point. + // Don't create defaults for North, Latitude or Longitude because they are stored in the + // earth anchor point. However, the time zone is not, so create the default for it. + p.SetParam(ON_RDK_SUN_OBSERVER_TIMEZONE, 0.0); } // Safe frame. diff --git a/opennurbs_zlib.cpp b/opennurbs_zlib.cpp index 97e27de1..2ca0d40a 100644 --- a/opennurbs_zlib.cpp +++ b/opennurbs_zlib.cpp @@ -303,7 +303,7 @@ size_t ON_BinaryArchive::WriteDeflate( // returns number of bytes written m_zlib.m_strm.next_out = m_zlib.m_buffer; m_zlib.m_strm.avail_out = m_zlib.sizeof_x_buffer; - // counter guards prevents infinte loops if there is a bug in zlib return codes. + // counter guards prevents infinite loops if there is a bug in zlib return codes. int counter = 512; int flush = Z_NO_FLUSH; @@ -504,7 +504,7 @@ bool ON_BinaryArchive::ReadInflate( my_next_out += d; my_avail_out -= d; - // counter guards against infinte loop if there are + // counter guards against infinite loop if there are // bugs in zlib return codes int counter = 512; int flush = Z_NO_FLUSH; @@ -1184,7 +1184,7 @@ size_t ON_CompressedBuffer::DeflateHelper( // returns number of bytes written m_zlib.m_strm.next_out = m_zlib.m_buffer; m_zlib.m_strm.avail_out = m_zlib.sizeof_x_buffer; - // counter guards prevents infinte loops if there is a bug in zlib return codes. + // counter guards prevents infinite loops if there is a bug in zlib return codes. int counter = 512; int flush = Z_NO_FLUSH; @@ -1318,7 +1318,7 @@ bool ON_CompressedBuffer::InflateHelper( my_next_out += d; my_avail_out -= d; - // counter guards against infinte loop if there are + // counter guards against infinite loop if there are // bugs in zlib return codes int counter = 512; int flush = Z_NO_FLUSH;