Skip to content

Conversation

@Pylata
Copy link
Contributor

@Pylata Pylata commented Jul 9, 2019

No description provided.

class GeneralTransform {
public:

enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class enum

std::vector<GeneralTransform> *tmp =
optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop);
std::vector<GeneralTransform> *tmp;
if(rank == 3){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare to enum

optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop);
std::vector<GeneralTransform> *tmp;
if(rank == 3){
tmp = optimizeXYZ_3D(in, nBest, maxPercIncrease, squareOnly, crop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to decide here. Check it within the optimizeXYZ (and call appropriate version there)

std::vector<Polynom> *polysX = generatePolys(tr.X, tr.isFloat, crop);
if(!crop){
std::sort (polysX->begin(), polysX->end());
}else{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep consistent formatting

} else if (tr.Y == tr.Z) {
polysZ = polysY;
} else {
polysZ = generatePolys(tr.Z, tr.isFloat, crop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repetitive code, please extract helper method

size_t found = 0;
for (auto& x : *polysX) {
for (auto& y : *polysY) {
if (squareOnly && (x.value != y.value) && (y.value != 1)) continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 3D case, x and y should never be == 1

}

std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ(GeneralTransform &tr,
std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ_3D(GeneralTransform &tr,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that the only difference to 1D/2D case is filtering vs sorting.
Is it true?
If so, pass filtering/sorting method to general
template
optimizeXYZ(..., G &generator)

sizeOptimizer.h Outdated

int getInvocations(Polynom &poly, bool isFloat);
int getInvocationsV8(Polynom &poly, bool isFloat);
std::vector<Polynom> *cutN(std::vector<Polynom>* polys , size_t nBest);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

class GeneralTransform {
public:

enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it from transform.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants