File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,18 @@ def getAngle(self, v: "Vector") -> float:
175
175
def distanceToLine (self ):
176
176
raise NotImplementedError ("Have not needed this yet, but OCCT supports it!" )
177
177
178
- def projectToLine (self ):
179
- raise NotImplementedError ("Have not needed this yet, but OCCT supports it!" )
178
+ def projectToLine (self , line : "Vector" ) -> "Vector" :
179
+ """
180
+ Returns a new vector equal to the projection of this Vector onto the line
181
+ represented by Vector <line>
182
+
183
+ :param args: Vector
184
+
185
+ Returns the projected vector.
186
+ """
187
+ lineLength = line .Length
188
+
189
+ return line * (self .dot (line ) / (lineLength * lineLength ))
180
190
181
191
def distanceToPlane (self ):
182
192
raise NotImplementedError ("Have not needed this yet, but OCCT supports it!" )
You can’t perform that action at this time.
0 commit comments