public bool Equals(DestinyCharacterCustomization input) { if (input == null) { return(false); } return (( Personality == input.Personality || (Personality.Equals(input.Personality)) ) && ( Face == input.Face || (Face.Equals(input.Face)) ) && ( SkinColor == input.SkinColor || (SkinColor.Equals(input.SkinColor)) ) && ( LipColor == input.LipColor || (LipColor.Equals(input.LipColor)) ) && ( EyeColor == input.EyeColor || (EyeColor.Equals(input.EyeColor)) ) && ( HairColors == input.HairColors || (HairColors != null && HairColors.SequenceEqual(input.HairColors)) ) && ( FeatureColors == input.FeatureColors || (FeatureColors != null && FeatureColors.SequenceEqual(input.FeatureColors)) ) && ( DecalColor == input.DecalColor || (DecalColor.Equals(input.DecalColor)) ) && ( WearHelmet == input.WearHelmet || (WearHelmet != null && WearHelmet.Equals(input.WearHelmet)) ) && ( HairIndex == input.HairIndex || (HairIndex.Equals(input.HairIndex)) ) && ( FeatureIndex == input.FeatureIndex || (FeatureIndex.Equals(input.FeatureIndex)) ) && ( DecalIndex == input.DecalIndex || (DecalIndex.Equals(input.DecalIndex)) )); }
FeatureIndex[] GetEdgeFacesIndices(int globalEdgeIndex) { FeatureIndex[] features = new FeatureIndex[2]; int currentFeature = 0; for (int i = 0; i < faces.Count; i++) { if (currentFeature == 2) { break; } Face f = faces[i]; bool doneWithFace = false; for (int u = 0; u < f.loops.Count; u++) { if (doneWithFace) { break; } List <OrderedEdge> faceEdges = f.loops[u].path; for (int v = 0; v < faceEdges.Count; v++) { if (faceEdges[v].e == globalEdgeIndex) { features[currentFeature].face = i; features[currentFeature].faceLoop = u; features[currentFeature].loopEdge = v; currentFeature++; doneWithFace = true; break; } } } } if (currentFeature == 0) { throw new Exception("Degenerate mesh; An edge has no associated faces."); } else if (currentFeature == 1) { throw new Exception("Degenerate mesh; An edge only has one associated face."); } else { return(features); } }
public NeuralNetwork(int numOfInputs, int numOfOutputs, int[] numOfHiddens) : base() { this.numOfHiddens = numOfHiddens; this.numOfInputs = numOfInputs; this.numOfOutputs = numOfOutputs; numOfLayers = this.numOfHiddens.Length + 1; layers = new PreceptorLayer[numOfLayers]; int prevNumOfPreceptors = this.numOfInputs; for (int i = 0; i < numOfLayers; i++) { int numOfPreceptors = i < (numOfLayers - 1) ? this.numOfHiddens[i] : this.numOfOutputs; Neuron.NormalizedMethod method = i == (numOfLayers - 1) ? Neuron.NormalizedMethod.SigmoidZeroTo1 : Neuron.NormalizedMethod.HyperTan; layers[i] = new PreceptorLayer(numOfPreceptors, prevNumOfPreceptors, method); numOfFeatures += numOfPreceptors; numOfConnections += prevNumOfPreceptors * numOfPreceptors; prevNumOfPreceptors = numOfPreceptors; } int idx = 0; featureIndex = new FeatureIndex[numOfFeatures]; for (int i = 0; i < numOfLayers; i++) { for (int j = 0; j < layers[i].numOfPreceptors; j++) { featureIndex[idx] = new FeatureIndex(i, j); idx += 1; } } idx = 0; connectionIndex = new ConnectionIndex[numOfConnections]; for (int i = 0; i < numOfLayers; i++) { for (int j = 0; j < layers[i].numOfPreceptors; j++) { for (int w = 0; w < layers[i].preceptors[j].GetNumWeights(); w++) { connectionIndex[idx] = new ConnectionIndex(i, j, w); idx += 1; } } } }