问题描述
谁能帮我解决这个问题:
给定两个向量,使用叉积创建一组三个正交向量:
Option Explicit
Function getMorseCode( _
ByVal s As String,_
Optional ByVal CharDelimiter As String = " ",_
Optional ByVal WordDelimiter As String = vbLf,_
Optional ByVal NotFoundReplacement As String = "~") _
As String
Dim CharsList As String
CharsList = _
"a|b|c|d|e|f|g|h|i|j|" _
& "k|l|m|n|o|p|q|r|s|t|" _
& "u|v|w|x|y|z|" _
& "0|1|2|3|4|5|6|7|8|9|" _
& ".|,|?|:|/|""|'|;|!|" _
& "(|)|&|=|+|-|_|$|@|" _
& " "
Dim CodesList As String
CodesList = _
".-|-...|-.-.|-..|.|..-.|--.|....|..|.---|" _
& "-.-|.-..|--|-.|---|.--.|--.-|.-.|...|-|" _
& "..-|...-|.--|-..-|-.--|--..|" _
& "-----|.----|..---|...--|....-|.....|-....|--...|---..|----.|" _
& ".-.-.-|--..--|..--..|---...|-..-.|.-..-.|.----.|-.-.-.|-.-.--|" _
& "-.--.|-.--.-|.-...|-...-|.-.-.|-....-|..--.-|...-..-|.--.-.|" _
& WordDelimiter
Dim Chars() As String: Chars = Split(CharsList,"|")
'Debug.Print Join(Chars,vbLf)
Dim Codes() As String: Codes = Split(CodesList,"|")
'Debug.Print Join(Codes,vbLf)
Dim CurrentMatch As Variant
Dim n As Long
Dim cChar As String
Dim Result As String
For n = 1 To Len(s)
cChar = Mid(s,n,1)
CurrentMatch = Application.Match(cChar,Chars,0)
If IsNumeric(CurrentMatch) Then
Result = Result & CharDelimiter & Codes(CurrentMatch - 1)
Else
Result = Result & CharDelimiter & NotFoundReplacement
End If
Next n
' Remove leading Char Delimiter.
Result = Right(Result,Len(Result) - Len(CharDelimiter))
' Remove Char Delimiter following a Word Delimiter.
getMorseCode = Replace(Result,WordDelimiter & CharDelimiter,WordDelimiter)
End Function
Sub TESTgetMorseCode()
MsgBox getMorseCode("""The character '%' cannot be found!""")
'Debug.Print getMorseCode("""The character '%' cannot be found!""")
End Sub
替换...并在那里填写:
from compas.geometry import cross_vectors
from compas.geometry import angle_vectors
import math as m
v1 = [1,2,3]
v2 = [4,5,6]
解决方法
给定A
和B
这两个独立向量,可以这样得到一组3个正交向量:
C = A x B
D = A x C
A
、C
、D
是正交的并且跨越 3D 空间
如果您想要orthonormal
,请进行标准化:
A/|A|
、C/|C|
、D/|D|
我会让你对左右手手性进行排序。