Skip to content
Snippets Groups Projects
Commit 41210da7 authored by Tobias Schmidt's avatar Tobias Schmidt
Browse files

ConnectorImpl::SetDir/SetDirAndLength only set local_rot_ if direction =! 0

parent 42b63f2f
Branches
Tags
No related merge requests found
...@@ -92,14 +92,22 @@ Real ConnectorImpl::GetLength() const ...@@ -92,14 +92,22 @@ Real ConnectorImpl::GetLength() const
} }
void ConnectorImpl::SetDir(const geom::Vec3& dir) { void ConnectorImpl::SetDir(const geom::Vec3& dir) {
geom::Vec3 v=Normalize(dir); if(Length(dir)==0) {
local_rot_=find_rotation(v); local_rot_=geom::Mat3(1,0,0,0,1,0,0,0,1);
} else {
geom::Vec3 v=Normalize(dir);
local_rot_=find_rotation(v);
}
} }
void ConnectorImpl::SetDirAndLength(const geom::Vec3& dir) { void ConnectorImpl::SetDirAndLength(const geom::Vec3& dir) {
len_=Length(dir); len_=Length(dir);
geom::Vec3 v=dir/len_; if(len_==0) {
local_rot_=find_rotation(v); local_rot_=geom::Mat3(1,0,0,0,1,0,0,0,1);
} else {
geom::Vec3 v=dir/len_;
local_rot_=find_rotation(v);
}
} }
bool ConnectorImpl::IsConnectorOf(const AtomImplPtr& a, bool ConnectorImpl::IsConnectorOf(const AtomImplPtr& a,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment