line2d::intersectWith has a new parameter to allow ignoring intersections with coincident lines

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4586 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2013-10-16 16:56:13 +00:00
parent b09c2a5c2d
commit 80512c8385
3 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,7 @@
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- line2d::intersectWith has a new parameter to allow ignoring intersections with coincident lines
- vector2d::equals now has an tolerance parameter for passing the epsilon (like vector3d had). Note that this changes the default - vector2d::equals now has an tolerance parameter for passing the epsilon (like vector3d had). Note that this changes the default
behavior of vector2d::equals as well as functions using it like the operators for ==, !=, <, >, <=, >= when using vector2d with f64 behavior of vector2d::equals as well as functions using it like the operators for ==, !=, <, >, <=, >= when using vector2d with f64
as the tolerance is increased in that case (for f32 and integer values it shouldn't make any difference). as the tolerance is increased in that case (for f32 and integer values it shouldn't make any difference).

View File

@ -73,8 +73,9 @@ class line2d
When set to false the function will check for the first intersection point when extending the lines. When set to false the function will check for the first intersection point when extending the lines.
\param out: If there is an intersection, the location of the \param out: If there is an intersection, the location of the
intersection will be stored in this vector. intersection will be stored in this vector.
\param ignoreCoincidentLines: When true coincident lines (lines above each other) are never considered as interesecting. When false the center of the overlapping part is returned.
\return True if there is an intersection, false if not. */ \return True if there is an intersection, false if not. */
bool intersectWith(const line2d<T>& l, vector2d<T>& out, bool checkOnlySegments=true) const bool intersectWith(const line2d<T>& l, vector2d<T>& out, bool checkOnlySegments=true, bool ignoreCoincidentLines=false) const
{ {
// Uses the method given at: // Uses the method given at:
// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
@ -91,7 +92,7 @@ class line2d
{ {
// The lines are either coincident or parallel // The lines are either coincident or parallel
// if both numerators are 0, the lines are coincident // if both numerators are 0, the lines are coincident
if(equals(numeratorA, 0.f) && equals(numeratorB, 0.f)) if(!ignoreCoincidentLines && equals(numeratorA, 0.f) && equals(numeratorB, 0.f))
{ {
// Try and find a common endpoint // Try and find a common endpoint
if(l.start == start || l.end == start) if(l.start == start || l.end == start)

View File

@ -131,7 +131,7 @@
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<PlatformToolset>Windows7.1SDK</PlatformToolset> <PlatformToolset>Windows7.1SDK</PlatformToolset>
</PropertyGroup> </PropertyGroup>
@ -198,7 +198,7 @@
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\lib\Win64-VisualStudio\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">obj\$(Configuration)\</IntDir>
@ -354,7 +354,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\..\include;zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\include;zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions); _ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions> <PreprocessorDefinitions>_IRR_STATIC_LIB_;WIN32;WIN64;_DEBUG;_WINDOWS;_USRDLL;IRRLICHT_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions); _ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -373,7 +373,7 @@
</ProjectReference> </ProjectReference>
<Link> <Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\bin\Win64-visualstudio\Irrlicht.dll</OutputFile> <OutputFile>..\..\lib\Win64-visualstudio\Irrlicht.lib</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libci.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>libci.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -381,6 +381,9 @@
</DataExecutionPrevention> </DataExecutionPrevention>
<ImportLibrary>..\..\lib\Win64-visualstudio\Irrlicht.lib</ImportLibrary> <ImportLibrary>..\..\lib\Win64-visualstudio\Irrlicht.lib</ImportLibrary>
</Link> </Link>
<Lib>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl> <Midl>
@ -655,7 +658,7 @@
<IntrinsicFunctions>false</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\..\include;zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\include;zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_;WIN32;WIN64;NDEBUG;_WINDOWS;_USRDLL;_IRR_STATIC_LIB_;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>