1

さまざまなデータ構造体は、他のものにとってはそうではなく、あるものにとっては良い/良いです.

ベクトル配列を WPF Polygon で使用するように変換する方法はありますか?

let mutable nodes = [| Vector (100.0, 100.0); Vector (60.0, 20.0); Vector (80.0, 60.0); Vector(50.0, 100.0); Vector (100.0, 80.0); Vector (30.0, 140.0); Vector (20.0, 80.0); Vector (30.0, 30.0); |]

let spolyS : Point seq = Seq.ofArray [| Vector (0.0, 0.0); Vector (6.0, 2.0); Vector (8.0, 6.0); Vector(5.0, 10.0); Vector (10.0, 8.0); Vector (3.0, 14.0); Vector (-2.0, 8.0); Vector (-3.0, 3.0); |]
let seqFromArray1 = [| 1..10 |] :> seq<int>
let seqFromArray2 = [| 1 .. 10 |] |> Seq.ofArray
let seqFromArray3 = polyS :> seq<Point>

let mutable arrayList1 = new System.Collections.ArrayList(10)
for i in 1 .. 10 do arrayList1.Add(10) |> ignore
let seqCast : seq<int> = Seq.cast arrayList1

let mutable arrayList2 = new Media.PointCollection(10)
for i in 1 .. 10 do arrayList1.Add(10) |> ignore
let seqCast : seq<Point> = Seq.cast arrayList2
let spts : Point seq = Seq.ofArray polyS |> new Media.PointCollection
let spts : Point seq = Seq.ofArray polyS |> new Media.PointCollection
let spts : Point seq = Seq.ofArray polyS |> new Media.PointCollection(spts IEnumerable<Point>):unit
4

1 に答える 1

3

たぶん次のようなものです:

let vectors = [| Vector(100.0, 100.0); Vector(60.0, 20.0); ... |]
let points = vectors |> Array.map (fun v -> Point(v.X, v.Y))
let mediaPoints = Media.PointCollection(points)
于 2013-01-18T03:27:24.360 に答える