Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 953884d

Browse files
committed
Added BlackBodySpectrum
1 parent 1986cfb commit 953884d

File tree

7 files changed

+59
-25
lines changed

7 files changed

+59
-25
lines changed

ColorSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ Global
3333
$0.VersionControlPolicy = $2
3434
$2.inheritsSet = Mono
3535
description = A .Net/Mono library to handle color spaces (and light spectrums!)
36-
version = 0.9.3
36+
version = 0.10.0
3737
EndGlobalSection
3838
EndGlobal

ColorSharp/ColorSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<SignAssembly>true</SignAssembly>
1212
<DelaySign>false</DelaySign>
1313
<AssemblyOriginatorKeyFile>colorsharp.snk</AssemblyOriginatorKeyFile>
14-
<ReleaseVersion>0.9.3</ReleaseVersion>
14+
<ReleaseVersion>0.10.0</ReleaseVersion>
1515
</PropertyGroup>
1616
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1717
<DebugSymbols>true</DebugSymbols>

ColorSharp/ColorSharp.nuspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>$description$</description>
1313
<releaseNotes>
14-
- Updated MathNet.Numerics dependency
15-
- Added HashCode to light spectrum objects
16-
- Minor performance tweaks
14+
- Added new Illuminants
15+
- Added new Matching Functions
16+
- Improved spectrum -> color conversion mechanism
17+
- Minor API breaks.
1718
</releaseNotes>
18-
<copyright>Copyright 2014</copyright>
19+
<copyright>Copyright 2014-2015</copyright>
1920
<tags>Light Color Colour CIEXYZ CIExyY sRGB</tags>
2021
</metadata>
2122
</package>

ColorSharp/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
4747
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
4848

49-
[assembly: AssemblyVersion ("0.9.3.*")]
49+
[assembly: AssemblyVersion ("0.10.0.*")]
5050

5151
// The following attributes are used to specify the signing key for the assembly,
5252
// if desired. See the Mono documentation for more information about signing.

ColorSharp/src/LightSpectrums/BlackBodySpectrum.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,9 @@ public BlackBodySpectrum (double cct, double minWaveLength, double maxWaveLength
7878
public override double EvaluateAt (double waveLength)
7979
{
8080
// 2*h*c² = 2 * 299792458 * 1.98644568e-25 = 1.1910428661813628e-16
81-
double a = (
82-
1.1910428661813628e-16 / (
83-
Math.Pow(waveLength, 5) * (
84-
Math.Exp(1.98644568e-25 / (waveLength * CCT * 1.3806488e-23)) - 1.0
85-
)
86-
)
87-
);
88-
89-
double b = (
90-
(3.7417749e-16 * Math.Pow(waveLength, -5.0) / Math.PI) * Math.Pow(
91-
(Math.Exp(1.4388e-2 / (waveLength * CCT)) - 1), -1
92-
)
93-
);
94-
95-
Console.WriteLine (a + " <--> " + b);
96-
97-
return a;
81+
return (1.1910428661813628e19 /*1.1910428661813628e-16*/ / (
82+
Math.Pow(waveLength/* * 1e-7*/, 5.0) * (Math.Exp(0.014387769576158687 / (waveLength * CCT)) - 1.0)
83+
));
9884
}
9985

10086
public override double GetMaxValueOnSupport ()

ColorSharpTests/ColorSharpTests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<OutputType>Library</OutputType>
88
<RootNamespace>Litipk.ColorSharpTests</RootNamespace>
99
<AssemblyName>ColorSharpTests</AssemblyName>
10-
<ReleaseVersion>0.9.3</ReleaseVersion>
10+
<ReleaseVersion>0.10.0</ReleaseVersion>
1111
</PropertyGroup>
1212
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1313
<DebugSymbols>true</DebugSymbols>
@@ -40,6 +40,7 @@
4040
<Compile Include="tests\Illuminants\D65Test.cs" />
4141
<Compile Include="tests\Illuminants\ATest.cs" />
4242
<Compile Include="tests\ColorSpaces\AColorTest.cs" />
43+
<Compile Include="tests\LightSpectrums\BlackBodySpectrumTest.cs" />
4344
</ItemGroup>
4445
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4546
<ItemGroup>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* The MIT License (MIT)
3+
* Copyright (c) 2014 Andrés Correa Casablanca
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
24+
/**
25+
* Contributors:
26+
* - Andrés Correa Casablanca <castarco@gmail.com , castarco@litipk.com>
27+
*/
28+
29+
30+
using NUnit.Framework;
31+
using Litipk.ColorSharp.LightSpectrums;
32+
33+
34+
namespace Litipk.ColorSharpTests
35+
{
36+
[TestFixture]
37+
public class BlackBodySpectrumTest
38+
{
39+
[Test]
40+
public void TestEvaluateAt()
41+
{
42+
43+
}
44+
}
45+
}
46+

0 commit comments

Comments
 (0)