-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #583 from thekemkid/feat/vec5
Add base support for vec6
- Loading branch information
Showing
13 changed files
with
287 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <opencv2/core.hpp> | ||
#include "coreUtils.h" | ||
#include "NativeNodeUtils.h" | ||
#include "macros.h" | ||
|
||
#ifndef __FF_VEC6_H__ | ||
#define __FF_VEC6_H__ | ||
|
||
class Vec6 : public FF::ObjectWrap<Vec6, cv::Vec6d> { | ||
public: | ||
static Nan::Persistent<v8::FunctionTemplate> constructor; | ||
|
||
static const char* getClassName() { | ||
return "Vec6"; | ||
} | ||
|
||
static NAN_METHOD(New) { | ||
Vec6* self = new Vec6(); | ||
self->Wrap(info.Holder()); | ||
info.GetReturnValue().Set(info.Holder()); | ||
} | ||
|
||
static void Init(v8::Local<v8::FunctionTemplate> ctor) { | ||
FF_PROTO_SET_MATRIX_OPERATIONS(ctor); | ||
} | ||
|
||
FF_GETTER_CUSTOM(u, FF::DoubleConverter, self[0]); | ||
FF_GETTER_CUSTOM(v, FF::DoubleConverter, self[1]); | ||
FF_GETTER_CUSTOM(w, FF::DoubleConverter, self[2]); | ||
FF_GETTER_CUSTOM(x, FF::DoubleConverter, self[3]); | ||
FF_GETTER_CUSTOM(y, FF::DoubleConverter, self[4]); | ||
FF_GETTER_CUSTOM(z, FF::DoubleConverter, self[5]); | ||
|
||
FF_INIT_VEC6_OPERATIONS(); | ||
static NAN_METHOD(Dot) { | ||
FF_OPERATOR_RET_SCALAR(&cv::Vec6d::dot, FF_APPLY_CLASS_FUNC, Vec6, "Dot"); | ||
} | ||
static NAN_METHOD(Norm) { | ||
info.GetReturnValue().Set(Nan::New(cv::norm(Vec6::unwrapSelf(info)))); | ||
} | ||
|
||
static NAN_METHOD(At) { | ||
FF::TryCatch tryCatch("Vec6::At"); | ||
FF_ASSERT_INDEX_RANGE(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), 5, "Vec6"); | ||
cv::Vec6d vecSelf = Vec6::unwrapSelf(info); | ||
info.GetReturnValue().Set(vecSelf[info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value()]); | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Vec } from './Vec.d'; | ||
|
||
export class Vec4 extends Vec { | ||
readonly w: number; | ||
readonly x: number; | ||
readonly y: number; | ||
readonly z: number; | ||
readonly w: number; | ||
constructor(x: number, y: number, z: number, w: number); | ||
constructor(w: number, x: number, y: number, z: number); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Vec } from './Vec.d'; | ||
|
||
export class Vec6 extends Vec { | ||
readonly u: number; | ||
readonly v: number; | ||
readonly w: number; | ||
readonly x: number; | ||
readonly y: number; | ||
readonly z: number; | ||
constructor(u: number, v: number, w: number, x: number, y: number, z: number); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.