Skip to content

Commit

Permalink
[1.3.9] 2024-04-17
Browse files Browse the repository at this point in the history
* Many documentation updates
* Leaf Optics plug-in was missing from utilities/create_project.sh script

*Context*
- Added check to Context::doesPrimitiveExist() for an empty UUID vector, which could cause undefined behavior.
- Added check to Context::addPolymeshObject() for an empty UUID vector.
- Added overloaded version of Context::getObjectPrimitiveUUIDs() that accepts a 2D vector of object IDs.
- Added inequality operators for vec2, vec3, vec4, int2, int3, int4, Date, Time, and SphericalCoord.
- Changed SphericalCoord to make elements read-only to make sure that elevation and zenith angles remain linked.

*Radiation*
- In selfTest() test #17, camera HFOV was increased (by factor of 2) to account for correction from version 1.3.8.

*LiDAR*
- Degrees vs. radians was not handled correctly if zenith/azimuth is specified from an input XML file.

*AerialLiDAR*
- Degrees vs. radians was not handled correctly if zenith/azimuth is specified from an input XML file.
  • Loading branch information
bnbailey-psl committed Apr 17, 2024
1 parent 1423c33 commit 3866cb5
Show file tree
Hide file tree
Showing 695 changed files with 27,540 additions and 26,198 deletions.
173 changes: 85 additions & 88 deletions core/include/Context.h

Large diffs are not rendered by default.

673 changes: 405 additions & 268 deletions core/include/global.h

Large diffs are not rendered by default.

269 changes: 192 additions & 77 deletions core/include/helios_vector_types.h

Large diffs are not rendered by default.

159 changes: 72 additions & 87 deletions core/src/Context.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/src/Context_fileIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3147,7 +3147,7 @@ void Context::writeXML( const char* filename, const std::vector<uint> &UUIDs, bo
uint subdiv = cone->getSubdivisionCount();
outfile << "\t<subdivisions> " << subdiv << " </subdivisions>" << std::endl;

std::vector<vec3> nodes = cone->getNodes();
std::vector<vec3> nodes = cone->getNodeCoordinates();
std::vector<float> radius = cone->getNodeRadii();

assert(nodes.size() == radius.size());
Expand Down
43 changes: 14 additions & 29 deletions core/src/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ RGBcolor RGB::goldenrod = make_RGBcolor( 0.855, 0.647, 0.126 );
SphericalCoord helios::nullrotation = make_SphericalCoord(0,0);
vec3 helios::nullorigin = make_vec3(0,0,0);

RGBcolor helios::blend( RGBcolor color0, RGBcolor color1, float weight ){
RGBcolor helios::blend(const RGBcolor &color0_RGB, const RGBcolor &color1_RGB, float weight_RGB ){
RGBcolor color;
weight = clamp(weight,0.f,1.f);
color.r = weight*color1.r+(1.f-weight)*color0.r;
color.g = weight*color1.g+(1.f-weight)*color0.g;
color.b = weight*color1.b+(1.f-weight)*color0.b;
weight_RGB = clamp(weight_RGB,0.f,1.f);
color.r = weight_RGB*color1_RGB.r+(1.f-weight_RGB)*color0_RGB.r;
color.g = weight_RGB*color1_RGB.g+(1.f-weight_RGB)*color0_RGB.g;
color.b = weight_RGB*color1_RGB.b+(1.f-weight_RGB)*color0_RGB.b;
return color;
}

RGBAcolor helios::blend(const RGBAcolor &color0, const RGBAcolor &color1, float weight ){
RGBAcolor helios::blend(const RGBAcolor &color0_RGBA, const RGBAcolor &color1_RGBA, float weight_RGBA ){
RGBAcolor color;
weight = clamp(weight,0.f,1.f);
color.r = weight*color1.r+(1.f-weight)*color0.r;
color.g = weight*color1.g+(1.f-weight)*color0.g;
color.b = weight*color1.b+(1.f-weight)*color0.b;
color.a = weight*color1.a+(1.f-weight)*color0.a;
weight_RGBA = clamp(weight_RGBA,0.f,1.f);
color.r = weight_RGBA*color1_RGBA.r+(1.f-weight_RGBA)*color0_RGBA.r;
color.g = weight_RGBA*color1_RGBA.g+(1.f-weight_RGBA)*color0_RGBA.g;
color.b = weight_RGBA*color1_RGBA.b+(1.f-weight_RGBA)*color0_RGBA.b;
color.a = weight_RGBA*color1_RGBA.a+(1.f-weight_RGBA)*color0_RGBA.a;
return color;
}

Expand Down Expand Up @@ -580,29 +580,14 @@ float helios::atan2_2pi(float y, float x){

SphericalCoord helios::cart2sphere( const vec3& Cartesian ){

SphericalCoord Spherical;

Spherical.radius = sqrt( Cartesian.x*Cartesian.x + Cartesian.y*Cartesian.y + Cartesian.z*Cartesian.z );

Spherical.elevation = asin( Cartesian.z/Spherical.radius );

Spherical.zenith = 0.5f*float(M_PI) - Spherical.elevation;

Spherical.azimuth = atan2_2pi( Cartesian.x, Cartesian.y );

return Spherical;
float radius = sqrtf( Cartesian.x*Cartesian.x + Cartesian.y*Cartesian.y + Cartesian.z*Cartesian.z );
return {radius, asin_safe( Cartesian.z/radius ), atan2_2pi( Cartesian.x, Cartesian.y )};

}

vec3 helios::sphere2cart( const SphericalCoord& Spherical ){

vec3 Cartesian;

Cartesian.x = Spherical.radius*cos(Spherical.elevation)*sin(Spherical.azimuth);
Cartesian.y = Spherical.radius*cos(Spherical.elevation)*cos(Spherical.azimuth);
Cartesian.z = Spherical.radius*sin(Spherical.elevation);

return Cartesian;
return {Spherical.radius*cosf(Spherical.elevation)*sinf(Spherical.azimuth), Spherical.radius*cosf(Spherical.elevation)*cosf(Spherical.azimuth), Spherical.radius*sinf(Spherical.elevation)};

}

Expand Down
8 changes: 4 additions & 4 deletions core/src/selfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int Context::selfTest(){

center = make_vec3(1,2,3);
size = make_vec2(1,2);
rotation.elevation = 0.15f*M_PI;
rotation = make_SphericalCoord(1.f, 0.15f*M_PI, 0.5f*M_PI);
rotation.azimuth = 0.5f*M_PI;;
UUID = context_test.addPatch(center,size,rotation);
normal_r = context_test.getPrimitiveNormal(UUID);
Expand Down Expand Up @@ -667,7 +667,7 @@ int Context::selfTest(){
context_test.getConeObjectPointer(cone_1)->translate(make_vec3(1, 1, 1));

// get the updated node position
std::vector<helios::vec3> nodes_T = context_test.getConeObjectPointer(cone_1)->getNodes();
std::vector<helios::vec3> nodes_T = context_test.getConeObjectPointer(cone_1)->getNodeCoordinates();

if(nodes_T.at(0).x - 1.0f > errtol || nodes_T.at(0).y - 1.0f > errtol || nodes_T.at(0).z - 1.0f > errtol ||
nodes_T.at(1).x - 1.0f > errtol || nodes_T.at(1).y - 1.0f > errtol || nodes_T.at(1).z - 3.0f > errtol ){
Expand All @@ -693,7 +693,7 @@ int Context::selfTest(){
// translate back
context_test.getConeObjectPointer(cone_1)->translate(nodes_T.at(0));
//get the updated node positions
nodes_T = context_test.getConeObjectPointer(cone_1)->getNodes();
nodes_T = context_test.getConeObjectPointer(cone_1)->getNodeCoordinates();

if(nodes_T.at(0).x - 1.0f > errtol || nodes_T.at(0).y - 1.0f > errtol || nodes_T.at(0).z - 1.0f > errtol ||
nodes_T.at(1).x - 3.0f > errtol || nodes_T.at(1).y - 1.0f > errtol || nodes_T.at(1).z - 1.0f > errtol ){
Expand All @@ -705,7 +705,7 @@ int Context::selfTest(){
//scale the length of the cone to twice its original length
context_test.getConeObjectPointer(cone_1)->scaleLength(2.0);
//get the updated node positions
nodes_T = context_test.getConeObjectPointer(cone_1)->getNodes();
nodes_T = context_test.getConeObjectPointer(cone_1)->getNodeCoordinates();

if(nodes_T.at(0).x - 1.0 > errtol || nodes_T.at(0).y - 1.0 > errtol || nodes_T.at(0).z - 1.0 > errtol ||
nodes_T.at(1).x - 6.0 > errtol || nodes_T.at(1).y - 1.0 > errtol || nodes_T.at(1).z - 1.0 > errtol ){
Expand Down
21 changes: 21 additions & 0 deletions doc/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -1589,3 +1589,24 @@ The radiation model has been re-designed, with the following primary additions:
*Radiation*
- Added check to RadiationModel::writePrimitiveDataLabelMap() to print a warning if the primitive data was empty for all pixels.
- There was an error with the radiation camera field of view in that the actual field of view in the image was half that of the specified HFOV value.

[1.3.9] 2024-04-17

* Many documentation updates
* Leaf Optics plug-in was missing from utilities/create_project.sh script

*Context*
- Added check to Context::doesPrimitiveExist() for an empty UUID vector, which could cause undefined behavior.
- Added check to Context::addPolymeshObject() for an empty UUID vector.
- Added overloaded version of Context::getObjectPrimitiveUUIDs() that accepts a 2D vector of object IDs.
- Added inequality operators for vec2, vec3, vec4, int2, int3, int4, Date, Time, and SphericalCoord.
- Changed SphericalCoord to make elements read-only to make sure that elevation and zenith angles remain linked.

*Radiation*
- In selfTest() test #17, camera HFOV was increased (by factor of 2) to account for correction from version 1.3.8.

*LiDAR*
- Degrees vs. radians was not handled correctly if zenith/azimuth is specified from an input XML file.

*AerialLiDAR*
- Degrees vs. radians was not handled correctly if zenith/azimuth is specified from an input XML file.
Loading

0 comments on commit 3866cb5

Please sign in to comment.